Commit 91138ca5 authored by Russell King's avatar Russell King Committed by Chris Ball

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Tested-by: default avatarMarkus Pargmann <mpa@pengutronix.de>
Tested-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent d1e49f77
...@@ -30,9 +30,6 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -30,9 +30,6 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
u16 clk; u16 clk;
unsigned long timeout; unsigned long timeout;
if (clock == host->clock)
return;
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
if (clock == 0) if (clock == 0)
......
...@@ -1119,9 +1119,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -1119,9 +1119,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
u16 clk = 0; u16 clk = 0;
unsigned long timeout; unsigned long timeout;
if (clock && clock == host->clock)
return;
host->mmc->actual_clock = 0; host->mmc->actual_clock = 0;
if (host->ops->set_clock) { if (host->ops->set_clock) {
...@@ -1228,15 +1225,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -1228,15 +1225,6 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
host->clock = clock; host->clock = clock;
} }
static inline void sdhci_update_clock(struct sdhci_host *host)
{
unsigned int clock;
clock = host->clock;
host->clock = 0;
sdhci_set_clock(host, clock);
}
static int sdhci_set_power(struct sdhci_host *host, unsigned short power) static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
{ {
u8 pwr = 0; u8 pwr = 0;
...@@ -1453,6 +1441,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) ...@@ -1453,6 +1441,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
!(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN)) !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN))
sdhci_enable_preset_value(host, false); sdhci_enable_preset_value(host, false);
if (!ios->clock || ios->clock != host->clock)
sdhci_set_clock(host, ios->clock); sdhci_set_clock(host, ios->clock);
if (ios->power_mode == MMC_POWER_OFF) if (ios->power_mode == MMC_POWER_OFF)
...@@ -1522,7 +1511,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) ...@@ -1522,7 +1511,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
/* Re-enable SD Clock */ /* Re-enable SD Clock */
sdhci_update_clock(host); sdhci_set_clock(host, host->clock);
} }
...@@ -1567,7 +1556,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) ...@@ -1567,7 +1556,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
} }
/* Re-enable SD Clock */ /* Re-enable SD Clock */
sdhci_update_clock(host); sdhci_set_clock(host, host->clock);
} else } else
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
...@@ -2141,7 +2130,7 @@ static void sdhci_tasklet_finish(unsigned long param) ...@@ -2141,7 +2130,7 @@ static void sdhci_tasklet_finish(unsigned long param)
/* Some controllers need this kick or reset won't work here */ /* Some controllers need this kick or reset won't work here */
if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET)
/* This is to force an update */ /* This is to force an update */
sdhci_update_clock(host); sdhci_set_clock(host, host->clock);
/* Spec says we should do both at the same time, but Ricoh /* Spec says we should do both at the same time, but Ricoh
controllers do not like that. */ controllers do not like that. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment