summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/pxamci.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-11-02 14:03:14 +1100
committerPaul Mackerras <paulus@samba.org>2007-11-02 14:03:14 +1100
commit97a4649d6ffce4a5d7f5ce018d87a6cefcb4ad03 (patch)
tree8f7f591754baa934a842357e75e773a525bfb147 /drivers/mmc/host/pxamci.c
parentf6ab0b922c3423b88c0e6e3e2c5fc1e58d83055d (diff)
parent54866f032307063776b4eff7eadb131d47f9f9b4 (diff)
downloadop-kernel-dev-97a4649d6ffce4a5d7f5ce018d87a6cefcb4ad03.zip
op-kernel-dev-97a4649d6ffce4a5d7f5ce018d87a6cefcb4ad03.tar.gz
Merge branch 'linux-2.6' into merge
Diffstat (limited to 'drivers/mmc/host/pxamci.c')
-rw-r--r--drivers/mmc/host/pxamci.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index a25ee71..1654a33 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -39,6 +39,7 @@
#define DRIVER_NAME "pxa2xx-mci"
#define NR_SG 1
+#define CLKRT_OFF (~0)
struct pxamci_host {
struct mmc_host *mmc;
@@ -371,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
unsigned long rate = host->clkrate;
unsigned int clk = rate / ios->clock;
+ if (host->clkrt == CLKRT_OFF)
+ clk_enable(host->clk);
+
/*
* clk might result in a lower divisor than we
* desire. check for that condition and adjust
@@ -379,14 +383,16 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (rate / clk > ios->clock)
clk <<= 1;
host->clkrt = fls(clk) - 1;
- clk_enable(host->clk);
/*
* we write clkrt on the next command
*/
} else {
pxamci_stop_clock(host);
- clk_disable(host->clk);
+ if (host->clkrt != CLKRT_OFF) {
+ host->clkrt = CLKRT_OFF;
+ clk_disable(host->clk);
+ }
}
if (host->power_mode != ios->power_mode) {
@@ -498,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev)
host->mmc = mmc;
host->dma = -1;
host->pdata = pdev->dev.platform_data;
+ host->clkrt = CLKRT_OFF;
host->clk = clk_get(&pdev->dev, "MMCCLK");
if (IS_ERR(host->clk)) {
OpenPOWER on IntegriCloud