aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-04-25 07:58:40 -0400
committerChris Ball <chris@printf.net>2014-05-22 07:26:30 -0400
commit91138ca51d8cdbefceb1ed1cd2dbfdd763af6cdf (patch)
tree11f23f1bbeb3cf32a188648d4fbafac4130ad2dc /drivers/mmc
parentd1e49f77d7c7b75fdc022e1d46c1549bbc91c5b7 (diff)
mmc: sdhci: clean up sdhci_update_clock()/sdhci_set_clock()
Only one caller to sdhci_set_clock() needs to check whether the requested clock frequency was the same as the currently set frequency, yet we work around this in several other sites via sdhci_update_clock(). Rather than doing this, move those checks out into sdhci_do_set_ios(), which then allows sdhci_update_clock() to be eliminated. 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.c3
-rw-r--r--drivers/mmc/host/sdhci.c21
2 files changed, 5 insertions, 19 deletions
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c
index 87af66bb1ea8..fa11f63b78a0 100644
--- a/drivers/mmc/host/sdhci-cns3xxx.c
+++ b/drivers/mmc/host/sdhci-cns3xxx.c
@@ -30,9 +30,6 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
30 u16 clk; 30 u16 clk;
31 unsigned long timeout; 31 unsigned long timeout;
32 32
33 if (clock == host->clock)
34 return;
35
36 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 33 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
37 34
38 if (clock == 0) 35 if (clock == 0)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index fd20e892439a..e3a2ecc45752 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1119,9 +1119,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1119 u16 clk = 0; 1119 u16 clk = 0;
1120 unsigned long timeout; 1120 unsigned long timeout;
1121 1121
1122 if (clock && clock == host->clock)
1123 return;
1124
1125 host->mmc->actual_clock = 0; 1122 host->mmc->actual_clock = 0;
1126 1123
1127 if (host->ops->set_clock) { 1124 if (host->ops->set_clock) {
@@ -1228,15 +1225,6 @@ out:
1228 host->clock = clock; 1225 host->clock = clock;
1229} 1226}
1230 1227
1231static inline void sdhci_update_clock(struct sdhci_host *host)
1232{
1233 unsigned int clock;
1234
1235 clock = host->clock;
1236 host->clock = 0;
1237 sdhci_set_clock(host, clock);
1238}
1239
1240static int sdhci_set_power(struct sdhci_host *host, unsigned short power) 1228static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
1241{ 1229{
1242 u8 pwr = 0; 1230 u8 pwr = 0;
@@ -1453,7 +1441,8 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
1453 !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN)) 1441 !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN))
1454 sdhci_enable_preset_value(host, false); 1442 sdhci_enable_preset_value(host, false);
1455 1443
1456 sdhci_set_clock(host, ios->clock); 1444 if (!ios->clock || ios->clock != host->clock)
1445 sdhci_set_clock(host, ios->clock);
1457 1446
1458 if (ios->power_mode == MMC_POWER_OFF) 1447 if (ios->power_mode == MMC_POWER_OFF)
1459 vdd_bit = sdhci_set_power(host, -1); 1448 vdd_bit = sdhci_set_power(host, -1);
@@ -1522,7 +1511,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
1522 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); 1511 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
1523 1512
1524 /* Re-enable SD Clock */ 1513 /* Re-enable SD Clock */
1525 sdhci_update_clock(host); 1514 sdhci_set_clock(host, host->clock);
1526 } 1515 }
1527 1516
1528 1517
@@ -1567,7 +1556,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
1567 } 1556 }
1568 1557
1569 /* Re-enable SD Clock */ 1558 /* Re-enable SD Clock */
1570 sdhci_update_clock(host); 1559 sdhci_set_clock(host, host->clock);
1571 } else 1560 } else
1572 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); 1561 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
1573 1562
@@ -2141,7 +2130,7 @@ static void sdhci_tasklet_finish(unsigned long param)
2141 /* Some controllers need this kick or reset won't work here */ 2130 /* Some controllers need this kick or reset won't work here */
2142 if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) 2131 if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET)
2143 /* This is to force an update */ 2132 /* This is to force an update */
2144 sdhci_update_clock(host); 2133 sdhci_set_clock(host, host->clock);
2145 2134
2146 /* Spec says we should do both at the same time, but Ricoh 2135 /* Spec says we should do both at the same time, but Ricoh
2147 controllers do not like that. */ 2136 controllers do not like that. */