aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-esdhc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/sdhci-esdhc.h')
-rw-r--r--drivers/mmc/host/sdhci-esdhc.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h
index d25f9ab9a54d..6f16406c37cd 100644
--- a/drivers/mmc/host/sdhci-esdhc.h
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -42,7 +42,8 @@
42 42
43#define ESDHC_HOST_CONTROL_RES 0x05 43#define ESDHC_HOST_CONTROL_RES 0x05
44 44
45static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock) 45static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock,
46 unsigned int host_clock)
46{ 47{
47 int pre_div = 2; 48 int pre_div = 2;
48 int div = 1; 49 int div = 1;
@@ -56,14 +57,14 @@ static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
56 | ESDHC_CLOCK_MASK); 57 | ESDHC_CLOCK_MASK);
57 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); 58 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
58 59
59 while (host->max_clk / pre_div / 16 > clock && pre_div < 256) 60 while (host_clock / pre_div / 16 > clock && pre_div < 256)
60 pre_div *= 2; 61 pre_div *= 2;
61 62
62 while (host->max_clk / pre_div / div > clock && div < 16) 63 while (host_clock / pre_div / div > clock && div < 16)
63 div++; 64 div++;
64 65
65 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n", 66 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n",
66 clock, host->max_clk / pre_div / div); 67 clock, host_clock / pre_div / div);
67 68
68 pre_div >>= 1; 69 pre_div >>= 1;
69 div--; 70 div--;