summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc_ops.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2016-11-08 13:53:36 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2016-11-29 09:05:22 +0100
commit437590a123b6617a52e0b136cd25fe3616e4d50f (patch)
treee69f2cf578655c93321ca5cfc0f1b68ace05eb71 /drivers/mmc/core/mmc_ops.c
parent8f743d03948db721dffbc1de53f0d9a5cd4cef05 (diff)
downloadlinux-437590a123b6617a52e0b136cd25fe3616e4d50f.tar.gz
linux-437590a123b6617a52e0b136cd25fe3616e4d50f.tar.bz2
linux-437590a123b6617a52e0b136cd25fe3616e4d50f.zip
mmc: core: Retry instead of ignore at CRC errors when polling for busy
After a CMD6 command has been sent, the __mmc_switch() function might be advised to poll the card for busy by using CMD13 and also by ignoring CRC errors. In the case of ignoring CRC errors, the mmc core tells the mmc host to also ignore these errors via masking the MMC_RSP_CRC response flag. This seems wrong, as it leads to that the mmc host could propagate an unreliable response, instead of a proper error code. What we really want, is not to ignore CRC errors but instead retry the polling attempt. So, let's change this by treating a CRC error as the card is still being busy and thus continue to run the polling loop. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Diffstat (limited to 'drivers/mmc/core/mmc_ops.c')
-rw-r--r--drivers/mmc/core/mmc_ops.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 481bbdbae6e7..4773c562312d 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -503,10 +503,13 @@ static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
if (host->ops->card_busy) {
busy = host->ops->card_busy(host);
} else {
- err = __mmc_send_status(card, &status, ignore_crc);
- if (err)
+ err = mmc_send_status(card, &status);
+ if (ignore_crc && err == -EILSEQ)
+ busy = true;
+ else if (err)
return err;
- busy = R1_CURRENT_STATE(status) == R1_STATE_PRG;
+ else
+ busy = R1_CURRENT_STATE(status) == R1_STATE_PRG;
}
/* Timeout if the device still remains busy. */