mmc: sdhci: move setting host->clock into sdhci_do_set_ios()
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 25 Apr 2014 11:58:45 +0000 (12:58 +0100)
committerChris Ball <chris@printf.net>
Thu, 22 May 2014 11:26:31 +0000 (07:26 -0400)
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>
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 fa11f63b78a065c8680e82b81587916904fc104c..f11fb908ad7868aa0b2ddd3a77bfde96bb9b0d6d 100644 (file)
@@ -33,7 +33,7 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
        sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
 
        if (clock == 0)
-               goto out;
+               return;
 
        while (host->max_clk / div > clock) {
                /*
@@ -72,8 +72,6 @@ static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
 
        clk |= SDHCI_CLOCK_CARD_EN;
        sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
-out:
-       host->clock = clock;
 }
 
 static const struct sdhci_ops sdhci_cns3xxx_ops = {
index 812c5772d900bf691337af871e5556ad976d0440..1e68a77c99871d39f59c42103500238c4db12b0d 100644 (file)
@@ -605,7 +605,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
                        writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
                                        host->ioaddr + ESDHC_VENDOR_SPEC);
                }
-               goto out;
+               return;
        }
 
        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,
        }
 
        mdelay(1);
-out:
-       host->clock = clock;
 }
 
 static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
index 4530f9957f202d8ef0ee83b7a6ae3135f705f682..d814b3ecb1f710899599067af8b7bb3d3f0e4707 100644 (file)
@@ -205,7 +205,7 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
        u32 temp;
 
        if (clock == 0)
-               goto out;
+               return;
 
        /* Workaround to reduce the clock frequency for p1010 esdhc */
        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)
                | (pre_div << ESDHC_PREDIV_SHIFT));
        sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
        mdelay(1);
-out:
-       host->clock = clock;
 }
 
 #ifdef CONFIG_PM
index 155241883751463d14b684783ef0f9fade91dead..269c3fd8b740950674f6422fb9629dbac7c1a8fb 100644 (file)
@@ -295,7 +295,6 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
        /* If the clock is going off, set to 0 at clock control register */
        if (clock == 0) {
                sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
-               host->clock = clock;
                return;
        }
 
@@ -303,8 +302,6 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock)
 
        clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock);
 
-       host->clock = clock;
-
        clk = SDHCI_CLOCK_INT_EN;
        sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
 
index e3a2ecc45752ee41116d5ffffe59f6afe1d52d59..68269bf38e0c9f5c19bf1f4456963224fc9b78eb 100644 (file)
@@ -1130,7 +1130,7 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
        sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
 
        if (clock == 0)
-               goto out;
+               return;
 
        if (host->version >= SDHCI_SPEC_300) {
                if (sdhci_readw(host, SDHCI_HOST_CONTROL2) &
@@ -1220,9 +1220,6 @@ clock_set:
 
        clk |= SDHCI_CLOCK_CARD_EN;
        sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
-
-out:
-       host->clock = clock;
 }
 
 static 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)
                !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN))
                sdhci_enable_preset_value(host, false);
 
-       if (!ios->clock || ios->clock != host->clock)
+       if (!ios->clock || ios->clock != host->clock) {
                sdhci_set_clock(host, ios->clock);
+               host->clock = ios->clock;
+       }
 
        if (ios->power_mode == MMC_POWER_OFF)
                vdd_bit = sdhci_set_power(host, -1);