Commit 1650d0c7 authored by Russell King's avatar Russell King Committed by Chris Ball

mmc: sdhci: move setting mmc->actual_clock into set_clock handlers

Move the setting of mmc->actual_clock to zero into the set_clock
handlers themselves.  This will allow us to clean up the calling
logic for the set_clock() method, and turn sdhci_set_clock() into
a library function.
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 373073ef
...@@ -30,6 +30,8 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -30,6 +30,8 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
u16 clk; u16 clk;
unsigned long timeout; unsigned long timeout;
host->mmc->actual_clock = 0;
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
if (clock == 0) if (clock == 0)
......
...@@ -600,6 +600,8 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, ...@@ -600,6 +600,8 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
u32 temp, val; u32 temp, val;
if (clock == 0) { if (clock == 0) {
host->mmc->actual_clock = 0;
if (esdhc_is_usdhc(imx_data)) { if (esdhc_is_usdhc(imx_data)) {
val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
......
...@@ -199,11 +199,12 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) ...@@ -199,11 +199,12 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
{ {
int pre_div = 2; int pre_div = 2;
int div = 1; int div = 1;
u32 temp; u32 temp;
host->mmc->actual_clock = 0;
if (clock == 0) if (clock == 0)
return; return;
......
...@@ -158,6 +158,8 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -158,6 +158,8 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
int src; int src;
u32 ctrl; u32 ctrl;
host->mmc->actual_clock = 0;
/* don't bother if the clock is going off. */ /* don't bother if the clock is going off. */
if (clock == 0) if (clock == 0)
return; return;
...@@ -292,6 +294,8 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -292,6 +294,8 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
unsigned long timeout; unsigned long timeout;
u16 clk = 0; u16 clk = 0;
host->mmc->actual_clock = 0;
/* If the clock is going off, set to 0 at clock control register */ /* If the clock is going off, set to 0 at clock control register */
if (clock == 0) { if (clock == 0) {
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
......
...@@ -1119,14 +1119,14 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -1119,14 +1119,14 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
u16 clk = 0; u16 clk = 0;
unsigned long timeout; unsigned long timeout;
host->mmc->actual_clock = 0;
if (host->ops->set_clock) { if (host->ops->set_clock) {
host->ops->set_clock(host, clock); host->ops->set_clock(host, clock);
if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK) if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK)
return; return;
} }
host->mmc->actual_clock = 0;
sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
if (clock == 0) if (clock == 0)
......
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