@@ -517,6 +517,27 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
else
host->bus_width = 0;
+ if (host->mmc->supply.vmmc &&
+ ios->power_mode != host->mmc->ios.power_mode) {
+ switch (ios->power_mode) {
+ case MMC_POWER_OFF:
+ if (mmc_regulator_set_ocr(host->mmc,
+ host->mmc->supply.vmmc, 0))
+ dev_err(mmc_dev(host->mmc),
+ "Failed to disable vmmc regulator\n");
+ break;
+ case MMC_POWER_UP:
+ if (mmc_regulator_set_ocr(host->mmc,
+ host->mmc->supply.vmmc,
+ ios->vdd))
+ dev_err(mmc_dev(host->mmc),
+ "Failed to enable vmmc regulator\n");
+ break;
+ default:
+ break;
+ }
+ }
+
if (ios->clock)
mxs_ssp_set_clk_rate(&host->ssp, ios->clock);
}
@@ -588,7 +609,6 @@ static int mxs_mmc_probe(struct platform_device *pdev)
struct mmc_host *mmc;
struct resource *iores;
int ret = 0, irq_err;
- struct regulator *reg_vmmc;
struct mxs_ssp *ssp;
irq_err = platform_get_irq(pdev, 0);
@@ -614,15 +634,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
host->mmc = mmc;
host->sdio_irq_en = 0;
- reg_vmmc = devm_regulator_get(&pdev->dev, "vmmc");
- if (!IS_ERR(reg_vmmc)) {
- ret = regulator_enable(reg_vmmc);
- if (ret) {
- dev_err(&pdev->dev,
- "Failed to enable vmmc regulator: %d\n", ret);
- goto out_mmc_free;
- }
- }
+ ret = mmc_regulator_get_supply(mmc);
+ if (ret)
+ goto out_mmc_free;
ssp->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(ssp->clk)) {