struct dw_mci_slot *slot = mmc_priv(mmc);
        const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
        u32 regs;
+       int ret;
 
        switch (ios->bus_width) {
        case MMC_BUS_WIDTH_4:
 
        switch (ios->power_mode) {
        case MMC_POWER_UP:
+               if (!IS_ERR(mmc->supply.vmmc)) {
+                       ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
+                                       ios->vdd);
+                       if (ret) {
+                               dev_err(slot->host->dev,
+                                       "failed to enable vmmc regulator\n");
+                               /*return, if failed turn on vmmc*/
+                               return;
+                       }
+               }
+               if (!IS_ERR(mmc->supply.vqmmc) && !slot->host->vqmmc_enabled) {
+                       ret = regulator_enable(mmc->supply.vqmmc);
+                       if (ret < 0)
+                               dev_err(slot->host->dev,
+                                       "failed to enable vqmmc regulator\n");
+                       else
+                               slot->host->vqmmc_enabled = true;
+               }
                set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
                regs = mci_readl(slot->host, PWREN);
                regs |= (1 << slot->id);
                mci_writel(slot->host, PWREN, regs);
                break;
        case MMC_POWER_OFF:
+               if (!IS_ERR(mmc->supply.vmmc))
+                       mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+
+               if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled) {
+                       regulator_disable(mmc->supply.vqmmc);
+                       slot->host->vqmmc_enabled = false;
+               }
+
                regs = mci_readl(slot->host, PWREN);
                regs &= ~(1 << slot->id);
                mci_writel(slot->host, PWREN, regs);
                mmc->f_max = freq[1];
        }
 
-       mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
+       /*if there are external regulators, get them*/
+       ret = mmc_regulator_get_supply(mmc);
+       if (ret == -EPROBE_DEFER)
+               goto err_setup_bus;
+
+       if (!mmc->ocr_avail)
+               mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
 
        if (host->pdata->caps)
                mmc->caps = host->pdata->caps;
 
 err_setup_bus:
        mmc_free_host(mmc);
-       return -EINVAL;
+       return ret;
 }
 
 static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id)
                }
        }
 
-       host->vmmc = devm_regulator_get_optional(host->dev, "vmmc");
-       if (IS_ERR(host->vmmc)) {
-               ret = PTR_ERR(host->vmmc);
-               if (ret == -EPROBE_DEFER)
-                       goto err_clk_ciu;
-
-               dev_info(host->dev, "no vmmc regulator found: %d\n", ret);
-               host->vmmc = NULL;
-       } else {
-               ret = regulator_enable(host->vmmc);
-               if (ret) {
-                       if (ret != -EPROBE_DEFER)
-                               dev_err(host->dev,
-                                       "regulator_enable fail: %d\n", ret);
-                       goto err_clk_ciu;
-               }
-       }
-
        host->quirks = host->pdata->quirks;
 
        spin_lock_init(&host->lock);
 err_dmaunmap:
        if (host->use_dma && host->dma_ops->exit)
                host->dma_ops->exit(host);
-       if (host->vmmc)
-               regulator_disable(host->vmmc);
 
 err_clk_ciu:
        if (!IS_ERR(host->ciu_clk))
        if (host->use_dma && host->dma_ops->exit)
                host->dma_ops->exit(host);
 
-       if (host->vmmc)
-               regulator_disable(host->vmmc);
-
        if (!IS_ERR(host->ciu_clk))
                clk_disable_unprepare(host->ciu_clk);
 
  */
 int dw_mci_suspend(struct dw_mci *host)
 {
-       if (host->vmmc)
-               regulator_disable(host->vmmc);
-
        return 0;
 }
 EXPORT_SYMBOL(dw_mci_suspend);
 {
        int i, ret;
 
-       if (host->vmmc) {
-               ret = regulator_enable(host->vmmc);
-               if (ret) {
-                       dev_err(host->dev,
-                               "failed to enable regulator: %d\n", ret);
-                       return ret;
-               }
-       }
-
        if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) {
                ret = -ENODEV;
                return ret;