mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Reilly <marc@cpdesign.com.au>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] imx: Internal boot sources, handle all header offsets
Date: Fri,  1 Oct 2010 13:40:57 +1000	[thread overview]
Message-ID: <1285904458-7015-1-git-send-email-marc@cpdesign.com.au> (raw)

Makes the internal boot source configurable.
Also changes section names slightly so that .flash_header_0x1000 isn't
matched to .flash_header_0x100* etc.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
---
 arch/arm/mach-imx/Kconfig                         |   22 +++++++++++++
 arch/arm/mach-imx/include/mach/barebox.lds.h      |   12 ++++----
 arch/arm/mach-imx/include/mach/imx-flash-header.h |   34 +++++++++++++++-----
 3 files changed, 53 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 24d2684..b529ea2 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -40,6 +40,28 @@ config ARCH_IMX_INTERNAL_BOOT
 	bool "support internal boot mode"
 	depends on ARCH_IMX25 || ARCH_IMX35
 
+choice
+	depends on ARCH_IMX_INTERNAL_BOOT
+	prompt "Internal boot source"
+	help
+	  Determines the location of the header information for internal boot. 
+	  0x100 for OneNAND
+	  0x400 for NAND, SD/MMC or Serial ROM
+	  0x1000 for NOR
+
+config ARCH_IMX_INTERNAL_BOOT_NAND
+	default y
+	bool "NAND, SD/MMC, Serial ROM"
+	select NAND_IMX_BOOT
+
+config ARCH_IMX_INTERNAL_BOOT_NOR
+	bool "NOR"
+
+config ARCH_IMX_INTERNAL_BOOT_ONENAND
+	bool "OneNAND"
+
+endchoice
+
 comment "Freescale i.MX System-on-Chip"
 
 choice
diff --git a/arch/arm/mach-imx/include/mach/barebox.lds.h b/arch/arm/mach-imx/include/mach/barebox.lds.h
index 8e1eccd..a2932bd 100644
--- a/arch/arm/mach-imx/include/mach/barebox.lds.h
+++ b/arch/arm/mach-imx/include/mach/barebox.lds.h
@@ -5,13 +5,13 @@
 	.pre_image : {					\
 		KEEP(*(.flash_header_start*))		\
 		. = 0x100;				\
-		KEEP(*(.flash_header_0x100*))		\
-		KEEP(*(.dcd_entry_0x100*))		\
-		KEEP(*(.image_len_0x100*))		\
+		KEEP(*(.flash_header_0x0100*))		\
+		KEEP(*(.dcd_entry_0x0100*))		\
+		KEEP(*(.image_len_0x0100*))		\
 		. = 0x400;				\
-		KEEP(*(.flash_header_0x400*))		\
-		KEEP(*(.dcd_entry_0x400*))		\
-		KEEP(*(.image_len_0x400*))		\
+		KEEP(*(.flash_header_0x0400*))		\
+		KEEP(*(.dcd_entry_0x0400*))		\
+		KEEP(*(.image_len_0x0400*))		\
 		. = 0x1000;				\
 		KEEP(*(.flash_header_0x1000*))		\
 		KEEP(*(.dcd_entry_0x1000*))		\
diff --git a/arch/arm/mach-imx/include/mach/imx-flash-header.h b/arch/arm/mach-imx/include/mach/imx-flash-header.h
index 831a3aa..f1054da 100644
--- a/arch/arm/mach-imx/include/mach/imx-flash-header.h
+++ b/arch/arm/mach-imx/include/mach/imx-flash-header.h
@@ -3,17 +3,33 @@
 
 #define __flash_header_start		__section(.flash_header_start)
 
-#define __flash_header_0x100		__section(.flash_header_0x100)
-#define __dcd_entry_0x100		__section(.dcd_entry_0x100)
-#define __image_len_0x100		__section(.image_len_0x100)
+#if defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_NOR)
+	#define __flash_header_section		__section(.flash_header_0x1000)
+	#define __dcd_entry_section		__section(.dcd_entry_0x1000)
+	#define __image_len_section		__section(.image_len_0x1000)
+	#define FLASH_HEADER_OFFSET 0x1000
+#elif defined(CONFIG_ARCH_IMX_INTERNAL_BOOT_ONENAND)
+	#define __flash_header_section		__section(.flash_header_0x0100)
+	#define __dcd_entry_section		__section(.dcd_entry_0x0100)
+	#define __image_len_section		__section(.image_len_0x0100)
+	#define FLASH_HEADER_OFFSET 0x0100
+#else
+	#define __flash_header_section		__section(.flash_header_0x0400)
+	#define __dcd_entry_section		__section(.dcd_entry_0x0400)
+	#define __image_len_section		__section(.image_len_0x0400)
+	#define FLASH_HEADER_OFFSET 0x0400
+#endif
 
-#define __flash_header_0x400		__section(.flash_header_0x400)
-#define __dcd_entry_0x400		__section(.dcd_entry_0x400)
-#define __image_len_0x400		__section(.image_len_0x400)
+/*
+ * NOR is not automatically copied anywhere by the boot ROM
+ */
+#if defined (CONFIG_ARCH_IMX_INTERNAL_BOOT_NOR)
+	#define DEST_BASE	IMX_CS0_BASE
+#else
+	#define DEST_BASE	TEXT_BASE
+#endif
 
-#define __flash_header_0x1000		__section(.flash_header_0x1000)
-#define __dcd_entry_0x1000		__section(.dcd_entry_0x1000)
-#define __image_len_0x1000		__section(.image_len_0x1000)
+#define FLASH_HEADER_BASE	(DEST_BASE + FLASH_HEADER_OFFSET)
 
 struct imx_dcd_entry {
 	unsigned long ptr_type;
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2010-10-01  3:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-01  3:40 Marc Reilly [this message]
2010-10-01  3:40 ` [PATCH 2/2] Update flash headers for boards supporting internal boot Marc Reilly
2010-10-01  4:29 ` [PATCH 1/2] imx: Internal boot sources, handle all header offsets Jean-Christophe PLAGNIOL-VILLARD
2010-10-01  4:58   ` Marc Reilly
2010-10-01 16:53     ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-02  2:20       ` Marc Reilly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285904458-7015-1-git-send-email-marc@cpdesign.com.au \
    --to=marc@cpdesign.com.au \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox