sdhci : recompute timeout_clk when needed
authorMatthieu CASTET <matthieu.castet@parrot.com>
Thu, 14 Aug 2014 14:03:18 +0000 (16:03 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 9 Sep 2014 11:59:03 +0000 (13:59 +0200)
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>
drivers/mmc/host/sdhci.c

index bcad1084cc747e2a3b683cba8e2ebc5e1d3244c5..4cc2ff90eeef5b628d841ebc60803607f16b17dc 100644 (file)
@@ -1192,8 +1192,14 @@ 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)
This page took 0.027629 seconds and 5 git commands to generate.