mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout
Adrian Hunter
maintainerPATCH 1/1 mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout
Normally the timeout clock frequency is read from the capabilities register. It is also possible to set the value prior to calling sdhci_add_host() in which case that value will override the capabilities register value. However that was being done after calculating max_busy_timeout so that max_busy_timeout was being calculated using the wrong value of timeout_clk.
Fix that by moving the override before max_busy_timeout is calculated.
The result is that the max_busy_timeout and max_discard increase for BSW devices so that, for example, the time for mkfs.ext4 on a 64GB eMMC drops from about 1 minute 40 seconds to about 20 seconds.
Note, in the future, the capabilities setting will be tidied up and this override won't be used anymore. However this fix is needed for stable.
--- drivers/mmc/host/sdhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +3 -3
@@ -3016,14 +3016,14 @@ int sdhci_add_host(struct sdhci_host *host)if (caps[0 ] &SDHCI_TIMEOUT_CLK_UNIT ) host->timeout_clk *=1000 ; +if (override_timeout_clk) + host->timeout_clk = override_timeout_clk; + mmc->max_busy_timeout = host->ops->get_max_timeout_count ? host->ops->get_max_timeout_count (host) :1 <<27 ; mmc->max_busy_timeout /= host->timeout_clk; } -if (override_timeout_clk) - host->timeout_clk = override_timeout_clk; - mmc->caps |=MMC_CAP_SDIO_IRQ |MMC_CAP_ERASE |MMC_CAP_CMD23 ; mmc->caps2 |=MMC_CAP2_SDIO_IRQ_NOTHREAD ;
Signature · 1 line
1.9.1
Ulf Hansson
AppliedQuoted 15 lines · Adrian Hunter
Normally the timeout clock frequency is read from the capabilities register. It is also possible to set the value prior to calling
sdhci_add_host()in which case that value will override the capabilities register value. However that was being done after calculatingmax_busy_timeoutso thatmax_busy_timeoutwas being calculated using the wrong value oftimeout_clk.Fix that by moving the override before
max_busy_timeoutis calculated.The result is that the
max_busy_timeoutandmax_discardincrease for BSW devices so that, for example, the time for mkfs.ext4 on a 64GB eMMC drops from about 1 minute 40 seconds to about 20 seconds.
Quoted 6 lines
Note, in the future, the capabilities setting will be tidied up and this override won't be used anymore. However this fix is needed for stable.
Signed-off-by Adrian Hunter <[email protected]>Cc [email protected] # v3.18+
Thanks, applied for next!
Kind regards
Uffe
Quoted 29 lines
--- drivers/mmc/host/sdhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mmc/host/sdhci.c +3
-4@@ -3016,14 +3016,14 @@ int sdhci_add_host(struct sdhci_host *host)if (caps[0 ] &SDHCI_TIMEOUT_CLK_UNIT ) host->timeout_clk *=1000 ; +if (override_timeout_clk) + host->timeout_clk = override_timeout_clk; + mmc->max_busy_timeout = host->ops->get_max_timeout_count ? host->ops->get_max_timeout_count (host) :1 <<27 ; mmc->max_busy_timeout /= host->timeout_clk; } -if (override_timeout_clk) - host->timeout_clk = override_timeout_clk; - mmc->caps |=MMC_CAP_SDIO_IRQ |MMC_CAP_ERASE |MMC_CAP_CMD23 ; mmc->caps2 |=MMC_CAP2_SDIO_IRQ_NOTHREAD ; --1.9.1