aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-04-25 13:00:06 +0100
committerChris Ball <chris@printf.net>2014-05-22 08:33:30 -0400
commit24fbb3ca1468861e5ac33a26c4130610ae8d0e20 (patch)
treef3349df881624d5ed6c430ecb0a114851bc33f23 /drivers/mmc
parentmmc: sdhci: move regulator handling into sdhci_set_power() (diff)
downloadlinux-dev-24fbb3ca1468861e5ac33a26c4130610ae8d0e20.tar.xz
linux-dev-24fbb3ca1468861e5ac33a26c4130610ae8d0e20.zip
mmc: sdhci: move remaining power handling into sdhci_set_power()
Move the remaining parts of the power handling in sdhci_do_set_ios() into sdhci_set_power(). Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Markus Pargmann <mpa@pengutronix.de> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 2724e6fe6ca9..effd9e5d1d81 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1216,12 +1216,13 @@ clock_set:
}
EXPORT_SYMBOL_GPL(sdhci_set_clock);
-static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
+static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
+ unsigned short vdd)
{
u8 pwr = 0;
- if (power != (unsigned short)-1) {
- switch (1 << power) {
+ if (mode != MMC_POWER_OFF) {
+ switch (1 << vdd) {
case MMC_VDD_165_195:
pwr = SDHCI_POWER_180;
break;
@@ -1247,7 +1248,7 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON)
sdhci_runtime_pm_bus_off(host);
- power = 0;
+ vdd = 0;
} else {
/*
* Spec says that we should clear the power reg before setting
@@ -1281,7 +1282,7 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
if (host->vmmc) {
spin_unlock_irq(&host->lock);
- mmc_regulator_set_ocr(host->mmc, host->vmmc, power);
+ mmc_regulator_set_ocr(host->mmc, host->vmmc, vdd);
spin_lock_irq(&host->lock);
}
}
@@ -1464,10 +1465,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
host->clock = ios->clock;
}
- if (ios->power_mode == MMC_POWER_OFF)
- sdhci_set_power(host, -1);
- else
- sdhci_set_power(host, ios->vdd);
+ sdhci_set_power(host, ios->power_mode, ios->vdd);
if (host->ops->platform_send_init_74_clocks)
host->ops->platform_send_init_74_clocks(host, ios->power_mode);