Skip to contentSkip to conversation

ARM: davinci: omapl138_lcdk: fix MMC/SD boot breakage

PATCH Superseded Sekhar Nori 3 participants 9 messages May 30, 2019 – Jun 5, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 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.

v3:
Add call to spl_early_init() in 2/2 to take of DA850 EVM which uses device-tree in SPL.

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            | 5 ++++-
 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, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.16.2
#1 lore raw

PATCH v3 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
index 2c2f885d43e4..fe1bf4410145 100644
@@ -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
#2 lore raw

PATCH v3 1/2 ARM: davinci: omal138_lcdk: fix MMC boot breakage due to driver model conversion

Quoted 11 lines · Sekhar Nori

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.

Quoted 11 lines
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/davinci/da8xxevm/omapl138_lcdk.c +0 -0
index 2c2f885d43e4..fe1bf4410145 100644

board/davinci/da8xxevm/omapl138_lcdk.c int misc_init_r(void) · line 359

Quoted 8 lines
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,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190601/c5f5fd04/attachment.sig>

#3 lore raw

PATCH v3 1/2 ARM: davinci: omal138_lcdk: fix MMC boot breakage due to driver model conversion

In reply to Sekhar Nori
Quoted 7 lines · Sekhar Nori

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.

Quoted 6 lines

Instead use CONFIG_IS_ENABLED(DM_MMC) which will remain false until CONFIG_SPL_DM_MMC is defined.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190605/61c55dc8/attachment.sig>
#4 lore raw

PATCH v3 2/2 ARM: davinci: SPL: fix BSS initialization

In reply to Sekhar Nori

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.

---
 arch/arm/mach-davinci/spl.c       | 5 ++++-
 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, 4 insertions(+), 6 deletions(-)
arch/arm/mach-davinci/spl.c +4 -1
index 103639e34757..be3daa9bc02d 100644
@@ -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();
 }
 
configs/da850_am18xxevm_defconfig +0 -1
index f09822211312..7ecdc361ce85 100644
@@ -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
index 8c16d5c4f5a7..c09505828255 100644
@@ -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
index b8eac0e65995..727101634679 100644
@@ -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
index f2270264bda4..88a0d971ef28 100644
@@ -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
index e43141844a10..48f251ebb804 100644
@@ -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
#5 lore raw

PATCH v3 2/2 ARM: davinci: SPL: fix BSS initialization

Sorry about the double-send on this one - sent first time from off-list email addr.

Quoted 21 lines · Sekhar Nori

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().

Quoted 5 lines

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

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

Quoted 85 lines
---
 arch/arm/mach-davinci/spl.c       | 5 ++++-
 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, 4 insertions(+), 6 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-davinci/spl.c +0 -0

davinci/spl.c
index 103639e34757..be3daa9bc02d 100644

arch/arm/mach-davinci/spl.c +4 -1
@@ -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();
 }
 
configs/da850_am18xxevm_defconfig +0 -1
index f09822211312..7ecdc361ce85 100644
@@ -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
index 8c16d5c4f5a7..c09505828255 100644
@@ -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
index b8eac0e65995..727101634679 100644
@@ -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
index f2270264bda4..88a0d971ef28 100644
@@ -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 -0
index e43141844a10..48f251ebb804 100644

configs/omapl138_lcdk_defconfig CONFIG_VERSION_VARIABLE=y · line 23

Quoted 7 lines
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190601/a49c6d4b/attachment.sig>

#6 lore raw

PATCH v3 2/2 ARM: davinci: SPL: fix BSS initialization

In reply to Sekhar Nori
Quoted 15 lines · Sekhar Nori

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().

Quoted 7 lines

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

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

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190605/6d0b6e50/attachment.sig>
#7 lore raw

v3 cover ARM: davinci: omapl138_lcdk: fix MMC/SD boot breakage

In reply to Sekhar Nori
Quoted 5 lines · Sekhar Nori

Hi,

Here is a set of patches that fixes MMC/SD boot breakage introduced after 2018.09 release.

Quoted 7 lines

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.

Just re-tested. Seems to be working fine for me on LCDK both NAND and MMC/SD.

Quoted 18 lines

v3:
Add call to spl_early_init() in 2/2 to take of DA850 EVM which uses device-tree in SPL.

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

Quoted 9 lines
 arch/arm/mach-davinci/spl.c            | 5 ++++-
 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, 5 insertions(+), 7 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190601/74254292/attachment.sig>

#8 lore raw

v3 cover ARM: davinci: omapl138_lcdk: fix MMC/SD boot breakage

Quoted 8 lines · Peter Howard
Quoted 7 lines · Sekhar Nori

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.

Quoted 8 lines
Quoted 5 lines

Peter,

I dropped your Tested-by: because the patches changed. It will be great
to get your testing done again.

Just re-tested. Seems to be working fine for me on LCDK both NAND and MMC/SD.

Thanks Peter!

Regards,
Sekhar