aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/pl330.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 22:10:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 22:10:41 -0400
commitb7e97d22113bcaafff93774e3085f5b567eaba9c (patch)
tree1d3a13574310bde064fceb4408cf91a44c59c078 /drivers/dma/pl330.c
parent943c2acea53784c45fb291498d04d5188fdea891 (diff)
parentd0fc905429f7f5f3ad365466669c55b04b92c1e5 (diff)
Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine updates from Vinod Koul: "This time we have Andy updates on dw_dmac which is attempting to make this IP block available as PCI and platform device though not fully complete this time. We also have TI EDMA moving the dma driver to use dmaengine APIs, also have a new driver for mmp-tdma, along with bunch of small updates. Now for your excitement the merge is little unusual here, while merging the auto merge on linux-next picks wrong choice for pl330 (drivers/dma/pl330.c) and this causes build failure. The correct resolution is in linux-next. (DMA: PL330: Fix build error) I didn't back merge your tree this time as you are better than me so no point in doing that for me :)" Fixed the pl330 conflict as in linux-next, along with trivial header file conflicts due to changed includes. * 'next' of git://git.infradead.org/users/vkoul/slave-dma: (29 commits) dma: tegra: fix interrupt name issue with apb dma. dw_dmac: fix a regression in dwc_prep_dma_memcpy dw_dmac: introduce software emulation of LLP transfers dw_dmac: autoconfigure data_width or get it via platform data dw_dmac: autoconfigure block_size or use platform data dw_dmac: get number of channels from hardware if possible dw_dmac: fill optional encoded parameters in register structure dw_dmac: mark dwc_dump_chan_regs as inline DMA: PL330: return ENOMEM instead of 0 from pl330_alloc_chan_resources DMA: PL330: Remove redundant runtime_suspend/resume functions DMA: PL330: Remove controller clock enable/disable dmaengine: use kmem_cache_zalloc instead of kmem_cache_alloc/memset DMA: PL330: Set the capability of pdm0 and pdm1 as DMA_PRIVATE ARM: EXYNOS: Set the capability of pdm0 and pdm1 as DMA_PRIVATE dma: tegra: use list_move_tail instead of list_del/list_add_tail mxs/dma: Enlarge the CCW descriptor area to 4 pages dw_dmac: utilize slave_id to pass request line dmaengine: mmp_tdma: add dt support dmaengine: mmp-pdma support spi: davici - make davinci select edma ...
Diffstat (limited to 'drivers/dma/pl330.c')
-rw-r--r--drivers/dma/pl330.c78
1 files changed, 8 insertions, 70 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 169c0dbd71ae..665668b6f2b1 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -23,7 +23,6 @@
23#include <linux/dmaengine.h> 23#include <linux/dmaengine.h>
24#include <linux/amba/bus.h> 24#include <linux/amba/bus.h>
25#include <linux/amba/pl330.h> 25#include <linux/amba/pl330.h>
26#include <linux/pm_runtime.h>
27#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
28#include <linux/of.h> 27#include <linux/of.h>
29 28
@@ -586,8 +585,6 @@ struct dma_pl330_dmac {
586 585
587 /* Peripheral channels connected to this DMAC */ 586 /* Peripheral channels connected to this DMAC */
588 struct dma_pl330_chan *peripherals; /* keep at end */ 587 struct dma_pl330_chan *peripherals; /* keep at end */
589
590 struct clk *clk;
591}; 588};
592 589
593struct dma_pl330_desc { 590struct dma_pl330_desc {
@@ -2395,7 +2392,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
2395 pch->pl330_chid = pl330_request_channel(&pdmac->pif); 2392 pch->pl330_chid = pl330_request_channel(&pdmac->pif);
2396 if (!pch->pl330_chid) { 2393 if (!pch->pl330_chid) {
2397 spin_unlock_irqrestore(&pch->lock, flags); 2394 spin_unlock_irqrestore(&pch->lock, flags);
2398 return 0; 2395 return -ENOMEM;
2399 } 2396 }
2400 2397
2401 tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch); 2398 tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
@@ -2889,29 +2886,17 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2889 goto probe_err1; 2886 goto probe_err1;
2890 } 2887 }
2891 2888
2892 pdmac->clk = clk_get(&adev->dev, "dma");
2893 if (IS_ERR(pdmac->clk)) {
2894 dev_err(&adev->dev, "Cannot get operation clock.\n");
2895 ret = -EINVAL;
2896 goto probe_err2;
2897 }
2898
2899 amba_set_drvdata(adev, pdmac); 2889 amba_set_drvdata(adev, pdmac);
2900 2890
2901#ifndef CONFIG_PM_RUNTIME
2902 /* enable dma clk */
2903 clk_enable(pdmac->clk);
2904#endif
2905
2906 irq = adev->irq[0]; 2891 irq = adev->irq[0];
2907 ret = request_irq(irq, pl330_irq_handler, 0, 2892 ret = request_irq(irq, pl330_irq_handler, 0,
2908 dev_name(&adev->dev), pi); 2893 dev_name(&adev->dev), pi);
2909 if (ret) 2894 if (ret)
2910 goto probe_err3; 2895 goto probe_err2;
2911 2896
2912 ret = pl330_add(pi); 2897 ret = pl330_add(pi);
2913 if (ret) 2898 if (ret)
2914 goto probe_err4; 2899 goto probe_err3;
2915 2900
2916 INIT_LIST_HEAD(&pdmac->desc_pool); 2901 INIT_LIST_HEAD(&pdmac->desc_pool);
2917 spin_lock_init(&pdmac->pool_lock); 2902 spin_lock_init(&pdmac->pool_lock);
@@ -2933,7 +2918,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2933 if (!pdmac->peripherals) { 2918 if (!pdmac->peripherals) {
2934 ret = -ENOMEM; 2919 ret = -ENOMEM;
2935 dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n"); 2920 dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n");
2936 goto probe_err5; 2921 goto probe_err4;
2937 } 2922 }
2938 2923
2939 for (i = 0; i < num_chan; i++) { 2924 for (i = 0; i < num_chan; i++) {
@@ -2961,6 +2946,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2961 if (pi->pcfg.num_peri) { 2946 if (pi->pcfg.num_peri) {
2962 dma_cap_set(DMA_SLAVE, pd->cap_mask); 2947 dma_cap_set(DMA_SLAVE, pd->cap_mask);
2963 dma_cap_set(DMA_CYCLIC, pd->cap_mask); 2948 dma_cap_set(DMA_CYCLIC, pd->cap_mask);
2949 dma_cap_set(DMA_PRIVATE, pd->cap_mask);
2964 } 2950 }
2965 } 2951 }
2966 2952
@@ -2976,7 +2962,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2976 ret = dma_async_device_register(pd); 2962 ret = dma_async_device_register(pd);
2977 if (ret) { 2963 if (ret) {
2978 dev_err(&adev->dev, "unable to register DMAC\n"); 2964 dev_err(&adev->dev, "unable to register DMAC\n");
2979 goto probe_err5; 2965 goto probe_err4;
2980 } 2966 }
2981 2967
2982 dev_info(&adev->dev, 2968 dev_info(&adev->dev,
@@ -2989,15 +2975,10 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2989 2975
2990 return 0; 2976 return 0;
2991 2977
2992probe_err5:
2993 pl330_del(pi);
2994probe_err4: 2978probe_err4:
2995 free_irq(irq, pi); 2979 pl330_del(pi);
2996probe_err3: 2980probe_err3:
2997#ifndef CONFIG_PM_RUNTIME 2981 free_irq(irq, pi);
2998 clk_disable(pdmac->clk);
2999#endif
3000 clk_put(pdmac->clk);
3001probe_err2: 2982probe_err2:
3002 iounmap(pi->base); 2983 iounmap(pi->base);
3003probe_err1: 2984probe_err1:
@@ -3044,10 +3025,6 @@ static int __devexit pl330_remove(struct amba_device *adev)
3044 res = &adev->res; 3025 res = &adev->res;
3045 release_mem_region(res->start, resource_size(res)); 3026 release_mem_region(res->start, resource_size(res));
3046 3027
3047#ifndef CONFIG_PM_RUNTIME
3048 clk_disable(pdmac->clk);
3049#endif
3050
3051 kfree(pdmac); 3028 kfree(pdmac);
3052 3029
3053 return 0; 3030 return 0;
@@ -3063,49 +3040,10 @@ static struct amba_id pl330_ids[] = {
3063 3040
3064MODULE_DEVICE_TABLE(amba, pl330_ids); 3041MODULE_DEVICE_TABLE(amba, pl330_ids);
3065 3042
3066#ifdef CONFIG_PM_RUNTIME
3067static int pl330_runtime_suspend(struct device *dev)
3068{
3069 struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
3070
3071 if (!pdmac) {
3072 dev_err(dev, "failed to get dmac\n");
3073 return -ENODEV;
3074 }
3075
3076 clk_disable(pdmac->clk);
3077
3078 return 0;
3079}
3080
3081static int pl330_runtime_resume(struct device *dev)
3082{
3083 struct dma_pl330_dmac *pdmac = dev_get_drvdata(dev);
3084
3085 if (!pdmac) {
3086 dev_err(dev, "failed to get dmac\n");
3087 return -ENODEV;
3088 }
3089
3090 clk_enable(pdmac->clk);
3091
3092 return 0;
3093}
3094#else
3095#define pl330_runtime_suspend NULL
3096#define pl330_runtime_resume NULL
3097#endif /* CONFIG_PM_RUNTIME */
3098
3099static const struct dev_pm_ops pl330_pm_ops = {
3100 .runtime_suspend = pl330_runtime_suspend,
3101 .runtime_resume = pl330_runtime_resume,
3102};
3103
3104static struct amba_driver pl330_driver = { 3043static struct amba_driver pl330_driver = {
3105 .drv = { 3044 .drv = {
3106 .owner = THIS_MODULE, 3045 .owner = THIS_MODULE,
3107 .name = "dma-pl330", 3046 .name = "dma-pl330",
3108 .pm = &pl330_pm_ops,
3109 }, 3047 },
3110 .id_table = pl330_ids, 3048 .id_table = pl330_ids,
3111 .probe = pl330_probe, 3049 .probe = pl330_probe,