diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2017-06-07 04:36:11 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-06-20 04:30:41 -0400 |
commit | 13ab2a66d862e00f55ae0ba46e61117c50dbdb17 (patch) | |
tree | b018ea18f2bb84518005a4fcf5c5451313618abe | |
parent | 86d79da0aadde60e4f84fe8cf7a75d4db2a79968 (diff) |
mmc: host: omap_hsmmc: use mmc_regulator_get_supply() to get regulators
In preparation for using the generic mmc binding for io regulator
("vqmmc"), use mmc_regulator_get_supply() to get vmmc and vqmmc regulators.
Only if "vqmmc" regulator isn't found, fallback to use "vmmc_aux"
regulator.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index de82ac0a87e2..7c12f3715676 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -466,34 +466,27 @@ static int omap_hsmmc_disable_boot_regulators(struct omap_hsmmc_host *host) | |||
466 | 466 | ||
467 | static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) | 467 | static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) |
468 | { | 468 | { |
469 | int ocr_value = 0; | ||
470 | int ret; | 469 | int ret; |
471 | struct mmc_host *mmc = host->mmc; | 470 | struct mmc_host *mmc = host->mmc; |
472 | 471 | ||
473 | if (mmc_pdata(host)->set_power) | 472 | if (mmc_pdata(host)->set_power) |
474 | return 0; | 473 | return 0; |
475 | 474 | ||
476 | mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); | 475 | ret = mmc_regulator_get_supply(mmc); |
477 | if (IS_ERR(mmc->supply.vmmc)) { | 476 | if (ret == -EPROBE_DEFER) |
478 | ret = PTR_ERR(mmc->supply.vmmc); | 477 | return ret; |
479 | if ((ret != -ENODEV) && host->dev->of_node) | ||
480 | return ret; | ||
481 | dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", | ||
482 | PTR_ERR(mmc->supply.vmmc)); | ||
483 | } else { | ||
484 | ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc); | ||
485 | if (ocr_value > 0) | ||
486 | mmc_pdata(host)->ocr_mask = ocr_value; | ||
487 | } | ||
488 | 478 | ||
489 | /* Allow an aux regulator */ | 479 | /* Allow an aux regulator */ |
490 | mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); | ||
491 | if (IS_ERR(mmc->supply.vqmmc)) { | 480 | if (IS_ERR(mmc->supply.vqmmc)) { |
492 | ret = PTR_ERR(mmc->supply.vqmmc); | 481 | mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, |
493 | if ((ret != -ENODEV) && host->dev->of_node) | 482 | "vmmc_aux"); |
494 | return ret; | 483 | if (IS_ERR(mmc->supply.vqmmc)) { |
495 | dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", | 484 | ret = PTR_ERR(mmc->supply.vqmmc); |
496 | PTR_ERR(mmc->supply.vqmmc)); | 485 | if ((ret != -ENODEV) && host->dev->of_node) |
486 | return ret; | ||
487 | dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", | ||
488 | PTR_ERR(mmc->supply.vqmmc)); | ||
489 | } | ||
497 | } | 490 | } |
498 | 491 | ||
499 | host->pbias = devm_regulator_get_optional(host->dev, "pbias"); | 492 | host->pbias = devm_regulator_get_optional(host->dev, "pbias"); |
@@ -2143,7 +2136,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev) | |||
2143 | if (ret) | 2136 | if (ret) |
2144 | goto err_irq; | 2137 | goto err_irq; |
2145 | 2138 | ||
2146 | mmc->ocr_avail = mmc_pdata(host)->ocr_mask; | 2139 | if (!mmc->ocr_avail) |
2140 | mmc->ocr_avail = mmc_pdata(host)->ocr_mask; | ||
2147 | 2141 | ||
2148 | omap_hsmmc_disable_irq(host); | 2142 | omap_hsmmc_disable_irq(host); |
2149 | 2143 | ||