summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/sdhci.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7c6ff939a823..5b0e1196dd97 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1852,7 +1852,6 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable)
int sdhci_enable(struct mmc_host *mmc)
{
struct sdhci_host *host = mmc_priv(mmc);
- u16 clk;
if (!mmc->card || mmc->card->type == MMC_TYPE_SDIO)
return 0;
@@ -1869,7 +1868,6 @@ int sdhci_enable(struct mmc_host *mmc)
int sdhci_disable(struct mmc_host *mmc, int lazy)
{
struct sdhci_host *host = mmc_priv(mmc);
- u16 clk;
if (!mmc->card || mmc->card->type == MMC_TYPE_SDIO)
return 0;
@@ -2339,27 +2337,9 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
}
if (mmc->card) {
- /*
- * If eMMC cards are put in sleep state, Vccq can be disabled
- * but Vcc would still be powered on. In resume, we only restore
- * the controller context. So, set MMC_PM_KEEP_POWER flag.
- */
- if (mmc_card_can_sleep(mmc) &&
- !(mmc->caps & MMC_CAP2_NO_SLEEP_CMD))
- mmc->pm_flags = MMC_PM_KEEP_POWER;
-
ret = mmc_suspend_host(host->mmc);
- if (ret) {
- if (has_tuning_timer) {
- host->flags |= SDHCI_NEEDS_RETUNING;
- mod_timer(&host->tuning_timer, jiffies +
- host->tuning_count * HZ);
- }
-
- sdhci_enable_card_detection(host);
-
- return ret;
- }
+ if (ret)
+ goto err_suspend_host;
}
if (mmc->pm_flags & MMC_PM_KEEP_POWER)
@@ -2368,12 +2348,25 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
- if (host->vmmc)
+ if (host->vmmc) {
ret = regulator_disable(host->vmmc);
+ if (ret)
+ pr_err("%s: failed to disable regulator\n", __func__);
+ }
if (host->irq)
disable_irq(host->irq);
+ return 0;
+
+err_suspend_host:
+ /* Set the re-tuning expiration flag */
+ if ((host->version >= SDHCI_SPEC_300) && host->tuning_count &&
+ (host->tuning_mode == SDHCI_TUNING_MODE_1))
+ host->flags |= SDHCI_NEEDS_RETUNING;
+
+ sdhci_enable_card_detection(host);
+
return ret;
}