Commit 1c3be369 authored by Russell King's avatar Russell King

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 92b97f0a
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/amba/mmci.h> #include <linux/amba/mmci.h>
#include <linux/pm_runtime.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -170,6 +171,7 @@ mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) ...@@ -170,6 +171,7 @@ mmci_request_end(struct mmci_host *host, struct mmc_request *mrq)
* back into the driver... * back into the driver...
*/ */
spin_unlock(&host->lock); spin_unlock(&host->lock);
pm_runtime_put(mmc_dev(host->mmc));
mmc_request_done(host->mmc, mrq); mmc_request_done(host->mmc, mrq);
spin_lock(&host->lock); spin_lock(&host->lock);
} }
...@@ -984,6 +986,8 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -984,6 +986,8 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
return; return;
} }
pm_runtime_get_sync(mmc_dev(mmc));
spin_lock_irqsave(&host->lock, flags); spin_lock_irqsave(&host->lock, flags);
host->mrq = mrq; host->mrq = mrq;
...@@ -1327,6 +1331,8 @@ static int __devinit mmci_probe(struct amba_device *dev, ...@@ -1327,6 +1331,8 @@ static int __devinit mmci_probe(struct amba_device *dev,
mmci_dma_setup(host); mmci_dma_setup(host);
pm_runtime_put(&dev->dev);
mmc_add_host(mmc); mmc_add_host(mmc);
return 0; return 0;
...@@ -1364,6 +1370,12 @@ static int __devexit mmci_remove(struct amba_device *dev) ...@@ -1364,6 +1370,12 @@ static int __devexit mmci_remove(struct amba_device *dev)
if (mmc) { if (mmc) {
struct mmci_host *host = mmc_priv(mmc); struct mmci_host *host = mmc_priv(mmc);
/*
* Undo pm_runtime_put() in probe. We use the _sync
* version here so that we can access the primecell.
*/
pm_runtime_get_sync(&dev->dev);
mmc_remove_host(mmc); mmc_remove_host(mmc);
writel(0, host->base + MMCIMASK0); writel(0, host->base + MMCIMASK0);
......
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