[PATCH 06/10] i.MX flash header: make it work on i.MX35

Sascha Hauer s.hauer at pengutronix.de
Thu Dec 3 04:53:51 EST 2009


The flash header is used on different i.MXs other than the
i.MX25, so rename it. Also, add a possibility to put a flash
header on different offsets (0x100, 0x400 and 0x1000), needed
for different boot mediums.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-imx/Kconfig                          |    4 ++
 arch/arm/mach-imx/include/mach/imx-flash-header.h  |   48 ++++++++++++++++++++
 .../arm/mach-imx/include/mach/imx25-flash-header.h |   44 ------------------
 arch/arm/mach-imx/include/mach/u-boot.lds.h        |   23 +++++++--
 include/asm-generic/u-boot.lds.h                   |    2 +-
 5 files changed, 71 insertions(+), 50 deletions(-)
 create mode 100644 arch/arm/mach-imx/include/mach/imx-flash-header.h
 delete mode 100644 arch/arm/mach-imx/include/mach/imx25-flash-header.h

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 8927bb4..a0e828a 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -29,6 +29,10 @@ config BOARDINFO
 config ARCH_HAS_FEC_IMX
 	bool
 
+config ARCH_IMX_INTERNAL_BOOT
+	bool "support internal boot mode"
+	depends on ARCH_IMX25 || ARCH_IMX35
+
 comment "Freescale i.MX System-on-Chip"
 
 choice
diff --git a/arch/arm/mach-imx/include/mach/imx-flash-header.h b/arch/arm/mach-imx/include/mach/imx-flash-header.h
new file mode 100644
index 0000000..831a3aa
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/imx-flash-header.h
@@ -0,0 +1,48 @@
+#ifndef __MACH_FLASH_HEADER_H
+#define __MACH_FLASH_HEADER_H
+
+#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)
+
+#define __flash_header_0x400		__section(.flash_header_0x400)
+#define __dcd_entry_0x400		__section(.dcd_entry_0x400)
+#define __image_len_0x400		__section(.image_len_0x400)
+
+#define __flash_header_0x1000		__section(.flash_header_0x1000)
+#define __dcd_entry_0x1000		__section(.dcd_entry_0x1000)
+#define __image_len_0x1000		__section(.image_len_0x1000)
+
+struct imx_dcd_entry {
+	unsigned long ptr_type;
+	unsigned long addr;
+	unsigned long val;
+};
+
+#define DCD_BARKER	0xb17219e9
+
+struct imx_rsa_public_key {
+	unsigned char	rsa_exponent[4];
+	unsigned char	*rsa_modululs;
+	unsigned short	*exponent_size;
+	unsigned short	modulus_size;
+	unsigned char	init_flag;
+};
+
+#define APP_CODE_BARKER	0x000000b1
+
+struct imx_flash_header {
+	unsigned long			app_code_jump_vector;
+	unsigned long			app_code_barker;
+	unsigned long			app_code_csf;
+	unsigned long			dcd_ptr_ptr;
+	unsigned long			super_root_key;
+	unsigned long			dcd;
+	unsigned long			app_dest;
+	unsigned long			dcd_barker;
+	unsigned long			dcd_block_len;
+};
+
+#endif /* __MACH_FLASH_HEADER_H */
diff --git a/arch/arm/mach-imx/include/mach/imx25-flash-header.h b/arch/arm/mach-imx/include/mach/imx25-flash-header.h
deleted file mode 100644
index 59860db..0000000
--- a/arch/arm/mach-imx/include/mach/imx25-flash-header.h
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#define __flash_header_start	__section(.flash_header_start)
-#define __flash_header		__section(.flash_header)
-#define __dcd_entry		__section(.dcd_entry)
-#define __image_len		__section(.image_len)
-
-struct mx25_dcd_entry {
-	unsigned long ptr_type;
-	unsigned long addr;
-	unsigned long val;
-};
-
-#define DCD_BARKER	0xb17219e9
-
-struct mx25_dcd_header {
-	unsigned long barker;
-	unsigned long block_len;
-};
-
-struct mx25_rsa_public_key {
-	unsigned char	rsa_exponent[4];
-	unsigned char	*rsa_modululs;
-	unsigned short	*exponent_size;
-	unsigned short	modulus_size;
-	unsigned char	init_flag;
-};
-
-#define APP_CODE_BARKER	0x000000b1
-
-struct mx25_flash_header {
-	void				*app_code_jump_vector;
-	unsigned long			app_code_barker;
-	void				*app_code_csf;
-	struct mx25_dcd_header		**dcd_ptr_ptr;
-	struct mx25_rsa_public_key	*super_root_key;
-	struct mx25_dcd_header		*dcd;
-	void				*app_dest;
-};
-
-struct mx25_nand_flash_header {
-	struct mx25_flash_header	flash_header;
-	struct mx25_dcd_header		dcd_header;
-};
-
diff --git a/arch/arm/mach-imx/include/mach/u-boot.lds.h b/arch/arm/mach-imx/include/mach/u-boot.lds.h
index 52eb458..8e1eccd 100644
--- a/arch/arm/mach-imx/include/mach/u-boot.lds.h
+++ b/arch/arm/mach-imx/include/mach/u-boot.lds.h
@@ -1,9 +1,22 @@
 
-#define PRE_IMAGE .pre_image : {			\
+#ifdef CONFIG_ARCH_IMX_INTERNAL_BOOT
+
+#define PRE_IMAGE \
+	.pre_image : {					\
 		KEEP(*(.flash_header_start*))		\
-		. = ALIGN(0x400);			\
-		KEEP(*(.flash_header*))			\
-		KEEP(*(.dcd_entry*))			\
-		KEEP(*(.image_len*))			\
+		. = 0x100;				\
+		KEEP(*(.flash_header_0x100*))		\
+		KEEP(*(.dcd_entry_0x100*))		\
+		KEEP(*(.image_len_0x100*))		\
+		. = 0x400;				\
+		KEEP(*(.flash_header_0x400*))		\
+		KEEP(*(.dcd_entry_0x400*))		\
+		KEEP(*(.image_len_0x400*))		\
+		. = 0x1000;				\
+		KEEP(*(.flash_header_0x1000*))		\
+		KEEP(*(.dcd_entry_0x1000*))		\
+		KEEP(*(.image_len_0x1000*))		\
+		. = 0x2000;				\
 	}
+#endif
 
diff --git a/include/asm-generic/u-boot.lds.h b/include/asm-generic/u-boot.lds.h
index 1a5f2f7..2202627 100644
--- a/include/asm-generic/u-boot.lds.h
+++ b/include/asm-generic/u-boot.lds.h
@@ -1,5 +1,5 @@
 
-#ifdef CONFIG_ARCH_IMX25
+#if defined CONFIG_ARCH_IMX25 || defined CONFIG_ARCH_IMX35
 #include <mach/u-boot.lds.h>
 #endif
 
-- 
1.6.5.2





More information about the u-boot-v2 mailing list