[<PATCH v1> 2/9] mmc: core: allow hosts to specify a large discard size
From: Bao D. Nguyen
Date: Mon Dec 16 2019 - 21:52:36 EST
From: Ziqi Chen <ziqichen@xxxxxxxxxxxxxx>
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.
Signed-off-by: Ziqi Chen <ziqichen@xxxxxxxxxxxxxx>
Signed-off-by: Sayali Lokhande <sayalil@xxxxxxxxxxxxxx>
Signed-off-by: Bao D. Nguyen <nguyenb@xxxxxxxxxxxxxx>
---
drivers/mmc/core/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index abf8f5e..1e37f78 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2059,6 +2059,10 @@ 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 ||
+ (host->caps2 & MMC_CAP2_MAX_DISCARD_SIZE))
+ return UINT_MAX;
+
/*
* Without erase_group_def set, MMC erase timeout depends on clock
* frequence which can change. In that case, the best choice is
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project