Skip to content

Commit e684c46

Browse files
Chander Kashyapcjb
authored andcommitted
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>
1 parent 897b69e commit e684c46

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/mmc/host/sdhci-s3c.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,12 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
208208
best_src, clock, best);
209209

210210
/* select the new clock source */
211-
212211
if (ourhost->cur_clk != best_src) {
213212
struct clk *clk = ourhost->clk_bus[best_src];
214213

214+
clk_enable(clk);
215+
clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
216+
215217
/* turn clock off to card before changing clock source */
216218
writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
217219

@@ -625,8 +627,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
625627
*/
626628
sc->cur_clk = ptr;
627629

628-
clk_enable(clk);
629-
630630
dev_info(dev, "clock source %d: %s (%ld Hz)\n",
631631
ptr, name, clk_get_rate(clk));
632632
}
@@ -637,6 +637,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
637637
goto err_no_busclks;
638638
}
639639

640+
clk_enable(sc->clk_bus[sc->cur_clk]);
641+
640642
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
641643
host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
642644
if (!host->ioaddr) {
@@ -745,9 +747,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
745747
return 0;
746748

747749
err_req_regs:
750+
clk_disable(sc->clk_bus[sc->cur_clk]);
748751
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
749752
if (sc->clk_bus[ptr]) {
750-
clk_disable(sc->clk_bus[ptr]);
751753
clk_put(sc->clk_bus[ptr]);
752754
}
753755
}
@@ -788,9 +790,9 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
788790

789791
pm_runtime_disable(&pdev->dev);
790792

793+
clk_disable(sc->clk_bus[sc->cur_clk]);
791794
for (ptr = 0; ptr < 3; ptr++) {
792795
if (sc->clk_bus[ptr]) {
793-
clk_disable(sc->clk_bus[ptr]);
794796
clk_put(sc->clk_bus[ptr]);
795797
}
796798
}

0 commit comments

Comments
 (0)