Commit 24fbb3ca authored by Russell King's avatar Russell King Committed by Chris Ball

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Tested-by: default avatarMarkus Pargmann <mpa@pengutronix.de>
Tested-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent e921a8b6
...@@ -1216,12 +1216,13 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -1216,12 +1216,13 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
} }
EXPORT_SYMBOL_GPL(sdhci_set_clock); 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; u8 pwr = 0;
if (power != (unsigned short)-1) { if (mode != MMC_POWER_OFF) {
switch (1 << power) { switch (1 << vdd) {
case MMC_VDD_165_195: case MMC_VDD_165_195:
pwr = SDHCI_POWER_180; pwr = SDHCI_POWER_180;
break; break;
...@@ -1247,7 +1248,7 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power) ...@@ -1247,7 +1248,7 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON) if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON)
sdhci_runtime_pm_bus_off(host); sdhci_runtime_pm_bus_off(host);
power = 0; vdd = 0;
} else { } else {
/* /*
* Spec says that we should clear the power reg before setting * 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) ...@@ -1281,7 +1282,7 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power)
if (host->vmmc) { if (host->vmmc) {
spin_unlock_irq(&host->lock); 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); spin_lock_irq(&host->lock);
} }
} }
...@@ -1464,10 +1465,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) ...@@ -1464,10 +1465,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
host->clock = ios->clock; host->clock = ios->clock;
} }
if (ios->power_mode == MMC_POWER_OFF) sdhci_set_power(host, ios->power_mode, ios->vdd);
sdhci_set_power(host, -1);
else
sdhci_set_power(host, ios->vdd);
if (host->ops->platform_send_init_74_clocks) if (host->ops->platform_send_init_74_clocks)
host->ops->platform_send_init_74_clocks(host, ios->power_mode); host->ops->platform_send_init_74_clocks(host, ios->power_mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment