All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-spear: Add clk_{un}prepare() support
@ 2012-04-17  9:44 Viresh Kumar
  2012-04-17 11:02 ` Subhash Jadavani
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2012-04-17  9:44 UTC (permalink / raw)
  To: cjb; +Cc: linux-mmc, spear-devel, viresh.linux, Viresh Kumar

clk_{un}prepare is mandatory for platforms using common clock framework. Since
this driver is used by SPEAr platform, which supports common clock framework,
add clk_{un}prepare() support for it.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
 drivers/mmc/host/sdhci-spear.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 62c9730..78ca787 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -154,10 +154,16 @@ static int __devinit sdhci_probe(struct platform_device *pdev)
 		goto err;
 	}
 
+	ret = clk_prepare(sdhci->clk);
+	if (ret) {
+		dev_dbg(&pdev->dev, "Error preparing clock\n");
+		goto put_clk;
+	}
+
 	ret = clk_enable(sdhci->clk);
 	if (ret) {
 		dev_dbg(&pdev->dev, "Error enabling clock\n");
-		goto put_clk;
+		goto unprepare_clk;
 	}
 
 	if (np) {
@@ -275,6 +281,8 @@ free_host:
 	sdhci_free_host(host);
 disable_clk:
 	clk_disable(sdhci->clk);
+unprepare_clk:
+	clk_unprepare(sdhci->clk);
 put_clk:
 	clk_put(sdhci->clk);
 err:
@@ -297,6 +305,7 @@ static int __devexit sdhci_remove(struct platform_device *pdev)
 	sdhci_remove_host(host, dead);
 	sdhci_free_host(host);
 	clk_disable(sdhci->clk);
+	clk_unprepare(sdhci->clk);
 	clk_put(sdhci->clk);
 
 	return 0;
@@ -310,8 +319,10 @@ static int sdhci_suspend(struct device *dev)
 	int ret;
 
 	ret = sdhci_suspend_host(host);
-	if (!ret)
+	if (!ret) {
 		clk_disable(sdhci->clk);
+		clk_unprepare(sdhci->clk);
+	}
 
 	return ret;
 }
@@ -322,9 +333,16 @@ static int sdhci_resume(struct device *dev)
 	struct spear_sdhci *sdhci = dev_get_platdata(dev);
 	int ret;
 
+	ret = clk_prepare(sdhci->clk);
+	if (ret) {
+		dev_dbg(dev, "Error preparing clock\n");
+		return ret;
+	}
+
 	ret = clk_enable(sdhci->clk);
 	if (ret) {
 		dev_dbg(dev, "Resume: Error enabling clock\n");
+		clk_unprepare(sdhci->clk);
 		return ret;
 	}
 
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-17 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17  9:44 [PATCH] mmc: sdhci-spear: Add clk_{un}prepare() support Viresh Kumar
2012-04-17 11:02 ` Subhash Jadavani
2012-04-17 11:05   ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.