提交 e684c468 编写于 作者: C Chander Kashyap 提交者: Chris Ball

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: NChander Kashyap <chander.kashyap@linaro.org>
Acked-by: NJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 897b69e7
......@@ -208,10 +208,12 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
best_src, clock, best);
/* select the new clock source */
if (ourhost->cur_clk != best_src) {
struct clk *clk = ourhost->clk_bus[best_src];
clk_enable(clk);
clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
/* turn clock off to card before changing clock source */
writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
......@@ -625,8 +627,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
*/
sc->cur_clk = ptr;
clk_enable(clk);
dev_info(dev, "clock source %d: %s (%ld Hz)\n",
ptr, name, clk_get_rate(clk));
}
......@@ -637,6 +637,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
goto err_no_busclks;
}
clk_enable(sc->clk_bus[sc->cur_clk]);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
if (!host->ioaddr) {
......@@ -745,9 +747,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
return 0;
err_req_regs:
clk_disable(sc->clk_bus[sc->cur_clk]);
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
if (sc->clk_bus[ptr]) {
clk_disable(sc->clk_bus[ptr]);
clk_put(sc->clk_bus[ptr]);
}
}
......@@ -788,9 +790,9 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
clk_disable(sc->clk_bus[sc->cur_clk]);
for (ptr = 0; ptr < 3; ptr++) {
if (sc->clk_bus[ptr]) {
clk_disable(sc->clk_bus[ptr]);
clk_put(sc->clk_bus[ptr]);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册