Skip to contentSkip to conversation

dm: mmc: Don't call board_mmc_power_init() with driver model

PATCH New Simon Glass 3 participants 3 messages Apr 23, 2017 – May 18, 2017 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: mmc: Don't call board_mmc_power_init() with driver model

We should not call out to board code from drivers. With driver model, mmc_power_init() already has code to use a named regulator, but the legacy code path remains. Update the code to make this clear.

---

 drivers/mmc/mmc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/mmc/mmc.c +11 -4
index 72fc17716e..3cdf6a4f3b 100644
@@ -1608,17 +1608,17 @@ static int mmc_send_if_cond(struct mmc *mmc)
 	return 0;
 }
 
+#ifndef CONFIG_DM_MMC
 /* board-specific MMC power initializations. */
 __weak void board_mmc_power_init(void)
 {
 }
+#endif
 
 static int mmc_power_init(struct mmc *mmc)
 {
-	board_mmc_power_init();
-
-#if defined(CONFIG_DM_MMC) && defined(CONFIG_DM_REGULATOR) && \
-	!defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_DM_MMC)
+#if defined(CONFIG_DM_REGULATOR) && !defined(CONFIG_SPL_BUILD)
 	struct udevice *vmmc_supply;
 	int ret;
 
@@ -1635,6 +1635,13 @@ static int mmc_power_init(struct mmc *mmc)
 		return ret;
 	}
 #endif
+#else /* !CONFIG_DM_MMC */
+	/*
+	 * Driver model should use a regulator, as above, rather than calling
+	 * out to board code.
+	 */
+	board_mmc_power_init();
+#endif
 	return 0;
 }
 
Signature · 1 line
2.12.2.816.g2cccc81164-goog
#1 lore raw

PATCH 1/1 dm: mmc: Don't call board_mmc_power_init() with driver model

Quoted 4 lines · Simon Glass

We should not call out to board code from drivers. With driver model, mmc_power_init() already has code to use a named regulator, but the legacy code path remains. Update the code to make this clear.

I don't like this patch as it described. (I will answer to your mail in the other thread later)
Let me check more, possible it's okay to have.

Quoted 53 lines

---

 drivers/mmc/mmc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/mmc/mmc.c +11 -5
index 72fc17716e..3cdf6a4f3b 100644
@@ -1608,17 +1608,17 @@ static int mmc_send_if_cond(struct mmc *mmc)
        return 0;
 }
 
+#ifndef CONFIG_DM_MMC
 /* board-specific MMC power initializations. */
 __weak void board_mmc_power_init(void)
 {
 }
+#endif
 
 static int mmc_power_init(struct mmc *mmc)
 {
-       board_mmc_power_init();
-
-#if defined(CONFIG_DM_MMC) && defined(CONFIG_DM_REGULATOR) && \
-       !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_DM_MMC)
+#if defined(CONFIG_DM_REGULATOR) && !defined(CONFIG_SPL_BUILD)
        struct udevice *vmmc_supply;
        int ret;
 
@@ -1635,6 +1635,13 @@ static int mmc_power_init(struct mmc *mmc)
                return ret;
        }
 #endif
+#else /* !CONFIG_DM_MMC */
+       /*
+        * Driver model should use a regulator, as above, rather than calling
+        * out to board code.
+        */
+       board_mmc_power_init();
+#endif
        return 0;
 }
 
--

2.12.2.816.g2cccc81164-goog

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

PATCH 1/1 dm: mmc: Don't call board_mmc_power_init() with driver model

Quoted 4 lines · Simon Glass

We should not call out to board code from drivers. With driver model, mmc_power_init() already has code to use a named regulator, but the legacy code path remains. Update the code to make this clear.

I don't like this patch as it described. (I will answer to your mail in the other thread later)
Let me check more, possible it's okay to have.

Quoted 6 lines

---

 drivers/mmc/mmc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Applied to u-boot-dm