From: San Mehat Date: Mon, 1 Dec 2008 16:52:34 +0000 (-0800) Subject: mmc: sd: When resuming, try a little harder to init the card X-Git-Tag: firefly_0821_release~4090^2~860 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d4322f4552aad52b8ce2c229eb35d391cbe09ef0;p=firefly-linux-kernel-4.4.55.git mmc: sd: When resuming, try a little harder to init the card Signed-off-by: San Mehat --- diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 232c04fd7cc3..a866485393c6 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1106,12 +1106,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;