Skip to contentSkip to conversation

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

PATCH New Sekhar Nori 3 participants 11 messages May 21, 2019 – May 24, 2019

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

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. I still need to do SPI and NAND boot on this board.

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            | 6 +++++-
 board/davinci/da8xxevm/omapl138_lcdk.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.16.2
#1 lore raw

PATCH 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 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 10 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/20190522/8b0cb510/attachment.sig>

#3 lore raw

PATCH 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(). Since the README recommends calling preloader_console_init() from spl_board_init(), we keep it as-it-is.

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

---
 arch/arm/mach-davinci/spl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/spl.c +5 -1
index 103639e34757..117b5ee836f8 100644
@@ -33,10 +33,14 @@ void putc(char c)
 
 void spl_board_init(void)
 {
-	arch_cpu_init();
 	preloader_console_init();
 }
 
+void board_init_f(ulong dummy)
+{
+	arch_cpu_init();
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
Signature · 1 line
2.16.2
#4 lore raw

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

Quoted 7 lines

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(). Since the README recommends calling preloader_console_init() from spl_board_init(), we keep it as-it-is.

The README also states preloader_console_init() can get called from board_init_f(). Doing this enables for debugging of board_init_r

Quoted 13 lines

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

---
 arch/arm/mach-davinci/spl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/spl.c +0 -0
index 103639e34757..117b5ee836f8 100644

arch/arm/mach-davinci/spl.c void putc(char c) · line 41

Quoted 10 lines
arch/arm/mach-davinci/spl.c +3 -1
@@ -33,10 +33,14 @@ void putc(char c)
 
 void spl_board_init(void)
 {
-       arch_cpu_init();
        preloader_console_init();
 }
 
+void board_init_f(ulong dummy)
+{
+       arch_cpu_init();

What about a reference to board_early_init_f()?
Looking at other boards, it appears that we should call that here. Both the LCDK and da850 evm have the function enabled to configure the DSP.

adam

Quoted 8 lines
arch/arm/mach-davinci/spl.c +2 -1
+}
+
 u32 spl_boot_device(void)
 {
        switch (davinci_syscfg_regs->bootcfg) {
--

2.16.2

#5 lore raw

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

Quoted 14 lines · Adam Ford
Quoted 13 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.

Quoted 6 lines
Quoted 3 lines

Fix this by simply calling arch_cpu_init() from board_init_f(). Since the README recommends calling preloader_console_init() from spl_board_init(), we keep it as-it-is.

The README also states preloader_console_init() can get called from board_init_f(). Doing this enables for debugging of board_init_r

Okay, I can change it. spl_board_init() will be empty so I will turn off
CONFIG_SPL_BOARD_INIT also.

I was put off by README saying "preloader_console_init() can be called here in extremis" which I meant as saying it should be rare to do that.

Debugging board_init_r() should be pretty useful, so perhaps the wording there should be more easy.

Quoted 21 lines
Quoted 21 lines

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

---
 arch/arm/mach-davinci/spl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/spl.c +0 -1
index 103639e34757..117b5ee836f8 100644
@@ -33,10 +33,14 @@ void putc(char c)
 
 void spl_board_init(void)
 {
-       arch_cpu_init();
        preloader_console_init();
 }
 
Quoted 8 lines

arch/arm/mach-davinci/spl.c void putc(char c) · line 41

Quoted 3 lines
arch/arm/mach-davinci/spl.c +3 -0
+void board_init_f(ulong dummy)
+{
+       arch_cpu_init();

What about a reference to board_early_init_f()?
Looking at other boards, it appears that we should call that here. Both the LCDK and da850 evm have the function enabled to configure the DSP.

This is only needed at U-Boot stage, right? Looks like it will be called because CONFIG_BOARD_EARLY_INIT_F is enabled.

Thanks,
Sekhar

#6 lore raw

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

Quoted 23 lines · Sekhar Nori
Quoted 14 lines · Adam Ford
Quoted 13 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.

Quoted 6 lines
Quoted 3 lines

Fix this by simply calling arch_cpu_init() from board_init_f(). Since the README recommends calling preloader_console_init() from spl_board_init(), we keep it as-it-is.

The README also states preloader_console_init() can get called from board_init_f(). Doing this enables for debugging of board_init_r

Quoted 8 lines

Okay, I can change it. spl_board_init() will be empty so I will turn off
CONFIG_SPL_BOARD_INIT also.

I was put off by README saying "preloader_console_init() can be called here in extremis" which I meant as saying it should be rare to do that.

Debugging board_init_r() should be pretty useful, so perhaps the wording there should be more easy.

At least for the da850evm which uses the device tree, you'll need to call spl_early_init() before the preloader_console_init() in order for the UART to work correctly and debug board_init_r.

Quoted 31 lines
Quoted 22 lines
Quoted 22 lines

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

---
 arch/arm/mach-davinci/spl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/spl.c +0 -1
index 103639e34757..117b5ee836f8 100644
@@ -33,10 +33,14 @@ void putc(char c)
 
 void spl_board_init(void)
 {
-       arch_cpu_init();
        preloader_console_init();
 }
 
Quoted 8 lines

arch/arm/mach-davinci/spl.c void putc(char c) · line 41

Quoted 3 lines
arch/arm/mach-davinci/spl.c +3 -0
+void board_init_f(ulong dummy)
+{
+       arch_cpu_init();

What about a reference to board_early_init_f()?
Looking at other boards, it appears that we should call that here. Both the LCDK and da850 evm have the function enabled to configure the DSP.

Quoted 2 lines

This is only needed at U-Boot stage, right? Looks like it will be called because CONFIG_BOARD_EARLY_INIT_F is enabled.

That is my understanding.

Thanks for being flexible on this. Sorry I broke the lcdk, but I'm willing to help modernize it as well (ie, help support SPL_OF_CONTROL) if someone can get me a board. The general trend is to try and support these newer DM functions and remove the old legacy code functions.

adam

Quoted 3 lines

Thanks,
Sekhar

#7 lore raw

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

Quoted 21 lines · Adam Ford
Quoted 20 lines
Quoted 20 lines
Quoted 5 lines
arch/arm/mach-davinci/spl.c +0 -0
index 103639e34757..117b5ee836f8 100644

arch/arm/mach-davinci/spl.c void putc(char c) · line 41

Quoted 10 lines
arch/arm/mach-davinci/spl.c +3 -1
@@ -33,10 +33,14 @@ void putc(char c)
 
 void spl_board_init(void)
 {
-       arch_cpu_init();
        preloader_console_init();
 }
 
+void board_init_f(ulong dummy)
+{
+       arch_cpu_init();

What about a reference to board_early_init_f()?
Looking at other boards, it appears that we should call that here. Both the LCDK and da850 evm have the function enabled to configure the DSP.

Quoted 4 lines
Quoted 2 lines

This is only needed at U-Boot stage, right? Looks like it will be called because CONFIG_BOARD_EARLY_INIT_F is enabled.

That is my understanding.

Alright, so I wont do anything about board_early_init_f() in this series.

Quoted 4 lines

Thanks for being flexible on this. Sorry I broke the lcdk, but I'm willing to help modernize it as well (ie, help support SPL_OF_CONTROL) if someone can get me a board. The general trend is to try and

Sure, working on getting a board!

Quoted 2 lines

support these newer DM functions and remove the old legacy code functions.

A lot of modernization of DA850 support has been due to your attention on the EVM. Its much appreciated :)

Regards,
Sekhar

#8 lore raw

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

In reply to Sekhar Nori
Quoted 22 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(). Since the
README recommends calling preloader_console_init() from spl_board_init(),
we keep it as-it-is.

Quoted 3 lines

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

Quoted 15 lines
---
 arch/arm/mach-davinci/spl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach- renamed from arch/arm/mach-davinci/spl.c +0 -0

davinci/spl.c
index 103639e34757..117b5ee836f8 100644

arch/arm/mach-davinci/spl.c +0 -1
@@ -33,10 +33,14 @@ void putc(char c)
 
 void spl_board_init(void)
 {
-	arch_cpu_init();
 	preloader_console_init();

arch/arm/mach-davinci/spl.c void putc(char c) · line 46

Quoted 10 lines
arch/arm/mach-davinci/spl.c +5 -0
 }
 
+void board_init_f(ulong dummy)
+{
+	arch_cpu_init();
+}
+
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {

-------------- 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/20190522/5bd1644a/attachment.sig>

#9 lore raw

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

In reply to Sekhar Nori

Hi Sekhar

Quoted 8 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. I still need to do SPI and NAND boot on this board.

I have tested NAND boot with the two patches and it seems to work fine. I can confirm MMC boot (at least on the original LCDK)

The original LCDK didn't have SPI NAND - has that changed with the latest board?

Quoted 13 lines

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            | 6 +++++-
 board/davinci/da8xxevm/omapl138_lcdk.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
Signature · 9 lines
Peter Howard <[email protected]>
Peter Howard <[email protected]>
-------------- 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/20190522/728ae51c/attachment.sig>
#10 lore raw

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

Quoted 12 lines · Peter Howard

Hi Sekhar

Quoted 8 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. I still need to do SPI and NAND boot on this board.

Quoted 5 lines

I have tested NAND boot with the two patches and it seems to work fine. I can confirm MMC boot (at least on the original LCDK)

The original LCDK didn't have SPI NAND - has that changed with the latest board?

Just checked - nope, no SPI flash on LCDK. I was speaking from (wrong) memory there!

Thanks for the testing!

Thanks,
Sekhar