Commit d8cb70d1 authored by Russell King's avatar Russell King Committed by Russell King

[ARM] Fix pxamci regression

Fix:

WARNING: at arch/arm/mach-pxa/clock.c:69 clk_disable()
[<c002d7c8>] (dump_stack+0x0/0x14) from [<c00334f4>] (clk_disable+0x34/0xa0)
[<c00334c0>] (clk_disable+0x0/0xa0) from [<c028a43c>] (pxamci_set_ios+0x74/0xf0)
[<c028a3c8>] (pxamci_set_ios+0x0/0xf0) from [<c0281548>] (mmc_power_off+0x90/0x9c)
[<c02814b8>] (mmc_power_off+0x0/0x9c) from [<c0281a30>] (mmc_start_host+0x18/0x28)
[<c0281a18>] (mmc_start_host+0x0/0x28) from [<c02825a0>] (mmc_add_host+0xe8/0x104)
[<c02824b8>] (mmc_add_host+0x0/0x104) from [<c028a7d0>] (pxamci_probe+0x24c/0x2f4)
[<c028a584>] (pxamci_probe+0x0/0x2f4) from [<c01e5948>] (platform_drv_probe+0x20/0x24)
...
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 5984a2fc
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#define DRIVER_NAME "pxa2xx-mci" #define DRIVER_NAME "pxa2xx-mci"
#define NR_SG 1 #define NR_SG 1
#define CLKRT_OFF (~0)
struct pxamci_host { struct pxamci_host {
struct mmc_host *mmc; struct mmc_host *mmc;
...@@ -371,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -371,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
unsigned long rate = host->clkrate; unsigned long rate = host->clkrate;
unsigned int clk = rate / ios->clock; unsigned int clk = rate / ios->clock;
if (host->clkrt == CLKRT_OFF)
clk_enable(host->clk);
/* /*
* clk might result in a lower divisor than we * clk might result in a lower divisor than we
* desire. check for that condition and adjust * 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,14 +383,16 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (rate / clk > ios->clock) if (rate / clk > ios->clock)
clk <<= 1; clk <<= 1;
host->clkrt = fls(clk) - 1; host->clkrt = fls(clk) - 1;
clk_enable(host->clk);
/* /*
* we write clkrt on the next command * we write clkrt on the next command
*/ */
} else { } else {
pxamci_stop_clock(host); 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) { if (host->power_mode != ios->power_mode) {
...@@ -498,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev) ...@@ -498,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev)
host->mmc = mmc; host->mmc = mmc;
host->dma = -1; host->dma = -1;
host->pdata = pdev->dev.platform_data; host->pdata = pdev->dev.platform_data;
host->clkrt = CLKRT_OFF;
host->clk = clk_get(&pdev->dev, "MMCCLK"); host->clk = clk_get(&pdev->dev, "MMCCLK");
if (IS_ERR(host->clk)) { if (IS_ERR(host->clk)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment