ARM: davinci: SPL: fix BSS initialization
authorSekhar Nori <nsekhar@ti.com>
Thu, 30 May 2019 13:34:55 +0000 (19:04 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 5 Jun 2019 16:14:02 +0000 (12:14 -0400)
U-Boot README recommends initializing SDRAM in board_init_f(). DA850
was doing it as part of board_init_r() (through call to spl_board_init()
which calls arch_cpu_init() which calls da850_ddr_setup())

This worked fine till commit 15b8c7505819 ("davinci:
da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is full") moved
BSS to SDRAM.

Functions like mmc_initialize() called in board_init_r() assume BSS is
available. Since SDRAM was not initialized when arch/arm/lib/crt0.S tried
to initialize BSS to 0, BSS is not initialized correctly.

Fix this by simply calling arch_cpu_init() from board_init_f(). Also move
preloader_console_init() there to help debug issues with board_init_r().

With this spl_board_init() is no longer needed, we remove it.

Tested using MMC/SD boot on OMAP-L138 LCDK board.

Tested-by: Adam Ford <aford173@gmail.com> #da850evm
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Peter Howard <phoward@gme.net.au> #omapl138_lcdk
arch/arm/mach-davinci/spl.c
configs/da850_am18xxevm_defconfig
configs/da850evm_defconfig
configs/da850evm_nand_defconfig
configs/omapl138_lcdk_defconfig

index 103639e347579410b8005ba36e773b97afbf048a..be3daa9bc02dfe715d72bc12897be10b66774d7f 100644 (file)
@@ -31,9 +31,12 @@ void putc(char c)
 }
 #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
 
-void spl_board_init(void)
+void board_init_f(ulong dummy)
 {
        arch_cpu_init();
+
+       spl_early_init();
+
        preloader_console_init();
 }
 
index f098222113123172eb8e946976392da9d442c233..7ecdc361ce8568a10222ba9611549d8ba7b742ba 100644 (file)
@@ -20,7 +20,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot > "
index 8c16d5c4f5a7935cd2542b19dd8622c3f8e86141..c09505828255cafc7f064486082afb745c8a02b2 100644 (file)
@@ -21,7 +21,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_SPI_LOAD=y
index b8eac0e6599543f0fd51630369536d186ba0dc5b..727101634679e00defba37c5df841784faee95b0 100644 (file)
@@ -19,7 +19,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_NAND_SUPPORT=y
index e43141844a102561b423dd6448bf513b053df850..48f251ebb804e889532cd4d871b4c82c00a3dcb3 100644 (file)
@@ -18,7 +18,6 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x80000000
-CONFIG_SPL_BOARD_INIT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y