From 6d9a04f1b112e5afd57bafb1fb80e67778656844 Mon Sep 17 00:00:00 2001 From: Krishna Konda Date: Sat, 26 Sep 2015 17:38:26 -0700 Subject: [PATCH] mmc: core: allow hosts to specify a large discard size max_busy_timeout is used to decide whether R1B response should be used or a R1 response should be used. This is also used to decide what the discard size of mmc queue (registered with block layer) can be set to. In order to keep both the features in place, this change will allow for hosts to specify a larger discard size while still specifying max_busy_timeout. Change-Id: I1e607329c4377897a7cb4086db02cbc150bd02b7 Signed-off-by: Krishna Konda --- drivers/mmc/core/core.c | 3 ++- include/linux/mmc/host.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 42ad100a5104..2b5298ea0555 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -3761,7 +3761,8 @@ unsigned int mmc_calc_max_discard(struct mmc_card *card) struct mmc_host *host = card->host; unsigned int max_discard, max_trim; - if (!host->max_busy_timeout) + if (!host->max_busy_timeout || + (host->caps2 & MMC_CAP2_MAX_DISCARD_SIZE)) return UINT_MAX; /* diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 0f8d285a1192..87f90a7d061a 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -442,6 +442,8 @@ struct mmc_host { #define MMC_CAP2_CMD_QUEUE (1 << 26) /* support eMMC command queue */ #define MMC_CAP2_SANITIZE (1 << 27) /* Support Sanitize */ #define MMC_CAP2_SLEEP_AWAKE (1 << 28) /* Use Sleep/Awake (CMD5) */ +/* use max discard ignoring max_busy_timeout parameter */ +#define MMC_CAP2_MAX_DISCARD_SIZE (1 << 29) mmc_pm_flag_t pm_caps; /* supported pm features */