]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
mmc: uniphier-sd: Add vqmmc regulator support
authorMarek Vasut <marek.vasut@gmail.com>
Fri, 15 Sep 2017 19:10:54 +0000 (21:10 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 29 Sep 2017 02:17:29 +0000 (11:17 +0900)
Add initial support for setting the vqmmc regulator. Since we do not
support 1V8 modes, set the regulator to 3V3 and enable it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/mmc/uniphier-sd.c

index 3c521610676656d55be7ae9c6c2e5686f1070cb2..0d1203cb766ff0c045fc8e4857afe3e4ba60daf7 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/dma-direction.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
+#include <power/regulator.h>
 #include <asm/unaligned.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -756,6 +757,9 @@ static int uniphier_sd_probe(struct udevice *dev)
        fdt_addr_t base;
        struct clk clk;
        int ret;
+#ifdef CONFIG_DM_REGULATOR
+       struct udevice *vqmmc_dev;
+#endif
 
        base = devfdt_get_addr(dev);
        if (base == FDT_ADDR_T_NONE)
@@ -765,6 +769,15 @@ static int uniphier_sd_probe(struct udevice *dev)
        if (!priv->regbase)
                return -ENOMEM;
 
+#ifdef CONFIG_DM_REGULATOR
+       ret = device_get_supply_regulator(dev, "vqmmc-supply", &vqmmc_dev);
+       if (!ret) {
+               /* Set the regulator to 3.3V until we support 1.8V modes */
+               regulator_set_value(vqmmc_dev, 3300000);
+               regulator_set_enable(vqmmc_dev, true);
+       }
+#endif
+
        ret = clk_get_by_index(dev, 0, &clk);
        if (ret < 0) {
                dev_err(dev, "failed to get host clock\n");