aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2011-08-03 11:36:00 -0400
committerChris Ball <cjb@laptop.org>2011-08-13 14:50:29 -0400
commit272308caaa6c0f2b1500a3660b9fa75f17a45cc4 (patch)
tree0778e73914dccfb40439ec3c2b2b56d7647f4543 /drivers
parent78a2ca2727a9b992901c715bc881b6ddb4ec6a4e (diff)
mmc: sdhci: move timeout_clk calculation farther down
This moves the calculation below the assignment of mmc->f_max, which we need for calculating timeout_clk in the next patch in this series. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/sdhci.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 89ba4516cb8..afa26bdcfa4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2456,25 +2456,6 @@ int sdhci_add_host(struct sdhci_host *host)
2456 host->max_clk = host->ops->get_max_clock(host); 2456 host->max_clk = host->ops->get_max_clock(host);
2457 } 2457 }
2458 2458
2459 host->timeout_clk =
2460 (caps[0] & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
2461 if (host->timeout_clk == 0) {
2462 if (host->ops->get_timeout_clock) {
2463 host->timeout_clk = host->ops->get_timeout_clock(host);
2464 } else if (!(host->quirks &
2465 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)) {
2466 printk(KERN_ERR
2467 "%s: Hardware doesn't specify timeout clock "
2468 "frequency.\n", mmc_hostname(mmc));
2469 return -ENODEV;
2470 }
2471 }
2472 if (caps[0] & SDHCI_TIMEOUT_CLK_UNIT)
2473 host->timeout_clk *= 1000;
2474
2475 if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)
2476 host->timeout_clk = host->clock / 1000;
2477
2478 /* 2459 /*
2479 * In case of Host Controller v3.00, find out whether clock 2460 * In case of Host Controller v3.00, find out whether clock
2480 * multiplier is supported. 2461 * multiplier is supported.
@@ -2507,6 +2488,25 @@ int sdhci_add_host(struct sdhci_host *host)
2507 } else 2488 } else
2508 mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; 2489 mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
2509 2490
2491 host->timeout_clk =
2492 (caps[0] & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
2493 if (host->timeout_clk == 0) {
2494 if (host->ops->get_timeout_clock) {
2495 host->timeout_clk = host->ops->get_timeout_clock(host);
2496 } else if (!(host->quirks &
2497 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)) {
2498 printk(KERN_ERR
2499 "%s: Hardware doesn't specify timeout clock "
2500 "frequency.\n", mmc_hostname(mmc));
2501 return -ENODEV;
2502 }
2503 }
2504 if (caps[0] & SDHCI_TIMEOUT_CLK_UNIT)
2505 host->timeout_clk *= 1000;
2506
2507 if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)
2508 host->timeout_clk = host->clock / 1000;
2509
2510 if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) 2510 if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)
2511 mmc->max_discard_to = (1 << 27) / (mmc->f_max / 1000); 2511 mmc->max_discard_to = (1 << 27) / (mmc->f_max / 1000);
2512 else 2512 else