diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-08-14 04:17:05 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-09-22 11:21:42 -0400 |
commit | 1c3be369c5fcd36c5d3841ca5d97d80ad34e76dd (patch) | |
tree | fe9bc8210743e71983151ea8a79f64a541dcce15 /drivers/mmc/host/mmci.c | |
parent | 92b97f0aaccbf9de4a29696e6253bf82e8850d1d (diff) |
PM: add runtime PM support to MMCI
Add runtime PM support to the MMCI primecell driver, making use of
the core primecell bus runtime PM support.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r-- | drivers/mmc/host/mmci.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 56e9a4168264..5e142b7f5ecf 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/dmaengine.h> | 29 | #include <linux/dmaengine.h> |
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | #include <linux/amba/mmci.h> | 31 | #include <linux/amba/mmci.h> |
32 | #include <linux/pm_runtime.h> | ||
32 | 33 | ||
33 | #include <asm/div64.h> | 34 | #include <asm/div64.h> |
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
@@ -170,6 +171,7 @@ mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) | |||
170 | * back into the driver... | 171 | * back into the driver... |
171 | */ | 172 | */ |
172 | spin_unlock(&host->lock); | 173 | spin_unlock(&host->lock); |
174 | pm_runtime_put(mmc_dev(host->mmc)); | ||
173 | mmc_request_done(host->mmc, mrq); | 175 | mmc_request_done(host->mmc, mrq); |
174 | spin_lock(&host->lock); | 176 | spin_lock(&host->lock); |
175 | } | 177 | } |
@@ -984,6 +986,8 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
984 | return; | 986 | return; |
985 | } | 987 | } |
986 | 988 | ||
989 | pm_runtime_get_sync(mmc_dev(mmc)); | ||
990 | |||
987 | spin_lock_irqsave(&host->lock, flags); | 991 | spin_lock_irqsave(&host->lock, flags); |
988 | 992 | ||
989 | host->mrq = mrq; | 993 | host->mrq = mrq; |
@@ -1327,6 +1331,8 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1327 | 1331 | ||
1328 | mmci_dma_setup(host); | 1332 | mmci_dma_setup(host); |
1329 | 1333 | ||
1334 | pm_runtime_put(&dev->dev); | ||
1335 | |||
1330 | mmc_add_host(mmc); | 1336 | mmc_add_host(mmc); |
1331 | 1337 | ||
1332 | return 0; | 1338 | return 0; |
@@ -1364,6 +1370,12 @@ static int __devexit mmci_remove(struct amba_device *dev) | |||
1364 | if (mmc) { | 1370 | if (mmc) { |
1365 | struct mmci_host *host = mmc_priv(mmc); | 1371 | struct mmci_host *host = mmc_priv(mmc); |
1366 | 1372 | ||
1373 | /* | ||
1374 | * Undo pm_runtime_put() in probe. We use the _sync | ||
1375 | * version here so that we can access the primecell. | ||
1376 | */ | ||
1377 | pm_runtime_get_sync(&dev->dev); | ||
1378 | |||
1367 | mmc_remove_host(mmc); | 1379 | mmc_remove_host(mmc); |
1368 | 1380 | ||
1369 | writel(0, host->base + MMCIMASK0); | 1381 | writel(0, host->base + MMCIMASK0); |