DORMANTno replies

[PATCH 6/23] Alternative mmc structure to support pxa168, pxa910, mmp2 family SD

From: Philip Rakity <hidden>
Date: 2010-12-22 07:08:23
Also in: linux-arm-kernel

From 3e8414dcda0948450a3c8ea565de0a9e671d4610 Mon Sep 17 00:00:00 2001
From: Philip Rakity <redacted>
Date: Sun, 12 Dec 2010 13:20:24 -0800
Subject: [PATCH] sdhci: ensure clocks are enabled on mulitple controllers

Do not rely on u-boot to do the right thing.  It does not.
Do not disable the system clock to the device.

Signed-off-by: Philip Rakity <redacted>
Signed-off-by: Mark F. Brown <redacted>
---
 drivers/mmc/host/sdhci-pxa.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pxa.c b/drivers/mmc/host/sdhci-pxa.c
index 5686ca3..0afc763 100644
--- a/drivers/mmc/host/sdhci-pxa.c
+++ b/drivers/mmc/host/sdhci-pxa.c
@@ -35,7 +35,7 @@ struct sdhci_pxa {
 	struct clk			*clk;
 	struct resource			*res;
 
-	u8 clk_enable;
+	u8				clk_enable;
 };
 
 /*****************************************************************************\
@@ -43,25 +43,17 @@ struct sdhci_pxa {
  * SDHCI core callbacks                                                      *
  *                                                                           *
 \*****************************************************************************/
-static void set_clock(struct sdhci_host *host, unsigned int clock)
+static void enable_clock(struct sdhci_host *host)
 {
 	struct sdhci_pxa *pxa = sdhci_priv(host);
 
-	if (clock == 0) {
-		if (pxa->clk_enable) {
-			clk_disable(pxa->clk);
-			pxa->clk_enable = 0;
-		}
-	} else {
-		if (0 == pxa->clk_enable) {
-			clk_enable(pxa->clk);
-			pxa->clk_enable = 1;
-		}
+	if (pxa->clk_enable == 0) {
+		clk_enable(pxa->clk);
+		pxa->clk_enable = 1;
 	}
 }
 
 static struct sdhci_ops sdhci_pxa_ops = {
-	.set_clock = set_clock,
 };
 
 /*****************************************************************************\
@@ -136,6 +128,9 @@ static int __devinit sdhci_pxa_probe(struct platform_device *pdev)
 	if (pdata->flags & PXA_FLAG_SD_8_BIT_CAPABLE_SLOT)
 		host->mmc->caps |= MMC_CAP_8_BIT_DATA;
 
+	/* do not rely on u-boot to enable the clocks */
+	enable_clock(host);
+
 	ret = sdhci_add_host(host);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to add host\n");
@@ -181,10 +176,6 @@ static int __devexit sdhci_pxa_remove(struct platform_device *pdev)
 		if (pxa->res)
 			release_mem_region(pxa->res->start,
 					   resource_size(pxa->res));
-		if (pxa->clk_enable) {
-			clk_disable(pxa->clk);
-			pxa->clk_enable = 0;
-		}
 		clk_put(pxa->clk);
 
 		sdhci_free_host(host);
-- 
1.6.0.4

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help