[U-Boot] [PATCH 0/5] ARM: SPL: at91: update to support DM/DT

To support the driver model and device tree in SPL, fix the boot device, bring in the serial device from device tree, and use "_image_binary_end" variable to point to the correct device tree location when CONFIG_SPL_SEPARATE_BSS is enabled.
Wenyou Yang (5): ARM: at91: spl: specify MMC and NAND boot device ARM: spl: atmel: bring in serial device before init ARM: spl: atmel: move mem_init() advance in SPL init. ARM: at91: lds: use "_image_binary_end" for DT location ARM: at91: lds: add test SPL binary size and bbs size
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 10 ++++++++++ arch/arm/mach-at91/armv7/u-boot-spl.lds | 2 ++ arch/arm/mach-at91/spl.c | 7 +++++++ arch/arm/mach-at91/spl_atmel.c | 11 ++++++++++- 4 files changed, 29 insertions(+), 1 deletion(-)

When OF_CONTROL is enabled, MMC boot device should not be detected automatically, it should be MMC1 fixedly only the status "enabled" is available.
Add NAND Flash boot device as well.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
arch/arm/mach-at91/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/mach-at91/spl.c b/arch/arm/mach-at91/spl.c index 98f280cbf7..e113336b7b 100644 --- a/arch/arm/mach-at91/spl.c +++ b/arch/arm/mach-at91/spl.c @@ -39,12 +39,16 @@ u32 spl_boot_device(void)
#if defined(CONFIG_SYS_USE_MMC) if (dev == ATMEL_SAMA5_BOOT_FROM_MCI) { +#if defined(CONFIG_SPL_OF_CONTROL) + return BOOT_DEVICE_MMC1; +#else if (off == 0) return BOOT_DEVICE_MMC1; if (off == 1) return BOOT_DEVICE_MMC2; printf("ERROR: MMC controller %i not present!\n", dev); hang(); +#endif } #endif
@@ -53,6 +57,9 @@ u32 spl_boot_device(void) return BOOT_DEVICE_SPI; #endif
+ if (dev == ATMEL_SAMA5_BOOT_FROM_SMC) + return BOOT_DEVICE_NAND; + if (dev == ATMEL_SAMA5_BOOT_FROM_SAMBA) return BOOT_DEVICE_USB;

Before setting up the serial communications, bring in the serial device from the device tree file.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
arch/arm/mach-at91/spl_atmel.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/arch/arm/mach-at91/spl_atmel.c b/arch/arm/mach-at91/spl_atmel.c index 688289e7cf..847a30b9a9 100644 --- a/arch/arm/mach-at91/spl_atmel.c +++ b/arch/arm/mach-at91/spl_atmel.c @@ -77,6 +77,8 @@ void s_init(void)
void board_init_f(ulong dummy) { + int ret; + switch_to_main_crystal_osc();
#ifdef CONFIG_SAMA5D2 @@ -99,6 +101,12 @@ void board_init_f(ulong dummy)
board_early_init_f();
+ ret = spl_init(); + if (ret) { + debug("spl_init() failed: %d\n", ret); + hang(); + } + preloader_console_init();
mem_init();

Because the MMC SPL puts the bbs section in the ddr memory, move calling mem_init() before calling spl_init().
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
arch/arm/mach-at91/spl_atmel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-at91/spl_atmel.c b/arch/arm/mach-at91/spl_atmel.c index 847a30b9a9..b75c2ccefd 100644 --- a/arch/arm/mach-at91/spl_atmel.c +++ b/arch/arm/mach-at91/spl_atmel.c @@ -101,6 +101,8 @@ void board_init_f(ulong dummy)
board_early_init_f();
+ mem_init(); + ret = spl_init(); if (ret) { debug("spl_init() failed: %d\n", ret); @@ -109,5 +111,4 @@ void board_init_f(ulong dummy)
preloader_console_init();
- mem_init(); }

The MMC SPL locates the BSS section to a different memory region from text, then use "_image_binary_end" variable to point to the correct device tree location.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
arch/arm/mach-at91/armv7/u-boot-spl.lds | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-at91/armv7/u-boot-spl.lds b/arch/arm/mach-at91/armv7/u-boot-spl.lds index c667c5555b..d2e41a026c 100644 --- a/arch/arm/mach-at91/armv7/u-boot-spl.lds +++ b/arch/arm/mach-at91/armv7/u-boot-spl.lds @@ -47,6 +47,8 @@ SECTIONS *(.__end) } >.sram
+ _image_binary_end = .; + .bss : { . = ALIGN(4);

Add the test for the SPL binary size and the bbs section size.
Signed-off-by: Wenyou Yang wenyou.yang@atmel.com ---
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds index 1b0420611e..e142454483 100644 --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds @@ -49,3 +49,13 @@ SECTIONS __bss_end = .; } >.sdram } + +#if defined(CONFIG_SPL_MAX_SIZE) +ASSERT(__image_copy_end - __image_copy_start < (CONFIG_SPL_MAX_SIZE), \ + "SPL image too big"); +#endif + +#if defined(CONFIG_SPL_BSS_MAX_SIZE) +ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS_MAX_SIZE), \ + "SPL image BSS too big"); +#endif
participants (1)
-
Wenyou Yang