Re: [U-Boot] [PATCH 4/4] mmc: davinci: fix mmc boot in SPL

2019-12-03 Thread Tom Rini
On Thu, Nov 14, 2019 at 04:10:31PM +0100, Bartosz Golaszewski wrote:

> From: Bartosz Golaszewski 
> 
> 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().
> 
> Signed-off-by: Bartosz Golaszewski 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[U-Boot] [PATCH 4/4] mmc: davinci: fix mmc boot in SPL

2019-11-14 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

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

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mmc/davinci_mmc.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index a27a039f9b..c3f7b57665 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -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 = >cfg;
+#ifdef CONFIG_SPL_BUILD
+   int ret;
+#endif
 
cfg->f_min = 20;
cfg->f_max = 2500;
@@ -501,6 +504,20 @@ static int davinci_mmc_probe(struct udevice *dev)
 
upriv->mmc = >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, >mmc, >cfg);
+   if (ret)
+   return ret;
+#endif
+
return davinci_dm_mmc_init(dev);
 }
 
-- 
2.23.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot