| 1 | From bd8df907ee8e95143d1bb7ec01ee0e4b6f7e1b79 Mon Sep 17 00:00:00 2001 |
| 2 | From: San Mehat <san@android.com> |
| 3 | Date: Mon, 1 Dec 2008 08:52:34 -0800 |
| 4 | Subject: [PATCH 098/134] mmc: sd: When resuming, try a little harder to init the card |
| 5 | |
| 6 | Signed-off-by: San Mehat <san@android.com> |
| 7 | --- |
| 8 | drivers/mmc/core/sd.c | 19 +++++++++++++++++++ |
| 9 | 1 files changed, 19 insertions(+), 0 deletions(-) |
| 10 | |
| 11 | --- a/drivers/mmc/core/sd.c |
| 12 | +++ b/drivers/mmc/core/sd.c |
| 13 | @@ -607,12 +607,31 @@ static void mmc_sd_suspend(struct mmc_ho |
| 14 | static void mmc_sd_resume(struct mmc_host *host) |
| 15 | { |
| 16 | int err; |
| 17 | +#ifdef CONFIG_MMC_PARANOID_SD_INIT |
| 18 | + int retries; |
| 19 | +#endif |
| 20 | |
| 21 | BUG_ON(!host); |
| 22 | BUG_ON(!host->card); |
| 23 | |
| 24 | mmc_claim_host(host); |
| 25 | +#ifdef CONFIG_MMC_PARANOID_SD_INIT |
| 26 | + retries = 5; |
| 27 | + while (retries) { |
| 28 | + err = mmc_sd_init_card(host, host->ocr, host->card); |
| 29 | + |
| 30 | + if (err) { |
| 31 | + printk(KERN_ERR "%s: Re-init card rc = %d (retries = %d)\n", |
| 32 | + mmc_hostname(host), err, retries); |
| 33 | + mdelay(5); |
| 34 | + retries--; |
| 35 | + continue; |
| 36 | + } |
| 37 | + break; |
| 38 | + } |
| 39 | +#else |
| 40 | err = mmc_sd_init_card(host, host->ocr, host->card); |
| 41 | +#endif |
| 42 | mmc_release_host(host); |
| 43 | |
| 44 | if (err) { |
| 45 | |