imx: Internal boot sources, handle all header offsets
Subsystems (3)
PATCH 1/2 imx: Internal boot sources, handle all header offsets
Makes the internal boot source configurable.
Also changes section names slightly so that .flash_header_0x1000 isn't matched to .flash_header_0x100* etc.
--- 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(-)
arch/arm/mach-imx/Kconfig +22 -0
@@ -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
arch/arm/mach-imx/include/mach/barebox.lds.h +6 -6
@@ -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*)) \
arch/arm/mach-imx/include/mach/imx-flash-header.h +25 -9
@@ -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;
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 Update flash headers for boards supporting internal boot.
--- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 15 ++++++++------- arch/arm/boards/eukrea_cpuimx35/flash_header.c | 20 +++++++++++--------- arch/arm/boards/freescale-mx25-3-stack/3stack.c | 19 +++++++++---------- .../boards/freescale-mx35-3-stack/flash_header.c | 20 ++++++++++---------- 4 files changed, 38 insertions(+), 36 deletions(-)
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +8 -7
@@ -42,13 +42,14 @@#include <mach/iomux-mx25.h> extern unsigned long _stext; +extern void exception_vectors (void ); void __naked __flash_header_start go(void) { __asm__ __volatile__("b exception_vectors\n" ); } -struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { +struct imx_dcd_entry __dcd_entry_section dcd_entry[] = { { .ptr_type =4 , .addr =0xb8001010 , .val =0x00000004 , }, { .ptr_type =4 , .addr =0xb8001000 , .val =0x92100000 , }, { .ptr_type =1 , .addr =0x80000400 , .val =0x12344321 , },
@@ -63,21 +64,21 @@ struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { { .ptr_type = 4, .addr = 0x53f80008, .val = 0x20034000, }, }; -struct imx_flash_header __flash_header_0x400 eukrea_cpuimx25_header = { - .app_code_jump_vector =TEXT_BASE +0x2000 , +struct imx_flash_header __flash_header_section flash_header = { + .app_code_jump_vector =DEST_BASE + ((unsigned int )&exception_vectors -TEXT_BASE ), .app_code_barker =APP_CODE_BARKER , .app_code_csf =0 , - .dcd_ptr_ptr =TEXT_BASE +0x400 + offsetof(struct imx_flash_header , dcd), + .dcd_ptr_ptr =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd), .super_root_key =0 , - .dcd =TEXT_BASE +0x400 + offsetof(struct imx_flash_header , dcd_barker), - .app_dest =TEXT_BASE , + .dcd =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd_barker), + .app_dest =DEST_BASE , .dcd_barker =DCD_BARKER , .dcd_block_len =sizeof (dcd_entry), };extern unsigned long __bss_start; -unsigned long __image_len_0x400 barebox_len =0x40000 ; +unsigned long __image_len_section barebox_len =0x40000 ;static struct fec_platform_data fec_info = { .xcv_type =RMII ,
arch/arm/boards/eukrea_cpuimx35/flash_header.c +11 -9
@@ -1,12 +1,15 @@#include <common.h> #include <mach/imx-flash-header.h> +#include <mach/imx-regs.h> + +extern void exception_vectors (void ); void __naked __flash_header_start go(void) { __asm__ __volatile__("b exception_vectors\n" ); } -struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { +struct imx_dcd_entry __dcd_entry_section dcd_entry[] = { { .ptr_type =4 , .addr =0x53F80004 , .val =0x00821000 , }, { .ptr_type =4 , .addr =0x53F80004 , .val =0x00821000 , }, { .ptr_type =4 , .addr =0xB8001010 , .val =0x00000004 , },
@@ -24,18 +27,17 @@ struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { { .ptr_type = 4, .addr = 0xB8001010, .val = 0x00000004, }, }; -#define APP_DEST 0x80000000 -struct imx_flash_header __flash_header_0x400 eukrea_cpuimx35_header = { - .app_code_jump_vector =APP_DEST +0x1000 , +struct imx_flash_header __flash_header_section flash_header = { + .app_code_jump_vector =DEST_BASE + ((unsigned int )&exception_vectors -TEXT_BASE ), .app_code_barker =APP_CODE_BARKER , .app_code_csf =0 , - .dcd_ptr_ptr =APP_DEST +0x400 + offsetof(struct imx_flash_header , dcd), + .dcd_ptr_ptr =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd), .super_root_key =0 , - .dcd =APP_DEST +0x400 + offsetof(struct imx_flash_header , dcd_barker), - .app_dest =APP_DEST , + .dcd =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd_barker), + .app_dest =DEST_BASE , .dcd_barker =DCD_BARKER , - .dcd_block_len =sizeof (dcd_entry), + .dcd_block_len =sizeof (dcd_entry), }; -unsigned long __image_len_0x400 barebox_len =0x40000 ; +unsigned long __image_len_section barebox_len =0x40000 ;
arch/arm/boards/freescale-mx25-3-stack/3stack.c +9 -10
@@ -42,13 +42,14 @@#include <i2c/mc34704.h> extern unsigned long _stext; +extern void exception_vectors (void ); void __naked __flash_header_start go(void) { __asm__ __volatile__("b exception_vectors\n" ); } -struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { +struct imx_dcd_entry __dcd_entry_section dcd_entry[] = { { .ptr_type =4 , .addr =0xb8002050 , .val =0x0000d843 , }, { .ptr_type =4 , .addr =0xb8002054 , .val =0x22252521 , }, { .ptr_type =4 , .addr =0xb8002058 , .val =0x22220a00 , },
@@ -90,23 +91,21 @@ struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { { .ptr_type = 4, .addr = 0x53f80008, .val = 0x20034000, }, }; -#define APP_DEST 0x80000000 - -struct imx_flash_header __flash_header_0x400 mx25_3ds_header = { - .app_code_jump_vector =APP_DEST +0x1000 , +struct imx_flash_header __flash_header_section flash_header = { + .app_code_jump_vector =DEST_BASE + ((unsigned int )&exception_vectors -TEXT_BASE ), .app_code_barker =APP_CODE_BARKER , .app_code_csf =0 , - .dcd_ptr_ptr =APP_DEST +0x400 + offsetof(struct imx_flash_header , dcd), + .dcd_ptr_ptr =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd), .super_root_key =0 , - .dcd =APP_DEST +0x400 + offsetof(struct imx_flash_header , dcd_barker), - .app_dest =APP_DEST , + .dcd =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd_barker), + .app_dest =DEST_BASE , .dcd_barker =DCD_BARKER , - .dcd_block_len =sizeof (dcd_entry), + .dcd_block_len =sizeof (dcd_entry), };extern unsigned long __bss_start; -unsigned long __image_len_0x400 barebox_len =0x40000 ; +unsigned long __image_len_section barebox_len =0x40000 ;static struct fec_platform_data fec_info = { .xcv_type =RMII ,
arch/arm/boards/freescale-mx35-3-stack/flash_header.c +10 -10
@@ -1,14 +1,15 @@#include <common.h> #include <mach/imx-flash-header.h> +#include <mach/imx-regs.h> -extern unsigned long _stext; +extern void exception_vectors (void ); void __naked __flash_header_start go(void) { __asm__ __volatile__("b exception_vectors\n" ); } -struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { +struct imx_dcd_entry __dcd_entry_section dcd_entry[] = { { .ptr_type =4 , .addr =0xb8002050 , .val =0x0000d843 , }, { .ptr_type =4 , .addr =0xB8002054 , .val =0x22252521 , }, { .ptr_type =4 , .addr =0xB8002058 , .val =0x22220a00 , },
@@ -31,19 +32,18 @@ struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { { .ptr_type = 4, .addr = 0xB8001008, .val = 0x00002000, }, }; -#define APP_DEST 0x80000000 -struct imx_flash_header __flash_header_0x400 flash_header = { - .app_code_jump_vector =APP_DEST +0x1000 , +struct imx_flash_header __flash_header_section flash_header = { + .app_code_jump_vector =DEST_BASE + ((unsigned int )&exception_vectors -TEXT_BASE ), .app_code_barker =APP_CODE_BARKER , .app_code_csf =0 , - .dcd_ptr_ptr =APP_DEST +0x400 + offsetof(struct imx_flash_header , dcd), + .dcd_ptr_ptr =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd), .super_root_key =0 , - .dcd =APP_DEST +0x400 + offsetof(struct imx_flash_header , dcd_barker), - .app_dest =APP_DEST , + .dcd =FLASH_HEADER_BASE + offsetof(struct imx_flash_header , dcd_barker), + .app_dest =DEST_BASE , .dcd_barker =DCD_BARKER , - .dcd_block_len =sizeof (dcd_entry), + .dcd_block_len =sizeof (dcd_entry), }; -unsigned long __image_len_0x400 barebox_len =0x40000 ; +unsigned long __image_len_section barebox_len =0x40000 ;
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 6 lines
#define
__flash_header_start__section(.flash_header_start)arch/arm/mach-imx/include/mach/imx-flash-header.h +0
-3-#define __flash_header_0x100 __section(.flash_header_0x100) -#define __dcd_entry_0x100 __section(.dcd_entry_0x100) -#define __image_len_0x100 __section(.image_len_0x100)
arch/arm/mach-imx/include/mach/imx-flash-header.h line 15
Quoted 10 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h +10
-0+#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
nor and onenand are the same why duplicate them?
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi,
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h +4
-1-#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)
Quoted 8 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h line 15
Quoted 6 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h +6
-0+#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 0x0100nor and onenand are the same why duplicate them?
They look similar but, NOR offset is at 4Kb (0x1000), OneNand is 256b (0x100).
(The leading zero for 0x0100 doesn't help, but is necessary otherwise the blah_0x1000 matches the blah_0x100* linker section.)
Cheers
Marc
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 16 lines · Marc Reilly
Hi,
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h +4
-1-#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)Quoted 8 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h line 15
Quoted 6 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h +6
-0+#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 0x0100nor and onenand are the same why duplicate them?
Quoted 4 lines
They look similar but, NOR offset is at 4Kb (
0x1000), OneNand is 256b (0x100).(The leading zero for
0x0100doesn't help, but is necessary otherwise theblah_0x1000matches the blah_0x100* linker section.)
why do we need specific section name?
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Marc Reilly
Hi,
Quoted 13 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h line 15
Quoted 11 lines
arch/arm/mach-imx/include/mach/imx-flash-header.h +10
-1-#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 0x0100nor and onenand are the same why duplicate them?
Quoted 4 lines
Quoted 4 lines
They look similar but, NOR offset is at 4Kb (
0x1000), OneNand is 256b (0x100).(The leading zero for
0x0100doesn't help, but is necessary otherwise the
(Clarification here, I meant that the leading zero potentially makes them look more similar)
Quoted 3 lines
Quoted 1 line
blah_0x1000matches the blah_0x100* linker section.)why do we need specific section name?
Only the the final link location really matters, there are three locations that the internal boot ROM could look for the flash header info, depending on the type of external media.
The way it was set up was that there were the three predefined sections that would be located at the correct address. The approach I took with these patches was to just keep that the same.
Looking back, possibly there is a simpler way to do it, but I've got to move on to other things.
Cheers
Marc
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox