mmc: sd: When resuming, try a little harder to init the card
authorSan Mehat <san@android.com>
Mon, 1 Dec 2008 16:52:34 +0000 (08:52 -0800)
committerColin Cross <ccross@android.com>
Thu, 30 Sep 2010 00:49:14 +0000 (17:49 -0700)
Signed-off-by: San Mehat <san@android.com>
drivers/mmc/core/sd.c

index 072c822d66b7b8904f33420ed47eb1879bd44af1..a0db832744b85bdf5241978876cef410e8e40d75 100644 (file)
@@ -733,12 +733,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;