aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAisheng Dong <b29396@freescale.com>2014-08-27 15:26:32 +0800
committerDong Aisheng <aisheng.dong@freescale.com>2015-11-01 01:36:44 +0800
commit475546fe8e34bdbb2fe23e292adb312aa6c6f788 (patch)
tree50aca98b75d540b4312ebf46703caff7b943fa88
parentf4171ca65c364effabc585b96fff81e1cef7ec59 (diff)
downloadfreescale-475546fe8e34bdbb2fe23e292adb312aa6c6f788.tar.gz
mmc: sdhci: move timeout_clk dynamically calculation code into common code
The timeout_clk calculation code for SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK case is common and could be moved into common sdhci_do_set_ios, then platform code which is not using sdhci_set_clock does not need to write the same code again. Signed-off-by: Dong Aisheng <b29396@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> (cherry picked from commit 03d6f5ffc5c469e66bfe0a7d8120d29d4c3c07c9) Conflicts: drivers/mmc/host/sdhci.c
-rw-r--r--drivers/mmc/host/sdhci.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 29980ba4e58..0af163737e4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1225,18 +1225,8 @@ 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 =
- host->ops->get_max_timeout_count ?
- host->ops->get_max_timeout_count(host) :
- 1 << 27;
- host->mmc->max_busy_timeout /= host->timeout_clk;
- }
- }
-
clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
<< SDHCI_DIVIDER_HI_SHIFT;
@@ -1471,6 +1461,18 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
sdhci_set_clock(host, ios->clock);
+ if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK &&
+ host->clock) {
+ host->timeout_clk = host->mmc->actual_clock ?
+ host->mmc->actual_clock / 1000 :
+ host->clock / 1000;
+ host->mmc->max_busy_timeout =
+ host->ops->get_max_timeout_count ?
+ host->ops->get_max_timeout_count(host) :
+ 1 << 27;
+ host->mmc->max_busy_timeout /= host->timeout_clk;
+ }
+
if (ios->power_mode == MMC_POWER_OFF)
vdd_bit = sdhci_set_power(host, -1);
else