]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
mmc: dm: get the IO-line and main voltage regulators from the dts
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Thu, 21 Sep 2017 14:29:48 +0000 (16:29 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 12 Jan 2018 09:11:03 +0000 (18:11 +0900)
Get a reference to the regulator devices from the dts and store them
in the struct mmc for later use.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
drivers/mmc/mmc.c
include/mmc.h

index 8716ac7308f8b5c55cecef1699e507dbd3a4f627..73a46121d84e70d91614b095ef06562803d14ce4 100644 (file)
@@ -1618,21 +1618,25 @@ __weak void board_mmc_power_init(void)
 static int mmc_power_init(struct mmc *mmc)
 {
 #if CONFIG_IS_ENABLED(DM_MMC)
-#if defined(CONFIG_DM_REGULATOR) && !defined(CONFIG_SPL_BUILD)
-       struct udevice *vmmc_supply;
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
        int ret;
 
        ret = device_get_supply_regulator(mmc->dev, "vmmc-supply",
-                                         &vmmc_supply);
-       if (ret) {
+                                         &mmc->vmmc_supply);
+       if (ret)
                debug("%s: No vmmc supply\n", mmc->dev->name);
-               return 0;
-       }
 
-       ret = regulator_set_enable(vmmc_supply, true);
-       if (ret) {
-               puts("Error enabling VMMC supply\n");
-               return ret;
+       ret = device_get_supply_regulator(mmc->dev, "vqmmc-supply",
+                                         &mmc->vqmmc_supply);
+       if (ret)
+               debug("%s: No vqmmc supply\n", mmc->dev->name);
+
+       if (mmc->vmmc_supply) {
+               ret = regulator_set_enable(mmc->vmmc_supply, true);
+               if (ret) {
+                       puts("Error enabling VMMC supply\n");
+                       return ret;
+               }
        }
 #endif
 #else /* !CONFIG_DM_MMC */
index 010ebe048c45ffb68d3ffcb0614b9b243bddcbcc..188dc749dd722efd3300ed2dc057702baa7457a6 100644 (file)
@@ -457,6 +457,10 @@ struct mmc {
        int ddr_mode;
 #if CONFIG_IS_ENABLED(DM_MMC)
        struct udevice *dev;    /* Device for this MMC controller */
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
+       struct udevice *vmmc_supply;    /* Main voltage regulator (Vcc)*/
+       struct udevice *vqmmc_supply;   /* IO voltage regulator (Vccq)*/
+#endif
 #endif
 };