aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSan Mehat <san@android.com>2008-12-01 08:52:34 -0800
committerColin Cross <ccross@android.com>2014-03-19 13:07:18 -0700
commitb0c5c06400af391f7c56dc773e71c771346a167b (patch)
tree64b6a41e6da1459d537507b0d4d6c46bf41f50d1 /drivers/mmc
parentec3730bc563c33e6f326c8497876a855b3cfe8b5 (diff)
mmc: sd: When resuming, try a little harder to init the card
Signed-off-by: San Mehat <san@android.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/sd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 2c3020c03fb..cb12ec11b6d 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1145,6 +1145,9 @@ static int mmc_sd_suspend(struct mmc_host *host)
static int _mmc_sd_resume(struct mmc_host *host)
{
int err = 0;
+#ifdef CONFIG_MMC_PARANOID_SD_INIT
+ int retries;
+#endif
BUG_ON(!host);
BUG_ON(!host->card);
@@ -1155,7 +1158,23 @@ static int _mmc_sd_resume(struct mmc_host *host)
goto out;
mmc_power_up(host, host->card->ocr);
+#ifdef CONFIG_MMC_PARANOID_SD_INIT
+ retries = 5;
+ while (retries) {
+ err = mmc_sd_init_card(host, host->card->ocr, host->card);
+
+ if (err) {
+ printk(KERN_ERR "%s: Re-init card rc = %d (retries = %d)\n",
+ mmc_hostname(host), err, retries);
+ mdelay(5);
+ retries--;
+ continue;
+ }
+ break;
+ }
+#else
err = mmc_sd_init_card(host, host->card->ocr, host->card);
+#endif
mmc_card_clr_suspended(host->card);
out: