aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSan Mehat <san@android.com>2011-12-13 01:21:53 +0800
committerAndy Green <andy.green@linaro.org>2012-01-09 10:50:31 +0800
commit0c5c3233308e9955fba0f06167e0a06497c6b9ee (patch)
treeae1204f9689be8c13680bfd037b42d8265113ec0 /drivers
parent44be34f8c052740dbf350b4864d1359848db7903 (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')
-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 e3934db234b..520d7bfd8ba 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1095,12 +1095,31 @@ static int mmc_sd_suspend(struct mmc_host *host)
static int mmc_sd_resume(struct mmc_host *host)
{
int err;
+#ifdef CONFIG_MMC_PARANOID_SD_INIT
+ int retries;
+#endif
BUG_ON(!host);
BUG_ON(!host->card);
mmc_claim_host(host);
+#ifdef CONFIG_MMC_PARANOID_SD_INIT
+ retries = 5;
+ while (retries) {
+ err = mmc_sd_init_card(host, host->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->ocr, host->card);
+#endif
mmc_release_host(host);
return err;