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 */