diff options
author | Daniel Mack <zonque@gmail.com> | 2013-09-22 16:50:04 +0200 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-10-07 07:41:39 +0530 |
commit | f97b98d6d02eea5301f86422ace06e5b53979a0c (patch) | |
tree | be49fd7ce74b5b8adad03c6df4890f0265737daa | |
parent | c95905a6a36858122afe1c334eba64499b39d7a2 (diff) | |
download | linux-stable-f97b98d6d02eea5301f86422ace06e5b53979a0c.tar.gz linux-stable-f97b98d6d02eea5301f86422ace06e5b53979a0c.tar.bz2 linux-stable-f97b98d6d02eea5301f86422ace06e5b53979a0c.zip |
dma: cppi41: add support for suspend and resume
This patch adds support for suspend/resume functionality to the cppi41
DMA driver. The steps necessary to make the system resume properly were
figured out by trial-and-error. The code as it stands now is the
minimum that has to be done to put the musb host system on an AM33xx
system into an operable state after resume.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/cppi41.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index d6897067e4cd..167c0223ae9e 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -1045,12 +1045,41 @@ static int cppi41_dma_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int cppi41_suspend(struct device *dev) +{ + struct cppi41_dd *cdd = dev_get_drvdata(dev); + + cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR); + disable_sched(cdd); + + return 0; +} + +static int cppi41_resume(struct device *dev) +{ + struct cppi41_dd *cdd = dev_get_drvdata(dev); + int i; + + for (i = 0; i < DESCS_AREAS; i++) + cppi_writel(cdd->descs_phys, cdd->qmgr_mem + QMGR_MEMBASE(i)); + + init_sched(cdd); + cppi_writel(USBSS_IRQ_PD_COMP, cdd->usbss_mem + USBSS_IRQ_ENABLER); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(cppi41_pm_ops, cppi41_suspend, cppi41_resume); + static struct platform_driver cpp41_dma_driver = { .probe = cppi41_dma_probe, .remove = cppi41_dma_remove, .driver = { .name = "cppi41-dma-engine", .owner = THIS_MODULE, + .pm = &cppi41_pm_ops, .of_match_table = of_match_ptr(cppi41_dma_ids), }, }; |