omapl138_lcdk: fix MMC boot
cover omapl138_lcdk: fix MMC boot
From: Bartosz Golaszewski <[email protected]>
Booting from MMC on omapl138-lcdk is currently broken after we enabled driver-model in SPL. While I know what's wrong - the bind() callback not being called - I can't for the life of me figure out how to fix it.
I'm still working on proper changes, but for now, I'd like to propose this series which fixes MMC boot with a workaround in which we call mmc_boot() manually from probe.
First two patches drop some legacy code that's no longer needed. The third patch adds a U_BOOT_DEVICE() for mmc as we don't yet have full DT support (also in-progress). The last patch adds the workaround to the davinci mmc driver.
This series depends on Adam Ford's patch increasing the pre-reloc malloc pool.
[1] https://patchwork.ozlabs.org/patch/1192574/
Bartosz Golaszewski (4):
mmc: davinci: drop support for ti,dm6441-mmc
mmc: davinci: drop struct davinci_mmc_plat
board: omapl138_lcdk: add the mmc device to SPL
mmc: davinci: fix mmc boot in SPL
arch/arm/mach-davinci/Kconfig | 1 + .../mach-davinci/include/mach/sdmmc_defs.h | 6 -- board/davinci/da8xxevm/omapl138_lcdk.c | 10 ++- drivers/mmc/davinci_mmc.c | 73 +++++++------------ 4 files changed, 36 insertions(+), 54 deletions(-)
Signature · 1 line
2.23.0
PATCH 1/4 mmc: davinci: drop support for ti,dm6441-mmc
From: Bartosz Golaszewski <[email protected]>
The DM family of DaVinci SoCs is no longer supported. Drop the irrelevant code from the driver.
--- .../mach-davinci/include/mach/sdmmc_defs.h | 6 --- board/davinci/da8xxevm/omapl138_lcdk.c | 1 - drivers/mmc/davinci_mmc.c | 42 +++---------------- 3 files changed, 5 insertions(+), 44 deletions(-)
arch/arm/mach-davinci/include/mach/sdmmc_defs.h +0 -6
@@ -149,15 +149,9 @@ struct davinci_mmc {uint input_clk;/* Input clock to MMC controller */ uint host_caps;/* Host capabilities */ uint voltages;/* Host supported voltages */ -uint version;/* MMC Controller version */ struct mmc_config cfg; }; -enum { -MMC_CTLR_VERSION_1 =0 ,/* DM644x and DM355 */ -MMC_CTLR_VERSION_2 ,/* DA830 */ -}; -int davinci_mmc_init (bd_t *bis,struct davinci_mmc *host);#endif /* _SDMMC_DEFS_H */
board/davinci/da8xxevm/omapl138_lcdk.c +0 -1
@@ -342,7 +342,6 @@ static struct davinci_mmc mmc_sd0 = { .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE, .host_caps = MMC_MODE_4BIT, /* DA850 supports only 4-bit SD/MMC */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, - .version = MMC_CTLR_VERSION_2, };int board_mmc_init (bd_t *bis)
drivers/mmc/davinci_mmc.c +5 -37
82 lines not on this page · raw message
Signature · 1 line
2.23.0
PATCH 2/4 mmc: davinci: drop struct davinci_mmc_plat
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
struct mmc_config & struct mmc don't need to be exported over platform data, but can instead be private in the driver.
Remove struct davinci_mmc_plat.
--- drivers/mmc/davinci_mmc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/mmc/davinci_mmc.c +4 -10
@@ -32,10 +32,6 @@ struct davinci_mmc_priv {uint input_clk;/* Input clock to MMC controller */ struct gpio_desc cd_gpio;/* Card Detect GPIO */ struct gpio_desc wp_gpio;/* Write Protect GPIO */ -}; - -struct davinci_mmc_plat -{struct mmc_config cfg;struct mmc mmc; };
@@ -484,9 +480,8 @@ int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host)static int davinci_mmc_probe (struct udevice *dev) {struct mmc_uclass_priv *upriv =dev_get_uclass_priv (dev); -struct davinci_mmc_plat *plat =dev_get_platdata (dev);struct davinci_mmc_priv *priv =dev_get_priv (dev); -struct mmc_config *cfg = &plat->cfg; +struct mmc_config *cfg = &priv->cfg; cfg->f_min =200000 ; cfg->f_max =25000000 ;
@@ -504,16 +499,16 @@ static int davinci_mmc_probe(struct udevice *dev)gpio_request_by_name (dev,"wp-gpios" ,0 , &priv->wp_gpio,GPIOD_IS_IN );#endif - upriv->mmc = &plat->mmc; + upriv->mmc = &priv->mmc;return davinci_dm_mmc_init (dev); }static int davinci_mmc_bind (struct udevice *dev) { -struct davinci_mmc_plat *plat =dev_get_platdata (dev); +struct davinci_mmc_priv *priv =dev_get_priv (dev); -return mmc_bind (dev, &plat->mmc, &plat->cfg); +return mmc_bind (dev, &priv->mmc, &priv->cfg); }static const struct udevice_id davinci_mmc_ids[] = {
@@ -530,7 +525,6 @@ U_BOOT_DRIVER(davinci_mmc_drv) = {#endif .probe = davinci_mmc_probe, .ops = &davinci_mmc_ops, - .platdata_auto_alloc_size = sizeof(struct davinci_mmc_plat), .priv_auto_alloc_size = sizeof(struct davinci_mmc_priv), };#endif
Signature · 1 line
2.23.0
PATCH 3/4 board: omapl138_lcdk: add the mmc device to SPL
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We don't have full device-tree support in SPL yet - add an appropriate U_BOOT_DEVICE() to the board file.
--- arch/arm/mach-davinci/Kconfig | 1 + board/davinci/da8xxevm/omapl138_lcdk.c | 9 +++++++++ 2 files changed, 10 insertions(+)
arch/arm/mach-davinci/Kconfig +1 -0
@@ -14,6 +14,7 @@ config TARGET_OMAPL138_LCDK bool "OMAPL138 LCDK" select SOC_DA8XX select SUPPORT_SPL + select SPL_BOARD_INIT config TARGET_LEGOEV3 bool "LEGO MINDSTORMS EV3"
board/davinci/da8xxevm/omapl138_lcdk.c +9 -0
@@ -366,4 +366,13 @@ U_BOOT_DEVICE(omapl138_uart) = { .name = "ns16550_serial", .platdata = &serial_pdata, }; + +U_BOOT_DEVICE (omapl138_mmc) = { + .name ="davinci_mmc" , +}; + +void spl_board_init (void ) +{ +davinci_configure_pin_mux (mmc0_pins,ARRAY_SIZE (mmc0_pins)); +}#endif
Signature · 1 line
2.23.0
PATCH 4/4 mmc: davinci: fix mmc boot in SPL
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
The MMC boot is currently broken on omapl138-lcdk after enabling the driver model in SPL. The main problem is the driver's bind callback not being called after probe in SPL (even with the DM_FLAG_PRE_RELOC flag specified).
While a proper fix is still being worked on, this hacky changeset at least fixes the MMC boot on this platform by calling mmc_bind() manually from probe().
--- drivers/mmc/davinci_mmc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/mmc/davinci_mmc.c +17 -0
@@ -482,6 +482,9 @@ static int davinci_mmc_probe(struct udevice *dev)struct mmc_uclass_priv *upriv =dev_get_uclass_priv (dev);struct davinci_mmc_priv *priv =dev_get_priv (dev);struct mmc_config *cfg = &priv->cfg; +#ifdef CONFIG_SPL_BUILD +int ret; +#endif cfg->f_min =200000 ; cfg->f_max =25000000 ;
@@ -501,6 +504,20 @@ static int davinci_mmc_probe(struct udevice *dev) upriv->mmc = &priv->mmc; +#ifdef CONFIG_SPL_BUILD +/* +* FIXME This is a temporary workaround to enable the driver model in +* SPL on omapl138-lcdk. For some reason the bind() callback is not +* being called in SPL for MMC which breaks the mmc boot - the hack +* is to call mmc_bind() from probe(). We also don't have full DT +* support in SPL, hence the hard-coded base register address. +*/ + priv->reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE ; + ret =mmc_bind (dev, &priv->mmc, &priv->cfg); +if (ret) +return ret; +#endif +return davinci_dm_mmc_init (dev); }
Signature · 1 line
2.23.0
cover omapl138_lcdk: fix MMC boot
In reply to Bartosz Golaszewskiczw., 14 lis 2019 o 16:10 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 27 lines
From: Bartosz Golaszewski <[email protected]>
Booting from MMC on omapl138-lcdk is currently broken after we enabled driver-model in SPL. While I know what's wrong - the
bind()callback not being called - I can't for the life of me figure out how to fix it.I'm still working on proper changes, but for now, I'd like to propose this series which fixes MMC boot with a workaround in which we call
mmc_boot()manually from probe.First two patches drop some legacy code that's no longer needed. The third patch adds a
U_BOOT_DEVICE()for mmc as we don't yet have full DT support (also in-progress). The last patch adds the workaround to the davinci mmc driver.This series depends on Adam Ford's patch increasing the pre-reloc malloc pool.
[1] https://patchwork.ozlabs.org/patch/1192574/
Bartosz Golaszewski (4):
mmc: davinci: drop support for ti,dm6441-mmc
mmc: davinci: drop structdavinci_mmc_plat
board:omapl138_lcdk: add the mmc device to SPL
mmc: davinci: fix mmc boot in SPL
Quoted 9 lines
arch/arm/mach-davinci/Kconfig | 1 + .../mach-davinci/include/mach/sdmmc_defs.h | 6 -- board/davinci/da8xxevm/omapl138_lcdk.c | 10 ++- drivers/mmc/davinci_mmc.c | 73 +++++++------------ 4 files changed, 36 insertions(+), 54 deletions(-)--
2.23.0
Gentle ping.
Bart
cover omapl138_lcdk: fix MMC boot
Quoted 35 lines · Bartosz Golaszewski
czw., 14 lis 2019 o 16:10 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 33 lines
From: Bartosz Golaszewski <[email protected]>
Booting from MMC on omapl138-lcdk is currently broken after we enabled driver-model in SPL. While I know what's wrong - the
bind()callback not being called - I can't for the life of me figure out how to fix it.I'm still working on proper changes, but for now, I'd like to propose this series which fixes MMC boot with a workaround in which we call
mmc_boot()manually from probe.First two patches drop some legacy code that's no longer needed. The third patch adds a
U_BOOT_DEVICE()for mmc as we don't yet have full DT support (also in-progress). The last patch adds the workaround to the davinci mmc driver.This series depends on Adam Ford's patch increasing the pre-reloc malloc pool.
[1] https://patchwork.ozlabs.org/patch/1192574/
Bartosz Golaszewski (4):
mmc: davinci: drop support for ti,dm6441-mmc
mmc: davinci: drop structdavinci_mmc_plat
board:omapl138_lcdk: add the mmc device to SPL
mmc: davinci: fix mmc boot in SPLarch/arm/mach-davinci/Kconfig | 1 + .../mach-davinci/include/mach/sdmmc_defs.h | 6 -- board/davinci/da8xxevm/omapl138_lcdk.c | 10 ++- drivers/mmc/davinci_mmc.c | 73 +++++++------------ 4 files changed, 36 insertions(+), 54 deletions(-)
Quoted 5 lines
Quoted 3 lines
--
2.23.0Gentle ping.
I wonder if having a 'fixes:' tag would help move things along.
adam
Quoted 2 lines
Bart
PATCH 1/4 mmc: davinci: drop support for ti, dm6441-mmc
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
The DM family of DaVinci SoCs is no longer supported. Drop the irrelevant code from the driver.
Signed-off-by Bartosz Golaszewski <[email protected]>
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: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/72714ed1/attachment.sig>
PATCH 2/4 mmc: davinci: drop struct davinci_mmc_plat
In reply to Bartosz GolaszewskiQuoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
struct
mmc_config& struct mmc don't need to be exported over platform data, but can instead be private in the driver.Remove struct
davinci_mmc_plat.Signed-off-by Bartosz Golaszewski <[email protected]>
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: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/50210d26/attachment.sig>
PATCH 3/4 board: omapl138_lcdk: add the mmc device to SPL
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
We don't have full device-tree support in SPL yet - add an appropriate
U_BOOT_DEVICE()to the board file.Signed-off-by Bartosz Golaszewski <[email protected]>
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: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/e413335a/attachment.sig>
PATCH 4/4 mmc: davinci: fix mmc boot in SPL
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
The MMC boot is currently broken on omapl138-lcdk after enabling the driver model in SPL. The main problem is the driver's bind callback not being called after probe in SPL (even with the
DM_FLAG_PRE_RELOCflag specified).
Quoted 5 lines
While a proper fix is still being worked on, this hacky changeset at least fixes the MMC boot on this platform by calling
mmc_bind()manually fromprobe().Signed-off-by Bartosz Golaszewski <[email protected]>
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: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/fe846305/attachment.sig>
PATCH 2/4 mmc: davinci: drop struct davinci_mmc_plat
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
struct
mmc_config& struct mmc don't need to be exported over platform data, but can instead be private in the driver.Remove struct
davinci_mmc_plat.
This patch appears to break the da850-evm.
With the pending release of 2020.01, is there any way we can revert before release and try to apply this going forward with more time to test?
As of now, the da850-evm cannot read/write from the MMC card from U-Boot which includes MMC booting.
adam
Quoted 63 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/mmc/davinci_mmc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/mmc/davinci_mmc.c +4
-11@@ -32,10 +32,6 @@ struct davinci_mmc_priv {uint input_clk;/* Input clock to MMC controller */ struct gpio_desc cd_gpio;/* Card Detect GPIO */ struct gpio_desc wp_gpio;/* Write Protect GPIO */ -}; - -struct davinci_mmc_plat -{struct mmc_config cfg;struct mmc mmc; };@@ -484,9 +480,8 @@ int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host)static int davinci_mmc_probe (struct udevice *dev) {struct mmc_uclass_priv *upriv =dev_get_uclass_priv (dev); -struct davinci_mmc_plat *plat =dev_get_platdata (dev);struct davinci_mmc_priv *priv =dev_get_priv (dev); -struct mmc_config *cfg = &plat->cfg; +struct mmc_config *cfg = &priv->cfg; cfg->f_min =200000 ; cfg->f_max =25000000 ;@@ -504,16 +499,16 @@ static int davinci_mmc_probe(struct udevice *dev)gpio_request_by_name (dev,"wp-gpios" ,0 , &priv->wp_gpio,GPIOD_IS_IN );#endif - upriv->mmc = &plat->mmc; + upriv->mmc = &priv->mmc;return davinci_dm_mmc_init (dev); }static int davinci_mmc_bind (struct udevice *dev) { -struct davinci_mmc_plat *plat =dev_get_platdata (dev); +struct davinci_mmc_priv *priv =dev_get_priv (dev); -return mmc_bind (dev, &plat->mmc, &plat->cfg); +return mmc_bind (dev, &priv->mmc, &priv->cfg); }static const struct udevice_id davinci_mmc_ids[] = {@@ -530,7 +525,6 @@ U_BOOT_DRIVER(davinci_mmc_drv) = {#endif .probe = davinci_mmc_probe, .ops = &davinci_mmc_ops, - .platdata_auto_alloc_size = sizeof(struct davinci_mmc_plat), .priv_auto_alloc_size = sizeof(struct davinci_mmc_priv), };#endif --2.23.0
PATCH 2/4 mmc: davinci: drop struct davinci_mmc_plat
pt., 3 sty 2020 o 17:01 Adam Ford <[email protected]> napisał(a):
Quoted 10 lines · Bartosz Golaszewski
Quoted 7 lines
From: Bartosz Golaszewski <[email protected]>
struct
mmc_config& struct mmc don't need to be exported over platform data, but can instead be private in the driver.Remove struct
davinci_mmc_plat.
Quoted 9 lines
This patch appears to break the da850-evm.
With the pending release of 2020.01, is there any way we can revert before release and try to apply this going forward with more time to test?
As of now, the da850-evm cannot read/write from the MMC card from U-Boot which includes MMC booting.
This is strange, this change doesn't seem to affect the logic.
This isn't revertible automatically anymore, due to other patches that came before and after. We can probably try to revert it manually.
Bart
PATCH 2/4 mmc: davinci: drop struct davinci_mmc_plat
Quoted 17 lines · Bartosz Golaszewski
pt., 3 sty 2020 o 17:01 Adam Ford <[email protected]> napisał(a):
Quoted 16 lines · Bartosz Golaszewski
Quoted 7 lines
From: Bartosz Golaszewski <[email protected]>
struct
mmc_config& struct mmc don't need to be exported over platform data, but can instead be private in the driver.Remove struct
davinci_mmc_plat.This patch appears to break the da850-evm.
With the pending release of 2020.01, is there any way we can revert before release and try to apply this going forward with more time to test?
Quoted 8 lines
Quoted 3 lines
As of now, the da850-evm cannot read/write from the MMC card from U-Boot which includes MMC booting.
This is strange, this change doesn't seem to affect the logic.
This isn't revertible automatically anymore, due to other patches that came before and after. We can probably try to revert it manually.
Doing a git revert and fixing up the one hunk that didn't go cleanly is easy, should I push that?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200103/216cd8b3/attachment.sig>
PATCH 2/4 mmc: davinci: drop struct davinci_mmc_plat
Quoted 23 lines · Tom Rini
Quoted 21 lines · Bartosz Golaszewski
pt., 3 sty 2020 o 17:01 Adam Ford <[email protected]> napisał(a):
Quoted 19 lines · Bartosz Golaszewski
Quoted 7 lines
From: Bartosz Golaszewski <[email protected]>
struct
mmc_config& struct mmc don't need to be exported over platform data, but can instead be private in the driver.Remove struct
davinci_mmc_plat.This patch appears to break the da850-evm.
With the pending release of 2020.01, is there any way we can revert before release and try to apply this going forward with more time to test?
As of now, the da850-evm cannot read/write from the MMC card from U-Boot which includes MMC booting.
Quoted 7 lines
Quoted 4 lines
This is strange, this change doesn't seem to affect the logic.
This isn't revertible automatically anymore, due to other patches that came before and after. We can probably try to revert it manually.
Doing a git revert and fixing up the one hunk that didn't go cleanly is easy, should I push that?
That would make me happy. :-) I don't know about Bartosz.
If you have a patch, I can quickly test it today.
adam
Quoted 3 lines
--
Tom