diff options
author | Chander Kashyap <chander.kashyap@linaro.org> | 2012-09-14 05:08:49 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-10-03 10:05:26 -0400 |
commit | e684c46876f1d0c1c4964741244a34b6be837b5f (patch) | |
tree | 043654132b294ed118be2131851ed56a2de4a0dc | |
parent | 897b69e72054a39c1c1d99c8f334ffed6dc99ac4 (diff) |
mmc: sdhci-s3c: Enable only required bus clock
In case of multiple bus clock sources, all the clock sources were
getting enabled. As only one clock source is needed at the time hence
enable only the required bus clock.
This patch does as follows:
1. In sdhci_s3c_probe enable only required bus clock source.
2. Handle the disabling of old bus clock and enables the
best clock selected in sdhci_s3c_set_clock().
Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/sdhci-s3c.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 0c77b10d2619..4d9acf833590 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -208,10 +208,12 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock) | |||
208 | best_src, clock, best); | 208 | best_src, clock, best); |
209 | 209 | ||
210 | /* select the new clock source */ | 210 | /* select the new clock source */ |
211 | |||
212 | if (ourhost->cur_clk != best_src) { | 211 | if (ourhost->cur_clk != best_src) { |
213 | struct clk *clk = ourhost->clk_bus[best_src]; | 212 | struct clk *clk = ourhost->clk_bus[best_src]; |
214 | 213 | ||
214 | clk_enable(clk); | ||
215 | clk_disable(ourhost->clk_bus[ourhost->cur_clk]); | ||
216 | |||
215 | /* turn clock off to card before changing clock source */ | 217 | /* turn clock off to card before changing clock source */ |
216 | writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL); | 218 | writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL); |
217 | 219 | ||
@@ -625,8 +627,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
625 | */ | 627 | */ |
626 | sc->cur_clk = ptr; | 628 | sc->cur_clk = ptr; |
627 | 629 | ||
628 | clk_enable(clk); | ||
629 | |||
630 | dev_info(dev, "clock source %d: %s (%ld Hz)\n", | 630 | dev_info(dev, "clock source %d: %s (%ld Hz)\n", |
631 | ptr, name, clk_get_rate(clk)); | 631 | ptr, name, clk_get_rate(clk)); |
632 | } | 632 | } |
@@ -637,6 +637,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
637 | goto err_no_busclks; | 637 | goto err_no_busclks; |
638 | } | 638 | } |
639 | 639 | ||
640 | clk_enable(sc->clk_bus[sc->cur_clk]); | ||
641 | |||
640 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 642 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
641 | host->ioaddr = devm_request_and_ioremap(&pdev->dev, res); | 643 | host->ioaddr = devm_request_and_ioremap(&pdev->dev, res); |
642 | if (!host->ioaddr) { | 644 | if (!host->ioaddr) { |
@@ -745,9 +747,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
745 | return 0; | 747 | return 0; |
746 | 748 | ||
747 | err_req_regs: | 749 | err_req_regs: |
750 | clk_disable(sc->clk_bus[sc->cur_clk]); | ||
748 | for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { | 751 | for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { |
749 | if (sc->clk_bus[ptr]) { | 752 | if (sc->clk_bus[ptr]) { |
750 | clk_disable(sc->clk_bus[ptr]); | ||
751 | clk_put(sc->clk_bus[ptr]); | 753 | clk_put(sc->clk_bus[ptr]); |
752 | } | 754 | } |
753 | } | 755 | } |
@@ -788,9 +790,9 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) | |||
788 | 790 | ||
789 | pm_runtime_disable(&pdev->dev); | 791 | pm_runtime_disable(&pdev->dev); |
790 | 792 | ||
793 | clk_disable(sc->clk_bus[sc->cur_clk]); | ||
791 | for (ptr = 0; ptr < 3; ptr++) { | 794 | for (ptr = 0; ptr < 3; ptr++) { |
792 | if (sc->clk_bus[ptr]) { | 795 | if (sc->clk_bus[ptr]) { |
793 | clk_disable(sc->clk_bus[ptr]); | ||
794 | clk_put(sc->clk_bus[ptr]); | 796 | clk_put(sc->clk_bus[ptr]); |
795 | } | 797 | } |
796 | } | 798 | } |