diff options
| -rw-r--r-- | drivers/mmc/core/mmc_ops.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index ec0e0095e03a..4a978898af84 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -528,6 +528,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, unsigned long timeout; u32 status = 0; bool use_r1b_resp = use_busy_signal; + int retries = 5; mmc_retune_hold(host); @@ -603,10 +604,17 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, /* Timeout if the device never leaves the program state. */ if (time_after(jiffies, timeout)) { - pr_err("%s: Card stuck in programming state! %s\n", - mmc_hostname(host), __func__); - err = -ETIMEDOUT; - goto out; + pr_err("%s: Card stuck in programming state! %s, timeout:%ums, retries:%d\n", + mmc_hostname(host), __func__, + timeout_ms, retries); + if (retries) + timeout = jiffies + + msecs_to_jiffies(timeout_ms); + else { + err = -ETIMEDOUT; + goto out; + } + retries--; } } while (R1_CURRENT_STATE(status) == R1_STATE_PRG); |
