aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-07-12 09:53:36 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-07-25 04:35:00 -0400
commitefba142bcd980e08ed5e2b98b23b103697d9aa6c (patch)
tree616acff765b1aaf8e2e3a53ff8f861763e780f0e /drivers/mmc/host/sdhci.c
parent1f64cec2b69544899773d88ae7039760e0a3714b (diff)
mmc: sdhci: Request regulators before reading capabilities
The capabilities of the SDHCI host controller are read early during the SDHCI host initialisation in sdhci_setup_host() and before any regulators for the host have been requested. This means that if the host supports some high-speed modes (according to its capabilities register), but the board cannot because the appropriate voltage regulator is not available, then the host cannot easily override the capabilities that are supported. To allow a SDHCI host controller to determine if it can support UHS high speed modes via the presence of the MMC regulators, request the regulators before reading the capabilities of the host controller. This will allow the SDHCI host to use the 'reset' callback to take the appropriate action (set flags, configure registers, etc) before the capabilities register(s) are read. Please note that some SDHCI hosts, such as the Tegra SDHCI host, has the ability to mask bits in the capabilities register to prevent certain capabilities from being advertised. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 31c14b0ff8e2..cd65d474afa2 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3027,6 +3027,16 @@ int sdhci_setup_host(struct sdhci_host *host)
3027 3027
3028 mmc = host->mmc; 3028 mmc = host->mmc;
3029 3029
3030 /*
3031 * If there are external regulators, get them. Note this must be done
3032 * early before resetting the host and reading the capabilities so that
3033 * the host can take the appropriate action if regulators are not
3034 * available.
3035 */
3036 ret = mmc_regulator_get_supply(mmc);
3037 if (ret == -EPROBE_DEFER)
3038 return ret;
3039
3030 sdhci_read_caps(host); 3040 sdhci_read_caps(host);
3031 3041
3032 override_timeout_clk = host->timeout_clk; 3042 override_timeout_clk = host->timeout_clk;
@@ -3259,11 +3269,6 @@ int sdhci_setup_host(struct sdhci_host *host)
3259 mmc_gpio_get_cd(host->mmc) < 0) 3269 mmc_gpio_get_cd(host->mmc) < 0)
3260 mmc->caps |= MMC_CAP_NEEDS_POLL; 3270 mmc->caps |= MMC_CAP_NEEDS_POLL;
3261 3271
3262 /* If there are external regulators, get them */
3263 ret = mmc_regulator_get_supply(mmc);
3264 if (ret == -EPROBE_DEFER)
3265 goto undma;
3266
3267 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */ 3272 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
3268 if (!IS_ERR(mmc->supply.vqmmc)) { 3273 if (!IS_ERR(mmc->supply.vqmmc)) {
3269 ret = regulator_enable(mmc->supply.vqmmc); 3274 ret = regulator_enable(mmc->supply.vqmmc);