aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2016-11-04 13:32:33 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-11-07 07:29:52 -0500
commitfe1b5700c70faac6e027982d59667bc6020de5a8 (patch)
treec26198d698150787d08e02c343789e40ad4799c2
parentbe55f7bee39ed019713c5a1e930214e6d744fe0f (diff)
mmc: mmc: Use 500ms as the default generic CMD6 timeout
In the eMMC 4.51 version of the spec, an EXT_CSD field called GENERIC_CMD6_TIME[248] was added. This allows cards to specify the maximum time it may need to move out from its busy state, when a CMD6 command has been sent. In cases when the card is compliant to versions < 4.51 of the eMMC spec, obviously the core needs to use a fall-back value for this timeout, which currently is set to 10 minutes. This value is completely in the wrong range and importantly in some cases it causes a card initialization to take more than 10 minute to complete. Earlier this scenario was avoided as the mmc core used CMD13 to poll the card, to find out when it stopped signaling busy. Commit 08573eaf1a70 ("mmc: mmc: do not use CMD13 to get status after speed mode switch") changed this behavior. Instead of reverting that commit, which would cause other issues, let's instead start by picking a simple solution for the problem, by using a 500ms default generic CMD6 timeout. The reason for using exactly 500ms, comes from observations that shows it's quite common for cards to specify 250ms. 500ms is two times that value so likely it should be enough for most cards. Cc: <stable@vger.kernel.org> # v4.8+ Fixes: 08573eaf1a70 ("mmc: mmc: do not use CMD13 to get status after speed mode switch") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Stephen Boyd <sboyd@codeaurora.org> Tested-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/mmc/core/mmc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 39fc5b2b96c5..df19777068a6 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -26,6 +26,8 @@
26#include "mmc_ops.h" 26#include "mmc_ops.h"
27#include "sd_ops.h" 27#include "sd_ops.h"
28 28
29#define DEFAULT_CMD6_TIMEOUT_MS 500
30
29static const unsigned int tran_exp[] = { 31static const unsigned int tran_exp[] = {
30 10000, 100000, 1000000, 10000000, 32 10000, 100000, 1000000, 10000000,
31 0, 0, 0, 0 33 0, 0, 0, 0
@@ -571,6 +573,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
571 card->erased_byte = 0x0; 573 card->erased_byte = 0x0;
572 574
573 /* eMMC v4.5 or later */ 575 /* eMMC v4.5 or later */
576 card->ext_csd.generic_cmd6_time = DEFAULT_CMD6_TIMEOUT_MS;
574 if (card->ext_csd.rev >= 6) { 577 if (card->ext_csd.rev >= 6) {
575 card->ext_csd.feature_support |= MMC_DISCARD_FEATURE; 578 card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
576 579