aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/mmci.c54
-rw-r--r--drivers/mmc/host/mmci.h1
2 files changed, 11 insertions, 44 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 442b01129626..3094ea3ed722 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1093,7 +1093,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1093 struct variant_data *variant = host->variant; 1093 struct variant_data *variant = host->variant;
1094 u32 pwr = 0; 1094 u32 pwr = 0;
1095 unsigned long flags; 1095 unsigned long flags;
1096 int ret;
1097 1096
1098 pm_runtime_get_sync(mmc_dev(mmc)); 1097 pm_runtime_get_sync(mmc_dev(mmc));
1099 1098
@@ -1103,23 +1102,13 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1103 1102
1104 switch (ios->power_mode) { 1103 switch (ios->power_mode) {
1105 case MMC_POWER_OFF: 1104 case MMC_POWER_OFF:
1106 if (host->vcc) 1105 if (!IS_ERR(mmc->supply.vmmc))
1107 ret = mmc_regulator_set_ocr(mmc, host->vcc, 0); 1106 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
1108 break; 1107 break;
1109 case MMC_POWER_UP: 1108 case MMC_POWER_UP:
1110 if (host->vcc) { 1109 if (!IS_ERR(mmc->supply.vmmc))
1111 ret = mmc_regulator_set_ocr(mmc, host->vcc, ios->vdd); 1110 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
1112 if (ret) { 1111
1113 dev_err(mmc_dev(mmc), "unable to set OCR\n");
1114 /*
1115 * The .set_ios() function in the mmc_host_ops
1116 * struct return void, and failing to set the
1117 * power should be rare so we print an error
1118 * and return here.
1119 */
1120 goto out;
1121 }
1122 }
1123 /* 1112 /*
1124 * The ST Micro variant doesn't have the PL180s MCI_PWR_UP 1113 * The ST Micro variant doesn't have the PL180s MCI_PWR_UP
1125 * and instead uses MCI_PWR_ON so apply whatever value is 1114 * and instead uses MCI_PWR_ON so apply whatever value is
@@ -1168,7 +1157,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1168 1157
1169 spin_unlock_irqrestore(&host->lock, flags); 1158 spin_unlock_irqrestore(&host->lock, flags);
1170 1159
1171 out:
1172 pm_runtime_mark_last_busy(mmc_dev(mmc)); 1160 pm_runtime_mark_last_busy(mmc_dev(mmc));
1173 pm_runtime_put_autosuspend(mmc_dev(mmc)); 1161 pm_runtime_put_autosuspend(mmc_dev(mmc));
1174} 1162}
@@ -1391,29 +1379,13 @@ static int mmci_probe(struct amba_device *dev,
1391 } else 1379 } else
1392 dev_warn(&dev->dev, "could not get default pinstate\n"); 1380 dev_warn(&dev->dev, "could not get default pinstate\n");
1393 1381
1394#ifdef CONFIG_REGULATOR 1382 /* Get regulators and the supported OCR mask */
1395 /* If we're using the regulator framework, try to fetch a regulator */ 1383 mmc_regulator_get_supply(mmc);
1396 host->vcc = regulator_get(&dev->dev, "vmmc"); 1384 if (!mmc->ocr_avail)
1397 if (IS_ERR(host->vcc))
1398 host->vcc = NULL;
1399 else {
1400 int mask = mmc_regulator_get_ocrmask(host->vcc);
1401
1402 if (mask < 0)
1403 dev_err(&dev->dev, "error getting OCR mask (%d)\n",
1404 mask);
1405 else {
1406 host->mmc->ocr_avail = (u32) mask;
1407 if (plat->ocr_mask)
1408 dev_warn(&dev->dev,
1409 "Provided ocr_mask/setpower will not be used "
1410 "(using regulator instead)\n");
1411 }
1412 }
1413#endif
1414 /* Fall back to platform data if no regulator is found */
1415 if (host->vcc == NULL)
1416 mmc->ocr_avail = plat->ocr_mask; 1385 mmc->ocr_avail = plat->ocr_mask;
1386 else if (plat->ocr_mask)
1387 dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n");
1388
1417 mmc->caps = plat->capabilities; 1389 mmc->caps = plat->capabilities;
1418 mmc->caps2 = plat->capabilities2; 1390 mmc->caps2 = plat->capabilities2;
1419 1391
@@ -1595,10 +1567,6 @@ static int mmci_remove(struct amba_device *dev)
1595 clk_disable_unprepare(host->clk); 1567 clk_disable_unprepare(host->clk);
1596 clk_put(host->clk); 1568 clk_put(host->clk);
1597 1569
1598 if (host->vcc)
1599 mmc_regulator_set_ocr(mmc, host->vcc, 0);
1600 regulator_put(host->vcc);
1601
1602 mmc_free_host(mmc); 1570 mmc_free_host(mmc);
1603 1571
1604 amba_release_regions(dev); 1572 amba_release_regions(dev);
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index d34d8c0add8e..a22213eeff88 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -193,7 +193,6 @@ struct mmci_host {
193 /* pio stuff */ 193 /* pio stuff */
194 struct sg_mapping_iter sg_miter; 194 struct sg_mapping_iter sg_miter;
195 unsigned int size; 195 unsigned int size;
196 struct regulator *vcc;
197 196
198 /* pinctrl handles */ 197 /* pinctrl handles */
199 struct pinctrl *pinctrl; 198 struct pinctrl *pinctrl;