aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu CASTET <matthieu.castet@parrot.com>2014-08-14 16:03:18 +0200
committerDong Aisheng <aisheng.dong@freescale.com>2015-11-01 01:36:37 +0800
commite68b6eddccbc35c21eebad956a5375bb0909f5f0 (patch)
tree3f08e2ca498c43043b50d64399d0428169b5c07d
parentf3b7d5f8f2c2185fe7de772d17702dbcc7769232 (diff)
downloadfreescale-e68b6eddccbc35c21eebad956a5375bb0909f5f0.tar.gz
sdhci : recompute timeout_clk when needed
when SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK is set, timeout_clk is sdclk. We need to update it when we change sdclk in sdhci_set_clock. This allow to have a more precisse timeout and max_busy_timeout. This can help for command that need a big busy wait (erase, ...). Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> (cherry picked from commit fac6a52fe9b14851d56b3c19c3d5a95790c46fac)
-rw-r--r--drivers/mmc/host/sdhci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c04538a431c..0cad42b3395 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1216,8 +1216,14 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
}
clock_set:
- if (real_div)
+ if (real_div) {
host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div;
+ if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) {
+ host->timeout_clk = host->mmc->actual_clock / 1000;
+ host->mmc->max_busy_timeout =
+ (1 << 27) / host->timeout_clk;
+ }
+ }
clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)