ARM: davinci: omapl138_lcdk: fix MMC/SD boot breakage
Subsystems (3)
v2 cover ARM: davinci: omapl138_lcdk: fix MMC/SD boot breakage
Hi,
Here is a set of patches that fixes MMC/SD boot breakage introduced after 2018.09 release.
This was tested with MMC/SD boot on OMAP-L138 LCDK.
Peter,
I dropped your Tested-by: because the patches changed. It will be great to get your testing done again.
v2:
Move console init to board_init_f() and drop spl_board_init() as its not needed anymore.
Thanks,
Sekhar
Sekhar Nori (2):
ARM: davinci: omal138_lcdk: fix MMC boot breakage due to driver model
conversion
ARM: davinci: SPL: fix BSS initialization
arch/arm/mach-davinci/spl.c | 2 +- board/davinci/da8xxevm/omapl138_lcdk.c | 2 +- configs/da850_am18xxevm_defconfig | 1 - configs/da850evm_defconfig | 1 - configs/da850evm_nand_defconfig | 1 - configs/ipam390_defconfig | 1 - configs/omapl138_lcdk_defconfig | 1 - 7 files changed, 2 insertions(+), 7 deletions(-)
Signature · 1 line
2.16.2
PATCH v2 1/2 ARM: davinci: omal138_lcdk: fix MMC boot breakage due to driver model conversion
commit 21af33ed0319 ("ARM: davinci: omapl138_lcdk: Enable DM_MMC") wanted to enable DM_MMC only for U-Boot and not for SPL.
But CONFIG_DM_MMC is defined for SPL build too. Because of this MMC device was not getting registered for SPL causing MMC/SD boot breakage.
Instead use CONFIG_IS_ENABLED(DM_MMC) which will remain false until CONFIG_SPL_DM_MMC is defined.
--- board/davinci/da8xxevm/omapl138_lcdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/davinci/da8xxevm/omapl138_lcdk.c +1 -1
@@ -353,7 +353,7 @@ int misc_init_r(void)return 0 ; } -#ifndef CONFIG_DM_MMC +#if !CONFIG_IS_ENABLED (DM_MMC )#ifdef CONFIG_MMC_DAVINCI static struct davinci_mmc mmc_sd0 = { .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
Signature · 1 line
2.16.2
PATCH v2 2/2 ARM: davinci: SPL: fix BSS initialization
In reply to Sekhar NoriU-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.
--- arch/arm/mach-davinci/spl.c | 2 +- configs/da850_am18xxevm_defconfig | 1 - configs/da850evm_defconfig | 1 - configs/da850evm_nand_defconfig | 1 - configs/ipam390_defconfig | 1 - configs/omapl138_lcdk_defconfig | 1 - 6 files changed, 1 insertion(+), 6 deletions(-)
arch/arm/mach-davinci/spl.c +1 -1
@@ -31,7 +31,7 @@ void putc(char c) }#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ -void spl_board_init (void ) +void board_init_f (ulong dummy) {arch_cpu_init ();preloader_console_init ();
configs/da850_am18xxevm_defconfig +0 -1
@@ -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 > "
configs/da850evm_defconfig +0 -1
@@ -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
configs/da850evm_nand_defconfig +0 -1
@@ -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
configs/ipam390_defconfig +0 -1
@@ -14,7 +14,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_NAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_HUSH_PARSER=y
configs/omapl138_lcdk_defconfig +0 -1
@@ -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
Signature · 1 line
2.16.2
PATCH v2 2/2 ARM: davinci: SPL: fix BSS initialization
Quoted 9 lines · Sekhar Nori
U-Boot README recommends initializing SDRAM in
board_init_f(). DA850 was doing it as part ofboard_init_r()(through call tospl_board_init()which callsarch_cpu_init()which callsda850_ddr_setup())This worked fine till commit
15b8c7505819("davinci:
da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is full") moved BSS to SDRAM.
Quoted 8 lines
Functions like
mmc_initialize()called inboard_init_r()assume BSS is available. Since SDRAM was not initialized whenarch/arm/lib/crt0.Stried to initialize BSS to 0, BSS is not initialized correctly.Fix this by simply calling
arch_cpu_init()fromboard_init_f(). Also movepreloader_console_init()there to help debug issues withboard_init_r().With this
spl_board_init()is no longer needed, we remove it.
I like this idea.
Quoted 18 lines
Tested using MMC/SD boot on OMAP-L138 LCDK board.
Signed-off-by Sekhar Nori <[email protected]>--- arch/arm/mach-davinci/spl.c | 2 +- configs/da850_am18xxevm_defconfig | 1 - configs/da850evm_defconfig | 1 - configs/da850evm_nand_defconfig | 1 - configs/ipam390_defconfig | 1 - configs/omapl138_lcdk_defconfig | 1 - 6 files changed, 1 insertion(+), 6 deletions(-)arch/arm/mach-davinci/spl.c +0
-0
arch/arm/mach-davinci/spl.c void putc(char c) · line 35
Quoted 6 lines
arch/arm/mach-davinci/spl.c +1
-1@@ -31,7 +31,7 @@ void putc(char c) }#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */ -void spl_board_init (void ) +void board_init_f (ulong dummy) {
The da850 uses the device tree to get the serial port information, and someone else just submitted a patch to enable the device tree for the LCDK. At least for the da850-evm, we need to initialize the spl stuff here to fetch the device tree info in order to enable the serial port for preload_console_init() or it hangs.
I think we should add spl_early_init(); If you don't want it enabled all the time, we could encapsulate it in an ifdef checking for the presence of OF_CONTROL, but I think it should be harmless to have it executed all the time based on my interpretation of the readme file.
Quoted 65 lines
arch/arm/mach-davinci/spl.c +0
-0arch_cpu_init ();preloader_console_init ();configs/da850_am18xxevm_defconfig +0
-1@@ -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 > "configs/da850evm_defconfig +0
-1@@ -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=yconfigs/da850evm_nand_defconfig +0
-1@@ -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=yconfigs/ipam390_defconfig +0
-1@@ -14,7 +14,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_NAND_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_HUSH_PARSER=yconfigs/omapl138_lcdk_defconfig +0
-2@@ -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 --2.16.2
PATCH v2 2/2 ARM: davinci: SPL: fix BSS initialization
Quoted 10 lines · Adam Ford
arch/arm/mach-davinci/spl.c void putc(char c) · line 35
Quoted 3 lines
arch/arm/mach-davinci/spl.c +1
-1-void spl_board_init (void ) +void board_init_f (ulong dummy) {The da850 uses the device tree to get the serial port information, and someone else just submitted a patch to enable the device tree for the LCDK. At least for the da850-evm, we need to initialize the spl stuff here to fetch the device tree info in order to enable the serial port for
preload_console_init()or it hangs.
Quoted 4 lines
I think we should add
spl_early_init(); If you don't want it enabled all the time, we could encapsulate it in an ifdef checking for the presence ofOF_CONTROL, but I think it should be harmless to have it executed all the time based on my interpretation of the readme file.
I added it in my branch:
http://git.ti.com/cgit/cgit.cgi/~dmurphy/ti-u-boot/nsekhar-ti-u-boot.git/log/?h=omapl138-mmc-boot
It works well on my LCDK for MMC boot. Can you please check it on DA850 EVM and then I will submit to mailing list.
Thanks,
Sekhar
PATCH v2 2/2 ARM: davinci: SPL: fix BSS initialization
Quoted 17 lines · Sekhar Nori
Quoted 10 lines · Adam Ford
arch/arm/mach-davinci/spl.c void putc(char c) · line 35
Quoted 3 lines
arch/arm/mach-davinci/spl.c +1
-1-void spl_board_init (void ) +void board_init_f (ulong dummy) {The da850 uses the device tree to get the serial port information, and someone else just submitted a patch to enable the device tree for the LCDK. At least for the da850-evm, we need to initialize the spl stuff here to fetch the device tree info in order to enable the serial port for
preload_console_init()or it hangs.Quoted 4 lines
I think we should add
spl_early_init(); If you don't want it enabled all the time, we could encapsulate it in an ifdef checking for the presence ofOF_CONTROL, but I think it should be harmless to have it executed all the time based on my interpretation of the readme file.
Quoted 6 lines
I added it in my branch:
http://git.ti.com/cgit/cgit.cgi/~dmurphy/ti-u-boot/nsekhar-ti-u-boot.git/log/?h=omapl138-mmc-boot
It works well on my LCDK for MMC boot. Can you please check it on DA850 EVM and then I will submit to mailing list.
Looks find to me. Go ahead and add
Quoted 3 lines
Thanks,
Sekhar