aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-04-25 07:58:45 -0400
committerChris Ball <chris@printf.net>2014-05-22 07:26:31 -0400
commit373073efd06528867df963724a93f29c7d5534d0 (patch)
tree243ef5e56d8d686f824151bd4e8514a43b4d63e7 /drivers/mmc
parent91138ca51d8cdbefceb1ed1cd2dbfdd763af6cdf (diff)
mmc: sdhci: move setting host->clock into sdhci_do_set_ios()
We don't need implementations to do this, since the only time it's necessary is when we change the clock, and the only place that happens is in sdhci_do_set_ios(). So, move it there, and remove it from the iMX platform backend. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Markus Pargmann <mpa@pengutronix.de> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-cns3xxx.c4
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c4
-rw-r--r--drivers/mmc/host/sdhci-of-esdhc.c4
-rw-r--r--drivers/mmc/host/sdhci-s3c.c3
-rw-r--r--drivers/mmc/host/sdhci.c9
5 files changed, 7 insertions, 17 deletions
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c
index fa11f63b78a0..f11fb908ad78 100644
--- a/drivers/mmc/host/sdhci-cns3xxx.c
+++ b/drivers/mmc/host/sdhci-cns3xxx.c
@@ -33,7 +33,7 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
33 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 33 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
34 34
35 if (clock == 0) 35 if (clock == 0)
36 goto out; 36 return;
37 37
38 while (host->max_clk / div > clock) { 38 while (host->max_clk / div > clock) {
39 /* 39 /*
@@ -72,8 +72,6 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
72 72
73 clk |= SDHCI_CLOCK_CARD_EN; 73 clk |= SDHCI_CLOCK_CARD_EN;
74 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); 74 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
75out:
76 host->clock = clock;
77} 75}
78 76
79static const struct sdhci_ops sdhci_cns3xxx_ops = { 77static const struct sdhci_ops sdhci_cns3xxx_ops = {
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 812c5772d900..1e68a77c9987 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -605,7 +605,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
605 writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, 605 writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
606 host->ioaddr + ESDHC_VENDOR_SPEC); 606 host->ioaddr + ESDHC_VENDOR_SPEC);
607 } 607 }
608 goto out; 608 return;
609 } 609 }
610 610
611 if (esdhc_is_usdhc(imx_data) && !imx_data->is_ddr) 611 if (esdhc_is_usdhc(imx_data) && !imx_data->is_ddr)
@@ -645,8 +645,6 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
645 } 645 }
646 646
647 mdelay(1); 647 mdelay(1);
648out:
649 host->clock = clock;
650} 648}
651 649
652static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host) 650static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 4530f9957f20..d814b3ecb1f7 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -205,7 +205,7 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
205 u32 temp; 205 u32 temp;
206 206
207 if (clock == 0) 207 if (clock == 0)
208 goto out; 208 return;
209 209
210 /* Workaround to reduce the clock frequency for p1010 esdhc */ 210 /* Workaround to reduce the clock frequency for p1010 esdhc */
211 if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) { 211 if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
@@ -238,8 +238,6 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
238 | (pre_div << ESDHC_PREDIV_SHIFT)); 238 | (pre_div << ESDHC_PREDIV_SHIFT));
239 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); 239 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
240 mdelay(1); 240 mdelay(1);
241out:
242 host->clock = clock;
243} 241}
244 242
245#ifdef CONFIG_PM 243#ifdef CONFIG_PM
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 155241883751..269c3fd8b740 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -295,7 +295,6 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
295 /* If the clock is going off, set to 0 at clock control register */ 295 /* If the clock is going off, set to 0 at clock control register */
296 if (clock == 0) { 296 if (clock == 0) {
297 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 297 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
298 host->clock = clock;
299 return; 298 return;
300 } 299 }
301 300
@@ -303,8 +302,6 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
303 302
304 clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock); 303 clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock);
305 304
306 host->clock = clock;
307
308 clk = SDHCI_CLOCK_INT_EN; 305 clk = SDHCI_CLOCK_INT_EN;
309 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); 306 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
310 307
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index e3a2ecc45752..68269bf38e0c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1130,7 +1130,7 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1130 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 1130 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
1131 1131
1132 if (clock == 0) 1132 if (clock == 0)
1133 goto out; 1133 return;
1134 1134
1135 if (host->version >= SDHCI_SPEC_300) { 1135 if (host->version >= SDHCI_SPEC_300) {
1136 if (sdhci_readw(host, SDHCI_HOST_CONTROL2) & 1136 if (sdhci_readw(host, SDHCI_HOST_CONTROL2) &
@@ -1220,9 +1220,6 @@ clock_set:
1220 1220
1221 clk |= SDHCI_CLOCK_CARD_EN; 1221 clk |= SDHCI_CLOCK_CARD_EN;
1222 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); 1222 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
1223
1224out:
1225 host->clock = clock;
1226} 1223}
1227 1224
1228static int sdhci_set_power(struct sdhci_host *host, unsigned short power) 1225static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
@@ -1441,8 +1438,10 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
1441 !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN)) 1438 !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN))
1442 sdhci_enable_preset_value(host, false); 1439 sdhci_enable_preset_value(host, false);
1443 1440
1444 if (!ios->clock || ios->clock != host->clock) 1441 if (!ios->clock || ios->clock != host->clock) {
1445 sdhci_set_clock(host, ios->clock); 1442 sdhci_set_clock(host, ios->clock);
1443 host->clock = ios->clock;
1444 }
1446 1445
1447 if (ios->power_mode == MMC_POWER_OFF) 1446 if (ios->power_mode == MMC_POWER_OFF)
1448 vdd_bit = sdhci_set_power(host, -1); 1447 vdd_bit = sdhci_set_power(host, -1);