diff options
author | Avri Altman <avri.altman@wdc.com> | 2019-02-26 10:10:25 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2019-02-28 03:16:12 -0500 |
commit | ad9be7fff3e729287f61a2a5e811c03090003fff (patch) | |
tree | 0e7cef6f796fa5bdd866b05225dbff42f2258f00 /drivers/mmc | |
parent | bc47e2f6f9e261ea07c678c3cad76eb5590c0fea (diff) |
mmc: core: Add sd discard timeout
The busy timeout is 250msec per discard command.
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 681b089f669a..2d415cb1889a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | /* The max erase timeout, used when host->max_busy_timeout isn't specified */ | 52 | /* The max erase timeout, used when host->max_busy_timeout isn't specified */ |
53 | #define MMC_ERASE_TIMEOUT_MS (60 * 1000) /* 60 s */ | 53 | #define MMC_ERASE_TIMEOUT_MS (60 * 1000) /* 60 s */ |
54 | #define SD_DISCARD_TIMEOUT_MS (250) | ||
54 | 55 | ||
55 | static const unsigned freqs[] = { 400000, 300000, 200000, 100000 }; | 56 | static const unsigned freqs[] = { 400000, 300000, 200000, 100000 }; |
56 | 57 | ||
@@ -1619,6 +1620,12 @@ static unsigned int mmc_sd_erase_timeout(struct mmc_card *card, | |||
1619 | { | 1620 | { |
1620 | unsigned int erase_timeout; | 1621 | unsigned int erase_timeout; |
1621 | 1622 | ||
1623 | /* for DISCARD none of the below calculation applies. | ||
1624 | * the busy timeout is 250msec per discard command. | ||
1625 | */ | ||
1626 | if (arg == SD_DISCARD_ARG) | ||
1627 | return SD_DISCARD_TIMEOUT_MS; | ||
1628 | |||
1622 | if (card->ssr.erase_timeout) { | 1629 | if (card->ssr.erase_timeout) { |
1623 | /* Erase timeout specified in SD Status Register (SSR) */ | 1630 | /* Erase timeout specified in SD Status Register (SSR) */ |
1624 | erase_timeout = card->ssr.erase_timeout * qty + | 1631 | erase_timeout = card->ssr.erase_timeout * qty + |