diff options
Diffstat (limited to 'drivers/mmc/host/pxamci.c')
-rw-r--r-- | drivers/mmc/host/pxamci.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index a25ee71998a9..1654a3330340 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #define DRIVER_NAME "pxa2xx-mci" | 39 | #define DRIVER_NAME "pxa2xx-mci" |
40 | 40 | ||
41 | #define NR_SG 1 | 41 | #define NR_SG 1 |
42 | #define CLKRT_OFF (~0) | ||
42 | 43 | ||
43 | struct pxamci_host { | 44 | struct pxamci_host { |
44 | struct mmc_host *mmc; | 45 | struct mmc_host *mmc; |
@@ -371,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
371 | unsigned long rate = host->clkrate; | 372 | unsigned long rate = host->clkrate; |
372 | unsigned int clk = rate / ios->clock; | 373 | unsigned int clk = rate / ios->clock; |
373 | 374 | ||
375 | if (host->clkrt == CLKRT_OFF) | ||
376 | clk_enable(host->clk); | ||
377 | |||
374 | /* | 378 | /* |
375 | * clk might result in a lower divisor than we | 379 | * clk might result in a lower divisor than we |
376 | * desire. check for that condition and adjust | 380 | * desire. check for that condition and adjust |
@@ -379,14 +383,16 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
379 | if (rate / clk > ios->clock) | 383 | if (rate / clk > ios->clock) |
380 | clk <<= 1; | 384 | clk <<= 1; |
381 | host->clkrt = fls(clk) - 1; | 385 | host->clkrt = fls(clk) - 1; |
382 | clk_enable(host->clk); | ||
383 | 386 | ||
384 | /* | 387 | /* |
385 | * we write clkrt on the next command | 388 | * we write clkrt on the next command |
386 | */ | 389 | */ |
387 | } else { | 390 | } else { |
388 | pxamci_stop_clock(host); | 391 | pxamci_stop_clock(host); |
389 | clk_disable(host->clk); | 392 | if (host->clkrt != CLKRT_OFF) { |
393 | host->clkrt = CLKRT_OFF; | ||
394 | clk_disable(host->clk); | ||
395 | } | ||
390 | } | 396 | } |
391 | 397 | ||
392 | if (host->power_mode != ios->power_mode) { | 398 | if (host->power_mode != ios->power_mode) { |
@@ -498,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
498 | host->mmc = mmc; | 504 | host->mmc = mmc; |
499 | host->dma = -1; | 505 | host->dma = -1; |
500 | host->pdata = pdev->dev.platform_data; | 506 | host->pdata = pdev->dev.platform_data; |
507 | host->clkrt = CLKRT_OFF; | ||
501 | 508 | ||
502 | host->clk = clk_get(&pdev->dev, "MMCCLK"); | 509 | host->clk = clk_get(&pdev->dev, "MMCCLK"); |
503 | if (IS_ERR(host->clk)) { | 510 | if (IS_ERR(host->clk)) { |