summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@amd.com>2012-01-04 10:07:43 +0800
committerRyan Wong <ryanw@nvidia.com>2012-06-12 12:06:00 -0700
commit81ede5c36de2e81867fca7a57b8834735b2bd960 (patch)
treedce0bb3cc48ced7d4e6678f921465c099c46dc64
parent713f9aa4a7b9fa61610730be2b8dc15319f7ed1b (diff)
mmc: sdhci: Deal with failure case in sdhci_suspend_host
If there are errors happened in sdhci_suspend_host, handle it so that when the function returns with an error, the host's behaviour is the same before this function call, e.g. card detection is enabled and tuning timer is active, etc. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Aaron Lu <aaron.lu@amd.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org> (cherry picked from commit 38a60ea2e7b33ab33ee11d6ef527f259edb102cf) Bug 984811 Change-Id: I602c83523b2b49ac73b8072ac29ec5a2c4cf7b0b Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com> Reviewed-on: http://git-master/r/107532 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
-rw-r--r--drivers/mmc/host/sdhci.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 495586924d60..22814660bc34 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2330,20 +2330,34 @@ out:
int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
{
int ret = 0;
+ bool has_tuning_timer;
struct mmc_host *mmc = host->mmc;
sdhci_disable_card_detection(host);
/* Disable tuning since we are suspending */
- if (host->version >= SDHCI_SPEC_300 && host->tuning_count &&
- host->tuning_mode == SDHCI_TUNING_MODE_1) {
+ has_tuning_timer = host->version >= SDHCI_SPEC_300 &&
+ host->tuning_count && host->tuning_mode == SDHCI_TUNING_MODE_1;
+ if (has_tuning_timer) {
host->flags &= ~SDHCI_NEEDS_RETUNING;
mod_timer(&host->tuning_timer, jiffies +
host->tuning_count * HZ);
}
- if (mmc->card)
+ if (mmc->card) {
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 (mmc->pm_flags & MMC_PM_KEEP_POWER)
host->card_int_set = sdhci_readl(host, SDHCI_INT_ENABLE) &