From 930e70e995db5353a24638891263c608865de2c0 Mon Sep 17 00:00:00 2001 From: Veerabhadrarao Badiganti Date: Wed, 10 Jun 2020 17:47:15 +0530 Subject: [PATCH] mmc: sdhci-msm: Ensure larger discard size Discard size calculation uses max_busy_timeout in deriving the value. So, we can ensure a larger discard size by setting this timeout as zero. If this timeout is zero then it takes max erase timeout vlaue (which is 60sec) in the discard size calculation. And qcom SDHC can support h/w based busy detection, So we need set MMC_CAP_NEED_RSP_BUSY capability flag. Since Qcom SDHC can support h/w based busy detection for R1b commands, this timeout value is not relevant for us. Setting it zero won't affect in any operation provied MMC_CAP_NEED_RSP_BUSY cap is set. Change-Id: Ib20a1e536d2e24cf8de1e927715a8a3aa7f0ae27 Signed-off-by: Veerabhadrarao Badiganti --- drivers/mmc/host/sdhci-msm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 8f29d6d15a94..6adbbc3f73e7 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -3214,8 +3214,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc->caps |= MMC_CAP_AGGRESSIVE_PM; msm_host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY; - - msm_host->pltfm_init_done = true; + msm_host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY; #if defined(CONFIG_SDC_QTI) msm_host->mmc->caps2 |= MMC_CAP2_CLK_SCALE; @@ -3233,6 +3232,20 @@ static int sdhci_msm_probe(struct platform_device *pdev) goto pm_runtime_disable; sdhci_msm_set_regulator_caps(msm_host); + /* + * Ensure larger discard size by setting max_busy_timeout. + * This has to set only after sdhci_add_host so that our + * value won't be over-written. + */ + host->mmc->max_busy_timeout = 0; + + /* + * Set platfm_init_done only after sdhci_add_host(). + * So that we don't turn off vqmmc while we reset sdhc as + * part of sdhci_add_host(). + */ + msm_host->pltfm_init_done = true; + pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev);