aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2020-02-04 09:54:44 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2020-03-24 14:35:39 +0100
commit2a1c7cda52b7b9db50086a40654dc5c03fca866f (patch)
tree73f2c2203daa647844f3a0a406acebb336e38b06 /drivers/mmc/core
parentmmc: core: Enable re-use of mmc_blk_in_tran_state() (diff)
downloadwireguard-linux-2a1c7cda52b7b9db50086a40654dc5c03fca866f.tar.xz
wireguard-linux-2a1c7cda52b7b9db50086a40654dc5c03fca866f.zip
mmc: core: Update CMD13 busy check for CMD6 commands
Through mmc_poll_for_busy() a CMD13 may be sent to get the status of the (e)MMC card. If the state of the card is R1_STATE_PRG, the card is considered as being busy, which means we continue to poll with CMD13. This seems to be sufficient, but it's also unnecessary fragile, as it means a new command/request could potentially be sent to the card when it's in an unknown state. To try to improve the situation, but also to move towards a more consistent CMD13 polling behaviour in the mmc core, let's deploy the same policy we use for regular I/O write requests. In other words, let's check that card returns to the R1_STATE_TRAN and that the R1_READY_FOR_DATA bit is set in the CMD13 response, before exiting the polling loop. Note that, potentially this changed behaviour could lead to unnecessary waiting for the timeout to expire, if the card for some reason, moves to an unexpected error state. However, as we bail out from the polling loop when R1_SWITCH_ERROR bit is set or when the CMD13 fails, this shouldn't be an issue. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Baolin Wang <baolin.wang7@gmail.com> Tested-by: Ludovic Barre <ludovic.barre@st.com> Reviewed-by: Ludovic Barre <ludovic.barre@st.com> Link: https://lore.kernel.org/r/20200204085449.32585-8-ulf.hansson@linaro.org
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/mmc_ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 3bb337a399f9..4566f43305d5 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -468,7 +468,7 @@ static int mmc_busy_status(struct mmc_card *card, bool retry_crc_err,
if (err)
return err;
- *busy = R1_CURRENT_STATE(status) == R1_STATE_PRG;
+ *busy = !mmc_ready_for_data(status);
return 0;
}