mmc: use max discard ignoring max_busy_timeout parameter.

On kernel 4.14, no matter sd card type, all use max discard value.
However, kernel 5.4 remove this logical, and will cause system watchdog,
if user format 512GB/1TB class 10 card.

Change-Id: Idc6b00187b8800465fca4af8f720aaf87db5700b
Reviewed-on: https://gerrit.mot.com/1890338
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
zhucc2 2021-03-02 17:38:45 +08:00 • committed by Xiaojun Ji
commit f559241762
3 changed files with 9 additions and 0 deletions

View file

@ -2927,6 +2927,12 @@ 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))
{
pr_err("mmc_calc_max_discard UINT_MAX = %d \n",UINT_MAX);
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

View file

@ -4549,6 +4549,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
host->timeout_clk_div = 4;
msm_host->mmc->caps2 |= MMC_CAP2_CLK_SCALE;
#endif
msm_host->mmc->caps2 |= MMC_CAP2_MAX_DISCARD_SIZE;
sdhci_msm_setup_pm(pdev, msm_host);
host->mmc_host_ops.execute_tuning = sdhci_msm_execute_tuning;

View file

@ -483,6 +483,8 @@ struct mmc_host {
#if defined(CONFIG_SDC_QTI)
#define MMC_CAP2_CLK_SCALE (1 << 28) /* Allow dynamic clk scaling */
#endif
/* use max discard ignoring max_busy_timeout parameter */
#define MMC_CAP2_MAX_DISCARD_SIZE (1 << 31)
int fixed_drv_type; /* fixed driver type for non-removable media */