summaryrefslogtreecommitdiff
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@wdc.com>2019-02-26 18:10:25 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2019-02-28 11:16:12 +0300
commitad9be7fff3e729287f61a2a5e811c03090003fff (patch)
tree0e7cef6f796fa5bdd866b05225dbff42f2258f00 /drivers/mmc/core
parentbc47e2f6f9e261ea07c678c3cad76eb5590c0fea (diff)
downloadlinux-ad9be7fff3e729287f61a2a5e811c03090003fff.tar.xz
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/core')
-rw-r--r--drivers/mmc/core/core.c7
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 @@
/* The max erase timeout, used when host->max_busy_timeout isn't specified */
#define MMC_ERASE_TIMEOUT_MS (60 * 1000) /* 60 s */
+#define SD_DISCARD_TIMEOUT_MS (250)
static const unsigned freqs[] = { 400000, 300000, 200000, 100000 };
@@ -1619,6 +1620,12 @@ static unsigned int mmc_sd_erase_timeout(struct mmc_card *card,
{
unsigned int erase_timeout;
+ /* for DISCARD none of the below calculation applies.
+ * the busy timeout is 250msec per discard command.
+ */
+ if (arg == SD_DISCARD_ARG)
+ return SD_DISCARD_TIMEOUT_MS;
+
if (card->ssr.erase_timeout) {
/* Erase timeout specified in SD Status Register (SSR) */
erase_timeout = card->ssr.erase_timeout * qty +