aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/Kconfig2
-rw-r--r--drivers/dma/shdma.c21
-rw-r--r--drivers/dma/shdma.h4
3 files changed, 13 insertions, 14 deletions
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index c27f80e5d531..9d8ca990dde6 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -128,7 +128,7 @@ config TXX9_DMAC
128 128
129config SH_DMAE 129config SH_DMAE
130 tristate "Renesas SuperH DMAC support" 130 tristate "Renesas SuperH DMAC support"
131 depends on SUPERH && SH_DMA 131 depends on (SUPERH && SH_DMA) || (ARM && ARCH_SHMOBILE)
132 depends on !SH_DMA_API 132 depends on !SH_DMA_API
133 select DMA_ENGINE 133 select DMA_ENGINE
134 help 134 help
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 7cc31b3f40d8..ed3ef22e68a4 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -26,8 +26,7 @@
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
29 29#include <linux/sh_dma.h>
30#include <asm/dmaengine.h>
31 30
32#include "shdma.h" 31#include "shdma.h"
33 32
@@ -45,7 +44,7 @@ enum sh_dmae_desc_status {
45#define LOG2_DEFAULT_XFER_SIZE 2 44#define LOG2_DEFAULT_XFER_SIZE 2
46 45
47/* A bitmask with bits enough for enum sh_dmae_slave_chan_id */ 46/* A bitmask with bits enough for enum sh_dmae_slave_chan_id */
48static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SHDMA_SLAVE_NUMBER)]; 47static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SH_DMA_SLAVE_NUMBER)];
49 48
50static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all); 49static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all);
51 50
@@ -267,7 +266,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
267} 266}
268 267
269static struct sh_dmae_slave_config *sh_dmae_find_slave( 268static struct sh_dmae_slave_config *sh_dmae_find_slave(
270 struct sh_dmae_chan *sh_chan, enum sh_dmae_slave_chan_id slave_id) 269 struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param)
271{ 270{
272 struct dma_device *dma_dev = sh_chan->common.device; 271 struct dma_device *dma_dev = sh_chan->common.device;
273 struct sh_dmae_device *shdev = container_of(dma_dev, 272 struct sh_dmae_device *shdev = container_of(dma_dev,
@@ -275,11 +274,11 @@ static struct sh_dmae_slave_config *sh_dmae_find_slave(
275 struct sh_dmae_pdata *pdata = shdev->pdata; 274 struct sh_dmae_pdata *pdata = shdev->pdata;
276 int i; 275 int i;
277 276
278 if ((unsigned)slave_id >= SHDMA_SLAVE_NUMBER) 277 if (param->slave_id >= SH_DMA_SLAVE_NUMBER)
279 return NULL; 278 return NULL;
280 279
281 for (i = 0; i < pdata->slave_num; i++) 280 for (i = 0; i < pdata->slave_num; i++)
282 if (pdata->slave[i].slave_id == slave_id) 281 if (pdata->slave[i].slave_id == param->slave_id)
283 return pdata->slave + i; 282 return pdata->slave + i;
284 283
285 return NULL; 284 return NULL;
@@ -300,7 +299,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
300 if (param) { 299 if (param) {
301 struct sh_dmae_slave_config *cfg; 300 struct sh_dmae_slave_config *cfg;
302 301
303 cfg = sh_dmae_find_slave(sh_chan, param->slave_id); 302 cfg = sh_dmae_find_slave(sh_chan, param);
304 if (!cfg) 303 if (!cfg)
305 return -EINVAL; 304 return -EINVAL;
306 305
@@ -795,7 +794,7 @@ static irqreturn_t sh_dmae_interrupt(int irq, void *data)
795 return ret; 794 return ret;
796} 795}
797 796
798#if defined(CONFIG_CPU_SH4) 797#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
799static irqreturn_t sh_dmae_err(int irq, void *data) 798static irqreturn_t sh_dmae_err(int irq, void *data)
800{ 799{
801 struct sh_dmae_device *shdev = (struct sh_dmae_device *)data; 800 struct sh_dmae_device *shdev = (struct sh_dmae_device *)data;
@@ -1036,7 +1035,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1036 /* Default transfer size of 32 bytes requires 32-byte alignment */ 1035 /* Default transfer size of 32 bytes requires 32-byte alignment */
1037 shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE; 1036 shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE;
1038 1037
1039#if defined(CONFIG_CPU_SH4) 1038#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
1040 chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1); 1039 chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
1041 1040
1042 if (!chanirq_res) 1041 if (!chanirq_res)
@@ -1061,7 +1060,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1061 1060
1062#else 1061#else
1063 chanirq_res = errirq_res; 1062 chanirq_res = errirq_res;
1064#endif /* CONFIG_CPU_SH4 */ 1063#endif /* CONFIG_CPU_SH4 || CONFIG_ARCH_SHMOBILE */
1065 1064
1066 if (chanirq_res->start == chanirq_res->end && 1065 if (chanirq_res->start == chanirq_res->end &&
1067 !platform_get_resource(pdev, IORESOURCE_IRQ, 1)) { 1066 !platform_get_resource(pdev, IORESOURCE_IRQ, 1)) {
@@ -1108,7 +1107,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
1108chan_probe_err: 1107chan_probe_err:
1109 sh_dmae_chan_remove(shdev); 1108 sh_dmae_chan_remove(shdev);
1110eirqres: 1109eirqres:
1111#if defined(CONFIG_CPU_SH4) 1110#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
1112 free_irq(errirq, shdev); 1111 free_irq(errirq, shdev);
1113eirq_err: 1112eirq_err:
1114#endif 1113#endif
diff --git a/drivers/dma/shdma.h b/drivers/dma/shdma.h
index 153609a1e96c..4021275a0a43 100644
--- a/drivers/dma/shdma.h
+++ b/drivers/dma/shdma.h
@@ -17,8 +17,8 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/list.h> 18#include <linux/list.h>
19 19
20#include <asm/dmaengine.h> 20#define SH_DMAC_MAX_CHANNELS 6
21 21#define SH_DMA_SLAVE_NUMBER 256
22#define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ 22#define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */
23 23
24struct device; 24struct device;