mmc: sdhci: move setting mmc->actual_clock into set_clock handlers
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 25 Apr 2014 11:58:50 +0000 (12:58 +0100)
committerChris Ball <chris@printf.net>
Thu, 22 May 2014 11:26:31 +0000 (07:26 -0400)
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: 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>
drivers/mmc/host/sdhci-cns3xxx.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci.c

index f11fb908ad7868aa0b2ddd3a77bfde96bb9b0d6d..416f4a4c2e3551822fd54e7785fda1347d837311 100644 (file)
@@ -30,6 +30,8 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
        u16 clk;
        unsigned long timeout;
 
+       host->mmc->actual_clock = 0;
+
        sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
 
        if (clock == 0)
index 1e68a77c99871d39f59c42103500238c4db12b0d..ce8939ff97a49c07743f3fffcf12ae85d92d67e7 100644 (file)
@@ -600,6 +600,8 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
        u32 temp, val;
 
        if (clock == 0) {
+               host->mmc->actual_clock = 0;
+
                if (esdhc_is_usdhc(imx_data)) {
                        val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
                        writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
index d814b3ecb1f710899599067af8b7bb3d3f0e4707..c4f8cd3f83c8394c938d89adc040b12edef5db56 100644 (file)
@@ -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)
 {
-
        int pre_div = 2;
        int div = 1;
        u32 temp;
 
+       host->mmc->actual_clock = 0;
+
        if (clock == 0)
                return;
 
index 269c3fd8b740950674f6422fb9629dbac7c1a8fb..9d710b748b9c6310e5d019e467aa314c5b15c010 100644 (file)
@@ -158,6 +158,8 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
        int src;
        u32 ctrl;
 
+       host->mmc->actual_clock = 0;
+
        /* don't bother if the clock is going off. */
        if (clock == 0)
                return;
@@ -292,6 +294,8 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
        unsigned long timeout;
        u16 clk = 0;
 
+       host->mmc->actual_clock = 0;
+
        /* If the clock is going off, set to 0 at clock control register */
        if (clock == 0) {
                sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
index 68269bf38e0c9f5c19bf1f4456963224fc9b78eb..d9b91fc17bb0be415bb52407bc41b2d941c073fb 100644 (file)
@@ -1119,14 +1119,14 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
        u16 clk = 0;
        unsigned long timeout;
 
-       host->mmc->actual_clock = 0;
-
        if (host->ops->set_clock) {
                host->ops->set_clock(host, clock);
                if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK)
                        return;
        }
 
+       host->mmc->actual_clock = 0;
+
        sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
 
        if (clock == 0)