Sdhci: Disable host clk after all io ops are done
Pavan Kunapuli [Tue, 20 Sep 2011 09:23:11 +0000 (14:23 +0530)]
Disable host clk after all io operations are done.

Bug 871369

Change-Id: I99d7f3a71920c2e6238ae8a3d192fd4f68148373
Reviewed-on: http://git-master/r/53417
Tested-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Tested-by: Thomas Cherry <tcherry@nvidia.com>
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>

Rebase-Id: R74b661881a06a407ef87327d4787f27e45f4ac39

drivers/mmc/host/sdhci.c

index c06d9ef..def0360 100644 (file)
@@ -1284,7 +1284,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                if (!host->clock && !ios->clock) {
                        host->ops->set_clock(host, host->mmc->f_min);
                        host->clock = host->mmc->f_min;
-               } else if (ios->clock != host->clock) {
+               } else if (ios->clock && (ios->clock != host->clock)) {
                        host->ops->set_clock(host, ios->clock);
                }
        }
@@ -1308,12 +1308,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        else
                sdhci_set_power(host, ios->vdd);
 
-       /*
-        * Controller clock should be shutdown only after all the
-        * register writes are done.
-        */
-       if (ios->clock)
-               sdhci_set_clock(host, ios->clock);
+       sdhci_set_clock(host, ios->clock);
 
        if (host->ops->platform_send_init_74_clocks)
                host->ops->platform_send_init_74_clocks(host, ios->power_mode);
@@ -1438,15 +1433,15 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        if(host->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
                sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
 
+out:
+       mmiowb();
+       spin_unlock_irqrestore(&host->lock, flags);
        /*
         * Controller clock should only be disabled after all the register
         * writes are done.
         */
-       if (!ios->clock)
-               sdhci_set_clock(host, ios->clock);
-out:
-       mmiowb();
-       spin_unlock_irqrestore(&host->lock, flags);
+       if (!ios->clock && host->ops->set_clock)
+               host->ops->set_clock(host, ios->clock);
 }
 
 static int check_ro(struct sdhci_host *host)