aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap_hsmmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 781e4db31767..7fb0753abe30 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -182,6 +182,7 @@ struct omap_hsmmc_host {
182 struct clk *fclk; 182 struct clk *fclk;
183 struct clk *dbclk; 183 struct clk *dbclk;
184 struct regulator *pbias; 184 struct regulator *pbias;
185 bool pbias_enabled;
185 void __iomem *base; 186 void __iomem *base;
186 int vqmmc_enabled; 187 int vqmmc_enabled;
187 resource_size_t mapbase; 188 resource_size_t mapbase;
@@ -328,20 +329,22 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
328 return ret; 329 return ret;
329 } 330 }
330 331
331 if (!regulator_is_enabled(host->pbias)) { 332 if (host->pbias_enabled == 0) {
332 ret = regulator_enable(host->pbias); 333 ret = regulator_enable(host->pbias);
333 if (ret) { 334 if (ret) {
334 dev_err(host->dev, "pbias reg enable fail\n"); 335 dev_err(host->dev, "pbias reg enable fail\n");
335 return ret; 336 return ret;
336 } 337 }
338 host->pbias_enabled = 1;
337 } 339 }
338 } else { 340 } else {
339 if (regulator_is_enabled(host->pbias)) { 341 if (host->pbias_enabled == 1) {
340 ret = regulator_disable(host->pbias); 342 ret = regulator_disable(host->pbias);
341 if (ret) { 343 if (ret) {
342 dev_err(host->dev, "pbias reg disable fail\n"); 344 dev_err(host->dev, "pbias reg disable fail\n");
343 return ret; 345 return ret;
344 } 346 }
347 host->pbias_enabled = 0;
345 } 348 }
346 } 349 }
347 350
@@ -475,7 +478,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
475 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); 478 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc");
476 if (IS_ERR(mmc->supply.vmmc)) { 479 if (IS_ERR(mmc->supply.vmmc)) {
477 ret = PTR_ERR(mmc->supply.vmmc); 480 ret = PTR_ERR(mmc->supply.vmmc);
478 if (ret != -ENODEV) 481 if ((ret != -ENODEV) && host->dev->of_node)
479 return ret; 482 return ret;
480 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", 483 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
481 PTR_ERR(mmc->supply.vmmc)); 484 PTR_ERR(mmc->supply.vmmc));
@@ -490,7 +493,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
490 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); 493 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux");
491 if (IS_ERR(mmc->supply.vqmmc)) { 494 if (IS_ERR(mmc->supply.vqmmc)) {
492 ret = PTR_ERR(mmc->supply.vqmmc); 495 ret = PTR_ERR(mmc->supply.vqmmc);
493 if (ret != -ENODEV) 496 if ((ret != -ENODEV) && host->dev->of_node)
494 return ret; 497 return ret;
495 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", 498 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
496 PTR_ERR(mmc->supply.vqmmc)); 499 PTR_ERR(mmc->supply.vqmmc));
@@ -500,7 +503,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
500 host->pbias = devm_regulator_get_optional(host->dev, "pbias"); 503 host->pbias = devm_regulator_get_optional(host->dev, "pbias");
501 if (IS_ERR(host->pbias)) { 504 if (IS_ERR(host->pbias)) {
502 ret = PTR_ERR(host->pbias); 505 ret = PTR_ERR(host->pbias);
503 if (ret != -ENODEV) 506 if ((ret != -ENODEV) && host->dev->of_node)
504 return ret; 507 return ret;
505 dev_dbg(host->dev, "unable to get pbias regulator %ld\n", 508 dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
506 PTR_ERR(host->pbias)); 509 PTR_ERR(host->pbias));
@@ -2053,6 +2056,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2053 host->base = base + pdata->reg_offset; 2056 host->base = base + pdata->reg_offset;
2054 host->power_mode = MMC_POWER_OFF; 2057 host->power_mode = MMC_POWER_OFF;
2055 host->next_data.cookie = 1; 2058 host->next_data.cookie = 1;
2059 host->pbias_enabled = 0;
2056 host->vqmmc_enabled = 0; 2060 host->vqmmc_enabled = 0;
2057 2061
2058 ret = omap_hsmmc_gpio_init(mmc, host, pdata); 2062 ret = omap_hsmmc_gpio_init(mmc, host, pdata);