aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c10
-rw-r--r--drivers/mmc/host/sdhci-esdhc.h9
-rw-r--r--drivers/mmc/host/sdhci-of-esdhc.c2
3 files changed, 15 insertions, 6 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 98f46704baa6..eb1310ca021e 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -391,6 +391,14 @@ static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
391 return clk_get_rate(pltfm_host->clk) / 256 / 16; 391 return clk_get_rate(pltfm_host->clk) / 256 / 16;
392} 392}
393 393
394static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
395 unsigned int clock)
396{
397 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
398
399 esdhc_set_clock(host, clock, clk_get_rate(pltfm_host->clk));
400}
401
394static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host) 402static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
395{ 403{
396 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 404 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -438,7 +446,7 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
438 .write_l = esdhc_writel_le, 446 .write_l = esdhc_writel_le,
439 .write_w = esdhc_writew_le, 447 .write_w = esdhc_writew_le,
440 .write_b = esdhc_writeb_le, 448 .write_b = esdhc_writeb_le,
441 .set_clock = esdhc_set_clock, 449 .set_clock = esdhc_pltfm_set_clock,
442 .get_max_clock = sdhci_pltfm_clk_get_max_clock, 450 .get_max_clock = sdhci_pltfm_clk_get_max_clock,
443 .get_min_clock = esdhc_pltfm_get_min_clock, 451 .get_min_clock = esdhc_pltfm_get_min_clock,
444 .get_ro = esdhc_pltfm_get_ro, 452 .get_ro = esdhc_pltfm_get_ro,
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--;
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 37e668f5b992..2b7369729f91 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -200,7 +200,7 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
200 } 200 }
201 201
202 /* Set the clock */ 202 /* Set the clock */
203 esdhc_set_clock(host, clock); 203 esdhc_set_clock(host, clock, host->max_clk);
204} 204}
205 205
206#ifdef CONFIG_PM 206#ifdef CONFIG_PM