aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-21 20:06:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-21 20:06:22 -0500
commit97a229f90731894f46b85c20bcc1842f4a63cb78 (patch)
tree4c3e123eb1aab97b1d6c2e494b348b935414b84a
parentff58d005cd10fcd372787cceac547e11cf706ff6 (diff)
parent1ad651154b0dfccde5a83fafbe81cff19791f359 (diff)
Merge tag 'dmaengine-4.11-rc1' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine updates from Vinod Koul: "This time we fairly boring and bit small update. - Support for Intel iDMA 32-bit hardware - deprecate broken support for channel switching in async_tx - bunch of updates on stm32-dma - Cyclic support for zx dma and making in generic zx dma driver - Small updates to bunch of other drivers" * tag 'dmaengine-4.11-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (29 commits) async_tx: deprecate broken support for channel switching dmaengine: rcar-dmac: Widen DMA mask to 40 bits dmaengine: sun6i: allow build on ARM64 platforms (sun50i) dmaengine: Provide a wrapper for memcpy operations dmaengine: zx: fix build warning dmaengine: dw: we do support Merrifield SoC in PCI mode dmaengine: dw: add support of iDMA 32-bit hardware dmaengine: dw: introduce register mappings for iDMA 32-bit dmaengine: dw: introduce block2bytes() and bytes2block() dmaengine: dw: extract dwc_chan_pause() for future use dmaengine: dw: replace convert_burst() with one liner dmaengine: dw: register IRQ and DMA pool with instance ID dmaengine: dw: Fix data corruption in large device to memory transfers dmaengine: ste_dma40: indicate granularity on channels dmaengine: ste_dma40: indicate directions on channels dmaengine: stm32-dma: Add error messages if xlate fails dmaengine: dw: pci: remove LPE Audio DMA ID dmaengine: stm32-dma: Add max_burst support dmaengine: stm32-dma: Add synchronization support dmaengine: stm32-dma: Fix residue computation issue in cyclic mode ...
-rw-r--r--Documentation/ABI/testing/sysfs-platform-hidma2
-rw-r--r--Documentation/ABI/testing/sysfs-platform-hidma-mgmt20
-rw-r--r--Documentation/devicetree/bindings/dma/stm32-dma.txt5
-rw-r--r--drivers/dma/Kconfig8
-rw-r--r--drivers/dma/Makefile2
-rw-r--r--drivers/dma/dmaengine.c21
-rw-r--r--drivers/dma/dw/core.c211
-rw-r--r--drivers/dma/dw/pci.c19
-rw-r--r--drivers/dma/dw/platform.c1
-rw-r--r--drivers/dma/dw/regs.h59
-rw-r--r--drivers/dma/ipu/ipu_irq.c2
-rw-r--r--drivers/dma/sh/rcar-dmac.c1
-rw-r--r--drivers/dma/ste_dma40.c7
-rw-r--r--drivers/dma/stm32-dma.c88
-rw-r--r--drivers/dma/zx_dma.c (renamed from drivers/dma/zx296702_dma.c)6
-rw-r--r--include/linux/async_tx.h2
-rw-r--r--include/linux/dma/dw.h2
-rw-r--r--include/linux/dmaengine.h11
-rw-r--r--include/linux/platform_data/dma-dw.h2
19 files changed, 338 insertions, 131 deletions
diff --git a/Documentation/ABI/testing/sysfs-platform-hidma b/Documentation/ABI/testing/sysfs-platform-hidma
index d36441538660..fca40a54df59 100644
--- a/Documentation/ABI/testing/sysfs-platform-hidma
+++ b/Documentation/ABI/testing/sysfs-platform-hidma
@@ -2,7 +2,7 @@ What: /sys/devices/platform/hidma-*/chid
2 /sys/devices/platform/QCOM8061:*/chid 2 /sys/devices/platform/QCOM8061:*/chid
3Date: Dec 2015 3Date: Dec 2015
4KernelVersion: 4.4 4KernelVersion: 4.4
5Contact: "Sinan Kaya <okaya@cudeaurora.org>" 5Contact: "Sinan Kaya <okaya@codeaurora.org>"
6Description: 6Description:
7 Contains the ID of the channel within the HIDMA instance. 7 Contains the ID of the channel within the HIDMA instance.
8 It is used to associate a given HIDMA channel with the 8 It is used to associate a given HIDMA channel with the
diff --git a/Documentation/ABI/testing/sysfs-platform-hidma-mgmt b/Documentation/ABI/testing/sysfs-platform-hidma-mgmt
index c2fb5d033f0e..3b6c5c9eabdc 100644
--- a/Documentation/ABI/testing/sysfs-platform-hidma-mgmt
+++ b/Documentation/ABI/testing/sysfs-platform-hidma-mgmt
@@ -2,7 +2,7 @@ What: /sys/devices/platform/hidma-mgmt*/chanops/chan*/priority
2 /sys/devices/platform/QCOM8060:*/chanops/chan*/priority 2 /sys/devices/platform/QCOM8060:*/chanops/chan*/priority
3Date: Nov 2015 3Date: Nov 2015
4KernelVersion: 4.4 4KernelVersion: 4.4
5Contact: "Sinan Kaya <okaya@cudeaurora.org>" 5Contact: "Sinan Kaya <okaya@codeaurora.org>"
6Description: 6Description:
7 Contains either 0 or 1 and indicates if the DMA channel is a 7 Contains either 0 or 1 and indicates if the DMA channel is a
8 low priority (0) or high priority (1) channel. 8 low priority (0) or high priority (1) channel.
@@ -11,7 +11,7 @@ What: /sys/devices/platform/hidma-mgmt*/chanops/chan*/weight
11 /sys/devices/platform/QCOM8060:*/chanops/chan*/weight 11 /sys/devices/platform/QCOM8060:*/chanops/chan*/weight
12Date: Nov 2015 12Date: Nov 2015
13KernelVersion: 4.4 13KernelVersion: 4.4
14Contact: "Sinan Kaya <okaya@cudeaurora.org>" 14Contact: "Sinan Kaya <okaya@codeaurora.org>"
15Description: 15Description:
16 Contains 0..15 and indicates the weight of the channel among 16 Contains 0..15 and indicates the weight of the channel among
17 equal priority channels during round robin scheduling. 17 equal priority channels during round robin scheduling.
@@ -20,7 +20,7 @@ What: /sys/devices/platform/hidma-mgmt*/chreset_timeout_cycles
20 /sys/devices/platform/QCOM8060:*/chreset_timeout_cycles 20 /sys/devices/platform/QCOM8060:*/chreset_timeout_cycles
21Date: Nov 2015 21Date: Nov 2015
22KernelVersion: 4.4 22KernelVersion: 4.4
23Contact: "Sinan Kaya <okaya@cudeaurora.org>" 23Contact: "Sinan Kaya <okaya@codeaurora.org>"
24Description: 24Description:
25 Contains the platform specific cycle value to wait after a 25 Contains the platform specific cycle value to wait after a
26 reset command is issued. If the value is chosen too short, 26 reset command is issued. If the value is chosen too short,
@@ -32,7 +32,7 @@ What: /sys/devices/platform/hidma-mgmt*/dma_channels
32 /sys/devices/platform/QCOM8060:*/dma_channels 32 /sys/devices/platform/QCOM8060:*/dma_channels
33Date: Nov 2015 33Date: Nov 2015
34KernelVersion: 4.4 34KernelVersion: 4.4
35Contact: "Sinan Kaya <okaya@cudeaurora.org>" 35Contact: "Sinan Kaya <okaya@codeaurora.org>"
36Description: 36Description:
37 Contains the number of dma channels supported by one instance 37 Contains the number of dma channels supported by one instance
38 of HIDMA hardware. The value may change from chip to chip. 38 of HIDMA hardware. The value may change from chip to chip.
@@ -41,7 +41,7 @@ What: /sys/devices/platform/hidma-mgmt*/hw_version_major
41 /sys/devices/platform/QCOM8060:*/hw_version_major 41 /sys/devices/platform/QCOM8060:*/hw_version_major
42Date: Nov 2015 42Date: Nov 2015
43KernelVersion: 4.4 43KernelVersion: 4.4
44Contact: "Sinan Kaya <okaya@cudeaurora.org>" 44Contact: "Sinan Kaya <okaya@codeaurora.org>"
45Description: 45Description:
46 Version number major for the hardware. 46 Version number major for the hardware.
47 47
@@ -49,7 +49,7 @@ What: /sys/devices/platform/hidma-mgmt*/hw_version_minor
49 /sys/devices/platform/QCOM8060:*/hw_version_minor 49 /sys/devices/platform/QCOM8060:*/hw_version_minor
50Date: Nov 2015 50Date: Nov 2015
51KernelVersion: 4.4 51KernelVersion: 4.4
52Contact: "Sinan Kaya <okaya@cudeaurora.org>" 52Contact: "Sinan Kaya <okaya@codeaurora.org>"
53Description: 53Description:
54 Version number minor for the hardware. 54 Version number minor for the hardware.
55 55
@@ -57,7 +57,7 @@ What: /sys/devices/platform/hidma-mgmt*/max_rd_xactions
57 /sys/devices/platform/QCOM8060:*/max_rd_xactions 57 /sys/devices/platform/QCOM8060:*/max_rd_xactions
58Date: Nov 2015 58Date: Nov 2015
59KernelVersion: 4.4 59KernelVersion: 4.4
60Contact: "Sinan Kaya <okaya@cudeaurora.org>" 60Contact: "Sinan Kaya <okaya@codeaurora.org>"
61Description: 61Description:
62 Contains a value between 0 and 31. Maximum number of 62 Contains a value between 0 and 31. Maximum number of
63 read transactions that can be issued back to back. 63 read transactions that can be issued back to back.
@@ -69,7 +69,7 @@ What: /sys/devices/platform/hidma-mgmt*/max_read_request
69 /sys/devices/platform/QCOM8060:*/max_read_request 69 /sys/devices/platform/QCOM8060:*/max_read_request
70Date: Nov 2015 70Date: Nov 2015
71KernelVersion: 4.4 71KernelVersion: 4.4
72Contact: "Sinan Kaya <okaya@cudeaurora.org>" 72Contact: "Sinan Kaya <okaya@codeaurora.org>"
73Description: 73Description:
74 Size of each read request. The value needs to be a power 74 Size of each read request. The value needs to be a power
75 of two and can be between 128 and 1024. 75 of two and can be between 128 and 1024.
@@ -78,7 +78,7 @@ What: /sys/devices/platform/hidma-mgmt*/max_wr_xactions
78 /sys/devices/platform/QCOM8060:*/max_wr_xactions 78 /sys/devices/platform/QCOM8060:*/max_wr_xactions
79Date: Nov 2015 79Date: Nov 2015
80KernelVersion: 4.4 80KernelVersion: 4.4
81Contact: "Sinan Kaya <okaya@cudeaurora.org>" 81Contact: "Sinan Kaya <okaya@codeaurora.org>"
82Description: 82Description:
83 Contains a value between 0 and 31. Maximum number of 83 Contains a value between 0 and 31. Maximum number of
84 write transactions that can be issued back to back. 84 write transactions that can be issued back to back.
@@ -91,7 +91,7 @@ What: /sys/devices/platform/hidma-mgmt*/max_write_request
91 /sys/devices/platform/QCOM8060:*/max_write_request 91 /sys/devices/platform/QCOM8060:*/max_write_request
92Date: Nov 2015 92Date: Nov 2015
93KernelVersion: 4.4 93KernelVersion: 4.4
94Contact: "Sinan Kaya <okaya@cudeaurora.org>" 94Contact: "Sinan Kaya <okaya@codeaurora.org>"
95Description: 95Description:
96 Size of each write request. The value needs to be a power 96 Size of each write request. The value needs to be a power
97 of two and can be between 128 and 1024. 97 of two and can be between 128 and 1024.
diff --git a/Documentation/devicetree/bindings/dma/stm32-dma.txt b/Documentation/devicetree/bindings/dma/stm32-dma.txt
index 70cd13f1588a..4408af693d0c 100644
--- a/Documentation/devicetree/bindings/dma/stm32-dma.txt
+++ b/Documentation/devicetree/bindings/dma/stm32-dma.txt
@@ -40,8 +40,7 @@ Example:
40 40
41DMA clients connected to the STM32 DMA controller must use the format 41DMA clients connected to the STM32 DMA controller must use the format
42described in the dma.txt file, using a five-cell specifier for each 42described in the dma.txt file, using a five-cell specifier for each
43channel: a phandle plus four integer cells. 43channel: a phandle to the DMA controller plus the following four integer cells:
44The four cells in order are:
45 44
461. The channel id 451. The channel id
472. The request line number 462. The request line number
@@ -61,7 +60,7 @@ The four cells in order are:
61 0x1: medium 60 0x1: medium
62 0x2: high 61 0x2: high
63 0x3: very high 62 0x3: very high
645. A 32bit mask specifying the DMA FIFO threshold configuration which are device 634. A 32bit mask specifying the DMA FIFO threshold configuration which are device
65 dependent: 64 dependent:
66 -bit 0-1: Fifo threshold 65 -bit 0-1: Fifo threshold
67 0x0: 1/4 full FIFO 66 0x0: 1/4 full FIFO
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 263495d0adbd..d01d59812cf3 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -157,7 +157,7 @@ config DMA_SUN4I
157 157
158config DMA_SUN6I 158config DMA_SUN6I
159 tristate "Allwinner A31 SoCs DMA support" 159 tristate "Allwinner A31 SoCs DMA support"
160 depends on MACH_SUN6I || MACH_SUN8I || COMPILE_TEST 160 depends on MACH_SUN6I || MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST
161 depends on RESET_CONTROLLER 161 depends on RESET_CONTROLLER
162 select DMA_ENGINE 162 select DMA_ENGINE
163 select DMA_VIRTUAL_CHANNELS 163 select DMA_VIRTUAL_CHANNELS
@@ -458,7 +458,7 @@ config STM32_DMA
458 help 458 help
459 Enable support for the on-chip DMA controller on STMicroelectronics 459 Enable support for the on-chip DMA controller on STMicroelectronics
460 STM32 MCUs. 460 STM32 MCUs.
461 If you have a board based on such a MCU and wish to use DMA say Y or M 461 If you have a board based on such a MCU and wish to use DMA say Y
462 here. 462 here.
463 463
464config S3C24XX_DMAC 464config S3C24XX_DMAC
@@ -571,12 +571,12 @@ config XILINX_ZYNQMP_DMA
571 Enable support for Xilinx ZynqMP DMA controller. 571 Enable support for Xilinx ZynqMP DMA controller.
572 572
573config ZX_DMA 573config ZX_DMA
574 tristate "ZTE ZX296702 DMA support" 574 tristate "ZTE ZX DMA support"
575 depends on ARCH_ZX || COMPILE_TEST 575 depends on ARCH_ZX || COMPILE_TEST
576 select DMA_ENGINE 576 select DMA_ENGINE
577 select DMA_VIRTUAL_CHANNELS 577 select DMA_VIRTUAL_CHANNELS
578 help 578 help
579 Support the DMA engine for ZTE ZX296702 platform devices. 579 Support the DMA engine for ZTE ZX family platform devices.
580 580
581 581
582# driver files 582# driver files
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index a4fa3360e609..0b723e94d9e6 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -66,7 +66,7 @@ obj-$(CONFIG_TI_CPPI41) += cppi41.o
66obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o 66obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o
67obj-$(CONFIG_TI_EDMA) += edma.o 67obj-$(CONFIG_TI_EDMA) += edma.o
68obj-$(CONFIG_XGENE_DMA) += xgene-dma.o 68obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
69obj-$(CONFIG_ZX_DMA) += zx296702_dma.o 69obj-$(CONFIG_ZX_DMA) += zx_dma.o
70obj-$(CONFIG_ST_FDMA) += st_fdma.o 70obj-$(CONFIG_ST_FDMA) += st_fdma.o
71 71
72obj-y += qcom/ 72obj-y += qcom/
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 6b535262ac5d..24e0221fd66d 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -65,7 +65,7 @@
65#include <linux/mempool.h> 65#include <linux/mempool.h>
66 66
67static DEFINE_MUTEX(dma_list_mutex); 67static DEFINE_MUTEX(dma_list_mutex);
68static DEFINE_IDR(dma_idr); 68static DEFINE_IDA(dma_ida);
69static LIST_HEAD(dma_device_list); 69static LIST_HEAD(dma_device_list);
70static long dmaengine_ref_count; 70static long dmaengine_ref_count;
71 71
@@ -162,7 +162,7 @@ static void chan_dev_release(struct device *dev)
162 chan_dev = container_of(dev, typeof(*chan_dev), device); 162 chan_dev = container_of(dev, typeof(*chan_dev), device);
163 if (atomic_dec_and_test(chan_dev->idr_ref)) { 163 if (atomic_dec_and_test(chan_dev->idr_ref)) {
164 mutex_lock(&dma_list_mutex); 164 mutex_lock(&dma_list_mutex);
165 idr_remove(&dma_idr, chan_dev->dev_id); 165 ida_remove(&dma_ida, chan_dev->dev_id);
166 mutex_unlock(&dma_list_mutex); 166 mutex_unlock(&dma_list_mutex);
167 kfree(chan_dev->idr_ref); 167 kfree(chan_dev->idr_ref);
168 } 168 }
@@ -898,14 +898,15 @@ static int get_dma_id(struct dma_device *device)
898{ 898{
899 int rc; 899 int rc;
900 900
901 mutex_lock(&dma_list_mutex); 901 do {
902 902 if (!ida_pre_get(&dma_ida, GFP_KERNEL))
903 rc = idr_alloc(&dma_idr, NULL, 0, 0, GFP_KERNEL); 903 return -ENOMEM;
904 if (rc >= 0) 904 mutex_lock(&dma_list_mutex);
905 device->dev_id = rc; 905 rc = ida_get_new(&dma_ida, &device->dev_id);
906 mutex_unlock(&dma_list_mutex);
907 } while (rc == -EAGAIN);
906 908
907 mutex_unlock(&dma_list_mutex); 909 return rc;
908 return rc < 0 ? rc : 0;
909} 910}
910 911
911/** 912/**
@@ -1035,7 +1036,7 @@ err_out:
1035 /* if we never registered a channel just release the idr */ 1036 /* if we never registered a channel just release the idr */
1036 if (atomic_read(idr_ref) == 0) { 1037 if (atomic_read(idr_ref) == 0) {
1037 mutex_lock(&dma_list_mutex); 1038 mutex_lock(&dma_list_mutex);
1038 idr_remove(&dma_idr, device->dev_id); 1039 ida_remove(&dma_ida, device->dev_id);
1039 mutex_unlock(&dma_list_mutex); 1040 mutex_unlock(&dma_list_mutex);
1040 kfree(idr_ref); 1041 kfree(idr_ref);
1041 return rc; 1042 return rc;
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index e5adf5d1c34f..e500950dad82 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -138,16 +138,32 @@ static void dwc_desc_put(struct dw_dma_chan *dwc, struct dw_desc *desc)
138 dwc->descs_allocated--; 138 dwc->descs_allocated--;
139} 139}
140 140
141static void dwc_initialize(struct dw_dma_chan *dwc) 141static void dwc_initialize_chan_idma32(struct dw_dma_chan *dwc)
142{
143 u32 cfghi = 0;
144 u32 cfglo = 0;
145
146 /* Set default burst alignment */
147 cfglo |= IDMA32C_CFGL_DST_BURST_ALIGN | IDMA32C_CFGL_SRC_BURST_ALIGN;
148
149 /* Low 4 bits of the request lines */
150 cfghi |= IDMA32C_CFGH_DST_PER(dwc->dws.dst_id & 0xf);
151 cfghi |= IDMA32C_CFGH_SRC_PER(dwc->dws.src_id & 0xf);
152
153 /* Request line extension (2 bits) */
154 cfghi |= IDMA32C_CFGH_DST_PER_EXT(dwc->dws.dst_id >> 4 & 0x3);
155 cfghi |= IDMA32C_CFGH_SRC_PER_EXT(dwc->dws.src_id >> 4 & 0x3);
156
157 channel_writel(dwc, CFG_LO, cfglo);
158 channel_writel(dwc, CFG_HI, cfghi);
159}
160
161static void dwc_initialize_chan_dw(struct dw_dma_chan *dwc)
142{ 162{
143 struct dw_dma *dw = to_dw_dma(dwc->chan.device);
144 u32 cfghi = DWC_CFGH_FIFO_MODE; 163 u32 cfghi = DWC_CFGH_FIFO_MODE;
145 u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority); 164 u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority);
146 bool hs_polarity = dwc->dws.hs_polarity; 165 bool hs_polarity = dwc->dws.hs_polarity;
147 166
148 if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags))
149 return;
150
151 cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id); 167 cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id);
152 cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id); 168 cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id);
153 169
@@ -156,6 +172,19 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
156 172
157 channel_writel(dwc, CFG_LO, cfglo); 173 channel_writel(dwc, CFG_LO, cfglo);
158 channel_writel(dwc, CFG_HI, cfghi); 174 channel_writel(dwc, CFG_HI, cfghi);
175}
176
177static void dwc_initialize(struct dw_dma_chan *dwc)
178{
179 struct dw_dma *dw = to_dw_dma(dwc->chan.device);
180
181 if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags))
182 return;
183
184 if (dw->pdata->is_idma32)
185 dwc_initialize_chan_idma32(dwc);
186 else
187 dwc_initialize_chan_dw(dwc);
159 188
160 /* Enable interrupts */ 189 /* Enable interrupts */
161 channel_set_bit(dw, MASK.XFER, dwc->mask); 190 channel_set_bit(dw, MASK.XFER, dwc->mask);
@@ -184,6 +213,37 @@ static inline void dwc_chan_disable(struct dw_dma *dw, struct dw_dma_chan *dwc)
184 cpu_relax(); 213 cpu_relax();
185} 214}
186 215
216static u32 bytes2block(struct dw_dma_chan *dwc, size_t bytes,
217 unsigned int width, size_t *len)
218{
219 struct dw_dma *dw = to_dw_dma(dwc->chan.device);
220 u32 block;
221
222 /* Always in bytes for iDMA 32-bit */
223 if (dw->pdata->is_idma32)
224 width = 0;
225
226 if ((bytes >> width) > dwc->block_size) {
227 block = dwc->block_size;
228 *len = block << width;
229 } else {
230 block = bytes >> width;
231 *len = bytes;
232 }
233
234 return block;
235}
236
237static size_t block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width)
238{
239 struct dw_dma *dw = to_dw_dma(dwc->chan.device);
240
241 if (dw->pdata->is_idma32)
242 return IDMA32C_CTLH_BLOCK_TS(block);
243
244 return DWC_CTLH_BLOCK_TS(block) << width;
245}
246
187/*----------------------------------------------------------------------*/ 247/*----------------------------------------------------------------------*/
188 248
189/* Perform single block transfer */ 249/* Perform single block transfer */
@@ -332,7 +392,7 @@ static inline u32 dwc_get_sent(struct dw_dma_chan *dwc)
332 u32 ctlhi = channel_readl(dwc, CTL_HI); 392 u32 ctlhi = channel_readl(dwc, CTL_HI);
333 u32 ctllo = channel_readl(dwc, CTL_LO); 393 u32 ctllo = channel_readl(dwc, CTL_LO);
334 394
335 return (ctlhi & DWC_CTLH_BLOCK_TS_MASK) * (1 << (ctllo >> 4 & 7)); 395 return block2bytes(dwc, ctlhi, ctllo >> 4 & 7);
336} 396}
337 397
338static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) 398static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
@@ -692,10 +752,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
692 | DWC_CTLL_FC_M2M; 752 | DWC_CTLL_FC_M2M;
693 prev = first = NULL; 753 prev = first = NULL;
694 754
695 for (offset = 0; offset < len; offset += xfer_count << src_width) { 755 for (offset = 0; offset < len; offset += xfer_count) {
696 xfer_count = min_t(size_t, (len - offset) >> src_width,
697 dwc->block_size);
698
699 desc = dwc_desc_get(dwc); 756 desc = dwc_desc_get(dwc);
700 if (!desc) 757 if (!desc)
701 goto err_desc_get; 758 goto err_desc_get;
@@ -703,8 +760,8 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
703 lli_write(desc, sar, src + offset); 760 lli_write(desc, sar, src + offset);
704 lli_write(desc, dar, dest + offset); 761 lli_write(desc, dar, dest + offset);
705 lli_write(desc, ctllo, ctllo); 762 lli_write(desc, ctllo, ctllo);
706 lli_write(desc, ctlhi, xfer_count); 763 lli_write(desc, ctlhi, bytes2block(dwc, len - offset, src_width, &xfer_count));
707 desc->len = xfer_count << src_width; 764 desc->len = xfer_count;
708 765
709 if (!first) { 766 if (!first) {
710 first = desc; 767 first = desc;
@@ -775,7 +832,8 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
775 832
776 for_each_sg(sgl, sg, sg_len, i) { 833 for_each_sg(sgl, sg, sg_len, i) {
777 struct dw_desc *desc; 834 struct dw_desc *desc;
778 u32 len, dlen, mem; 835 u32 len, mem;
836 size_t dlen;
779 837
780 mem = sg_dma_address(sg); 838 mem = sg_dma_address(sg);
781 len = sg_dma_len(sg); 839 len = sg_dma_len(sg);
@@ -789,17 +847,8 @@ slave_sg_todev_fill_desc:
789 847
790 lli_write(desc, sar, mem); 848 lli_write(desc, sar, mem);
791 lli_write(desc, dar, reg); 849 lli_write(desc, dar, reg);
850 lli_write(desc, ctlhi, bytes2block(dwc, len, mem_width, &dlen));
792 lli_write(desc, ctllo, ctllo | DWC_CTLL_SRC_WIDTH(mem_width)); 851 lli_write(desc, ctllo, ctllo | DWC_CTLL_SRC_WIDTH(mem_width));
793 if ((len >> mem_width) > dwc->block_size) {
794 dlen = dwc->block_size << mem_width;
795 mem += dlen;
796 len -= dlen;
797 } else {
798 dlen = len;
799 len = 0;
800 }
801
802 lli_write(desc, ctlhi, dlen >> mem_width);
803 desc->len = dlen; 852 desc->len = dlen;
804 853
805 if (!first) { 854 if (!first) {
@@ -809,6 +858,9 @@ slave_sg_todev_fill_desc:
809 list_add_tail(&desc->desc_node, &first->tx_list); 858 list_add_tail(&desc->desc_node, &first->tx_list);
810 } 859 }
811 prev = desc; 860 prev = desc;
861
862 mem += dlen;
863 len -= dlen;
812 total_len += dlen; 864 total_len += dlen;
813 865
814 if (len) 866 if (len)
@@ -828,13 +880,12 @@ slave_sg_todev_fill_desc:
828 880
829 for_each_sg(sgl, sg, sg_len, i) { 881 for_each_sg(sgl, sg, sg_len, i) {
830 struct dw_desc *desc; 882 struct dw_desc *desc;
831 u32 len, dlen, mem; 883 u32 len, mem;
884 size_t dlen;
832 885
833 mem = sg_dma_address(sg); 886 mem = sg_dma_address(sg);
834 len = sg_dma_len(sg); 887 len = sg_dma_len(sg);
835 888
836 mem_width = __ffs(data_width | mem | len);
837
838slave_sg_fromdev_fill_desc: 889slave_sg_fromdev_fill_desc:
839 desc = dwc_desc_get(dwc); 890 desc = dwc_desc_get(dwc);
840 if (!desc) 891 if (!desc)
@@ -842,16 +893,9 @@ slave_sg_fromdev_fill_desc:
842 893
843 lli_write(desc, sar, reg); 894 lli_write(desc, sar, reg);
844 lli_write(desc, dar, mem); 895 lli_write(desc, dar, mem);
896 lli_write(desc, ctlhi, bytes2block(dwc, len, reg_width, &dlen));
897 mem_width = __ffs(data_width | mem | dlen);
845 lli_write(desc, ctllo, ctllo | DWC_CTLL_DST_WIDTH(mem_width)); 898 lli_write(desc, ctllo, ctllo | DWC_CTLL_DST_WIDTH(mem_width));
846 if ((len >> reg_width) > dwc->block_size) {
847 dlen = dwc->block_size << reg_width;
848 mem += dlen;
849 len -= dlen;
850 } else {
851 dlen = len;
852 len = 0;
853 }
854 lli_write(desc, ctlhi, dlen >> reg_width);
855 desc->len = dlen; 899 desc->len = dlen;
856 900
857 if (!first) { 901 if (!first) {
@@ -861,6 +905,9 @@ slave_sg_fromdev_fill_desc:
861 list_add_tail(&desc->desc_node, &first->tx_list); 905 list_add_tail(&desc->desc_node, &first->tx_list);
862 } 906 }
863 prev = desc; 907 prev = desc;
908
909 mem += dlen;
910 len -= dlen;
864 total_len += dlen; 911 total_len += dlen;
865 912
866 if (len) 913 if (len)
@@ -903,25 +950,20 @@ bool dw_dma_filter(struct dma_chan *chan, void *param)
903} 950}
904EXPORT_SYMBOL_GPL(dw_dma_filter); 951EXPORT_SYMBOL_GPL(dw_dma_filter);
905 952
906/*
907 * Fix sconfig's burst size according to dw_dmac. We need to convert them as:
908 * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
909 *
910 * NOTE: burst size 2 is not supported by controller.
911 *
912 * This can be done by finding least significant bit set: n & (n - 1)
913 */
914static inline void convert_burst(u32 *maxburst)
915{
916 if (*maxburst > 1)
917 *maxburst = fls(*maxburst) - 2;
918 else
919 *maxburst = 0;
920}
921
922static int dwc_config(struct dma_chan *chan, struct dma_slave_config *sconfig) 953static int dwc_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
923{ 954{
924 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 955 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
956 struct dma_slave_config *sc = &dwc->dma_sconfig;
957 struct dw_dma *dw = to_dw_dma(chan->device);
958 /*
959 * Fix sconfig's burst size according to dw_dmac. We need to convert
960 * them as:
961 * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
962 *
963 * NOTE: burst size 2 is not supported by DesignWare controller.
964 * iDMA 32-bit supports it.
965 */
966 u32 s = dw->pdata->is_idma32 ? 1 : 2;
925 967
926 /* Check if chan will be configured for slave transfers */ 968 /* Check if chan will be configured for slave transfers */
927 if (!is_slave_direction(sconfig->direction)) 969 if (!is_slave_direction(sconfig->direction))
@@ -930,28 +972,39 @@ static int dwc_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
930 memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig)); 972 memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig));
931 dwc->direction = sconfig->direction; 973 dwc->direction = sconfig->direction;
932 974
933 convert_burst(&dwc->dma_sconfig.src_maxburst); 975 sc->src_maxburst = sc->src_maxburst > 1 ? fls(sc->src_maxburst) - s : 0;
934 convert_burst(&dwc->dma_sconfig.dst_maxburst); 976 sc->dst_maxburst = sc->dst_maxburst > 1 ? fls(sc->dst_maxburst) - s : 0;
935 977
936 return 0; 978 return 0;
937} 979}
938 980
939static int dwc_pause(struct dma_chan *chan) 981static void dwc_chan_pause(struct dw_dma_chan *dwc, bool drain)
940{ 982{
941 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 983 struct dw_dma *dw = to_dw_dma(dwc->chan.device);
942 unsigned long flags;
943 unsigned int count = 20; /* timeout iterations */ 984 unsigned int count = 20; /* timeout iterations */
944 u32 cfglo; 985 u32 cfglo;
945 986
946 spin_lock_irqsave(&dwc->lock, flags);
947
948 cfglo = channel_readl(dwc, CFG_LO); 987 cfglo = channel_readl(dwc, CFG_LO);
988 if (dw->pdata->is_idma32) {
989 if (drain)
990 cfglo |= IDMA32C_CFGL_CH_DRAIN;
991 else
992 cfglo &= ~IDMA32C_CFGL_CH_DRAIN;
993 }
949 channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP); 994 channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP);
950 while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY) && count--) 995 while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY) && count--)
951 udelay(2); 996 udelay(2);
952 997
953 set_bit(DW_DMA_IS_PAUSED, &dwc->flags); 998 set_bit(DW_DMA_IS_PAUSED, &dwc->flags);
999}
954 1000
1001static int dwc_pause(struct dma_chan *chan)
1002{
1003 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
1004 unsigned long flags;
1005
1006 spin_lock_irqsave(&dwc->lock, flags);
1007 dwc_chan_pause(dwc, false);
955 spin_unlock_irqrestore(&dwc->lock, flags); 1008 spin_unlock_irqrestore(&dwc->lock, flags);
956 1009
957 return 0; 1010 return 0;
@@ -993,6 +1046,8 @@ static int dwc_terminate_all(struct dma_chan *chan)
993 1046
994 clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags); 1047 clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags);
995 1048
1049 dwc_chan_pause(dwc, true);
1050
996 dwc_chan_disable(dw, dwc); 1051 dwc_chan_disable(dw, dwc);
997 1052
998 dwc_chan_resume(dwc); 1053 dwc_chan_resume(dwc);
@@ -1085,6 +1140,32 @@ static void dwc_issue_pending(struct dma_chan *chan)
1085 1140
1086/*----------------------------------------------------------------------*/ 1141/*----------------------------------------------------------------------*/
1087 1142
1143/*
1144 * Program FIFO size of channels.
1145 *
1146 * By default full FIFO (1024 bytes) is assigned to channel 0. Here we
1147 * slice FIFO on equal parts between channels.
1148 */
1149static void idma32_fifo_partition(struct dw_dma *dw)
1150{
1151 u64 value = IDMA32C_FP_PSIZE_CH0(128) | IDMA32C_FP_PSIZE_CH1(128) |
1152 IDMA32C_FP_UPDATE;
1153 u64 fifo_partition = 0;
1154
1155 if (!dw->pdata->is_idma32)
1156 return;
1157
1158 /* Fill FIFO_PARTITION low bits (Channels 0..1, 4..5) */
1159 fifo_partition |= value << 0;
1160
1161 /* Fill FIFO_PARTITION high bits (Channels 2..3, 6..7) */
1162 fifo_partition |= value << 32;
1163
1164 /* Program FIFO Partition registers - 128 bytes for each channel */
1165 idma32_writeq(dw, FIFO_PARTITION1, fifo_partition);
1166 idma32_writeq(dw, FIFO_PARTITION0, fifo_partition);
1167}
1168
1088static void dw_dma_off(struct dw_dma *dw) 1169static void dw_dma_off(struct dw_dma *dw)
1089{ 1170{
1090 unsigned int i; 1171 unsigned int i;
@@ -1504,8 +1585,16 @@ int dw_dma_probe(struct dw_dma_chip *chip)
1504 /* Force dma off, just in case */ 1585 /* Force dma off, just in case */
1505 dw_dma_off(dw); 1586 dw_dma_off(dw);
1506 1587
1588 idma32_fifo_partition(dw);
1589
1590 /* Device and instance ID for IRQ and DMA pool */
1591 if (pdata->is_idma32)
1592 snprintf(dw->name, sizeof(dw->name), "idma32:dmac%d", chip->id);
1593 else
1594 snprintf(dw->name, sizeof(dw->name), "dw:dmac%d", chip->id);
1595
1507 /* Create a pool of consistent memory blocks for hardware descriptors */ 1596 /* Create a pool of consistent memory blocks for hardware descriptors */
1508 dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev, 1597 dw->desc_pool = dmam_pool_create(dw->name, chip->dev,
1509 sizeof(struct dw_desc), 4, 0); 1598 sizeof(struct dw_desc), 4, 0);
1510 if (!dw->desc_pool) { 1599 if (!dw->desc_pool) {
1511 dev_err(chip->dev, "No memory for descriptors dma pool\n"); 1600 dev_err(chip->dev, "No memory for descriptors dma pool\n");
@@ -1516,7 +1605,7 @@ int dw_dma_probe(struct dw_dma_chip *chip)
1516 tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw); 1605 tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
1517 1606
1518 err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED, 1607 err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
1519 "dw_dmac", dw); 1608 dw->name, dw);
1520 if (err) 1609 if (err)
1521 goto err_pdata; 1610 goto err_pdata;
1522 1611
@@ -1665,6 +1754,8 @@ int dw_dma_enable(struct dw_dma_chip *chip)
1665{ 1754{
1666 struct dw_dma *dw = chip->dw; 1755 struct dw_dma *dw = chip->dw;
1667 1756
1757 idma32_fifo_partition(dw);
1758
1668 dw_dma_on(dw); 1759 dw_dma_on(dw);
1669 return 0; 1760 return 0;
1670} 1761}
diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
index 0ae6c3b1d34e..7778ed705a1a 100644
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -15,6 +15,18 @@
15 15
16#include "internal.h" 16#include "internal.h"
17 17
18static struct dw_dma_platform_data mrfld_pdata = {
19 .nr_channels = 8,
20 .is_private = true,
21 .is_memcpy = true,
22 .is_idma32 = true,
23 .chan_allocation_order = CHAN_ALLOCATION_ASCENDING,
24 .chan_priority = CHAN_PRIORITY_ASCENDING,
25 .block_size = 131071,
26 .nr_masters = 1,
27 .data_width = {4},
28};
29
18static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) 30static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
19{ 31{
20 const struct dw_dma_platform_data *pdata = (void *)pid->driver_data; 32 const struct dw_dma_platform_data *pdata = (void *)pid->driver_data;
@@ -47,6 +59,7 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
47 return -ENOMEM; 59 return -ENOMEM;
48 60
49 chip->dev = &pdev->dev; 61 chip->dev = &pdev->dev;
62 chip->id = pdev->devfn;
50 chip->regs = pcim_iomap_table(pdev)[0]; 63 chip->regs = pcim_iomap_table(pdev)[0];
51 chip->irq = pdev->irq; 64 chip->irq = pdev->irq;
52 chip->pdata = pdata; 65 chip->pdata = pdata;
@@ -95,14 +108,16 @@ static const struct dev_pm_ops dw_pci_dev_pm_ops = {
95}; 108};
96 109
97static const struct pci_device_id dw_pci_id_table[] = { 110static const struct pci_device_id dw_pci_id_table[] = {
98 /* Medfield */ 111 /* Medfield (GPDMA) */
99 { PCI_VDEVICE(INTEL, 0x0827) }, 112 { PCI_VDEVICE(INTEL, 0x0827) },
100 { PCI_VDEVICE(INTEL, 0x0830) },
101 113
102 /* BayTrail */ 114 /* BayTrail */
103 { PCI_VDEVICE(INTEL, 0x0f06) }, 115 { PCI_VDEVICE(INTEL, 0x0f06) },
104 { PCI_VDEVICE(INTEL, 0x0f40) }, 116 { PCI_VDEVICE(INTEL, 0x0f40) },
105 117
118 /* Merrifield iDMA 32-bit (GPDMA) */
119 { PCI_VDEVICE(INTEL, 0x11a2), (kernel_ulong_t)&mrfld_pdata },
120
106 /* Braswell */ 121 /* Braswell */
107 { PCI_VDEVICE(INTEL, 0x2286) }, 122 { PCI_VDEVICE(INTEL, 0x2286) },
108 { PCI_VDEVICE(INTEL, 0x22c0) }, 123 { PCI_VDEVICE(INTEL, 0x22c0) },
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index b1655e40cfa2..c639c60b825a 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -202,6 +202,7 @@ static int dw_probe(struct platform_device *pdev)
202 pdata = dw_dma_parse_dt(pdev); 202 pdata = dw_dma_parse_dt(pdev);
203 203
204 chip->dev = dev; 204 chip->dev = dev;
205 chip->id = pdev->id;
205 chip->pdata = pdata; 206 chip->pdata = pdata;
206 207
207 chip->clk = devm_clk_get(chip->dev, "hclk"); 208 chip->clk = devm_clk_get(chip->dev, "hclk");
diff --git a/drivers/dma/dw/regs.h b/drivers/dma/dw/regs.h
index 4e0128c62704..32a328721c88 100644
--- a/drivers/dma/dw/regs.h
+++ b/drivers/dma/dw/regs.h
@@ -3,15 +3,19 @@
3 * 3 *
4 * Copyright (C) 2005-2007 Atmel Corporation 4 * Copyright (C) 2005-2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics 5 * Copyright (C) 2010-2011 ST Microelectronics
6 * Copyright (C) 2016 Intel Corporation
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
10 */ 11 */
11 12
13#include <linux/bitops.h>
12#include <linux/interrupt.h> 14#include <linux/interrupt.h>
13#include <linux/dmaengine.h> 15#include <linux/dmaengine.h>
14 16
17#include <linux/io-64-nonatomic-hi-lo.h>
18
15#include "internal.h" 19#include "internal.h"
16 20
17#define DW_DMA_MAX_NR_REQUESTS 16 21#define DW_DMA_MAX_NR_REQUESTS 16
@@ -85,9 +89,9 @@ struct dw_dma_regs {
85 DW_REG(ID); 89 DW_REG(ID);
86 DW_REG(TEST); 90 DW_REG(TEST);
87 91
88 /* reserved */ 92 /* iDMA 32-bit support */
89 DW_REG(__reserved0); 93 DW_REG(CLASS_PRIORITY0);
90 DW_REG(__reserved1); 94 DW_REG(CLASS_PRIORITY1);
91 95
92 /* optional encoded params, 0x3c8..0x3f7 */ 96 /* optional encoded params, 0x3c8..0x3f7 */
93 u32 __reserved; 97 u32 __reserved;
@@ -99,6 +103,17 @@ struct dw_dma_regs {
99 103
100 /* top-level parameters */ 104 /* top-level parameters */
101 u32 DW_PARAMS; 105 u32 DW_PARAMS;
106
107 /* component ID */
108 u32 COMP_TYPE;
109 u32 COMP_VERSION;
110
111 /* iDMA 32-bit support */
112 DW_REG(FIFO_PARTITION0);
113 DW_REG(FIFO_PARTITION1);
114
115 DW_REG(SAI_ERR);
116 DW_REG(GLOBAL_CFG);
102}; 117};
103 118
104/* 119/*
@@ -170,8 +185,9 @@ enum dw_dma_msize {
170#define DWC_CTLL_LLP_S_EN (1 << 28) /* src block chain */ 185#define DWC_CTLL_LLP_S_EN (1 << 28) /* src block chain */
171 186
172/* Bitfields in CTL_HI */ 187/* Bitfields in CTL_HI */
173#define DWC_CTLH_DONE 0x00001000 188#define DWC_CTLH_BLOCK_TS_MASK GENMASK(11, 0)
174#define DWC_CTLH_BLOCK_TS_MASK 0x00000fff 189#define DWC_CTLH_BLOCK_TS(x) ((x) & DWC_CTLH_BLOCK_TS_MASK)
190#define DWC_CTLH_DONE (1 << 12)
175 191
176/* Bitfields in CFG_LO */ 192/* Bitfields in CFG_LO */
177#define DWC_CFGL_CH_PRIOR_MASK (0x7 << 5) /* priority mask */ 193#define DWC_CFGL_CH_PRIOR_MASK (0x7 << 5) /* priority mask */
@@ -214,6 +230,33 @@ enum dw_dma_msize {
214/* Bitfields in CFG */ 230/* Bitfields in CFG */
215#define DW_CFG_DMA_EN (1 << 0) 231#define DW_CFG_DMA_EN (1 << 0)
216 232
233/* iDMA 32-bit support */
234
235/* Bitfields in CTL_HI */
236#define IDMA32C_CTLH_BLOCK_TS_MASK GENMASK(16, 0)
237#define IDMA32C_CTLH_BLOCK_TS(x) ((x) & IDMA32C_CTLH_BLOCK_TS_MASK)
238#define IDMA32C_CTLH_DONE (1 << 17)
239
240/* Bitfields in CFG_LO */
241#define IDMA32C_CFGL_DST_BURST_ALIGN (1 << 0) /* dst burst align */
242#define IDMA32C_CFGL_SRC_BURST_ALIGN (1 << 1) /* src burst align */
243#define IDMA32C_CFGL_CH_DRAIN (1 << 10) /* drain FIFO */
244#define IDMA32C_CFGL_DST_OPT_BL (1 << 20) /* optimize dst burst length */
245#define IDMA32C_CFGL_SRC_OPT_BL (1 << 21) /* optimize src burst length */
246
247/* Bitfields in CFG_HI */
248#define IDMA32C_CFGH_SRC_PER(x) ((x) << 0)
249#define IDMA32C_CFGH_DST_PER(x) ((x) << 4)
250#define IDMA32C_CFGH_RD_ISSUE_THD(x) ((x) << 8)
251#define IDMA32C_CFGH_RW_ISSUE_THD(x) ((x) << 18)
252#define IDMA32C_CFGH_SRC_PER_EXT(x) ((x) << 28) /* src peripheral extension */
253#define IDMA32C_CFGH_DST_PER_EXT(x) ((x) << 30) /* dst peripheral extension */
254
255/* Bitfields in FIFO_PARTITION */
256#define IDMA32C_FP_PSIZE_CH0(x) ((x) << 0)
257#define IDMA32C_FP_PSIZE_CH1(x) ((x) << 13)
258#define IDMA32C_FP_UPDATE (1 << 26)
259
217enum dw_dmac_flags { 260enum dw_dmac_flags {
218 DW_DMA_IS_CYCLIC = 0, 261 DW_DMA_IS_CYCLIC = 0,
219 DW_DMA_IS_SOFT_LLP = 1, 262 DW_DMA_IS_SOFT_LLP = 1,
@@ -270,6 +313,7 @@ static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
270 313
271struct dw_dma { 314struct dw_dma {
272 struct dma_device dma; 315 struct dma_device dma;
316 char name[20];
273 void __iomem *regs; 317 void __iomem *regs;
274 struct dma_pool *desc_pool; 318 struct dma_pool *desc_pool;
275 struct tasklet_struct tasklet; 319 struct tasklet_struct tasklet;
@@ -293,6 +337,11 @@ static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
293#define dma_writel(dw, name, val) \ 337#define dma_writel(dw, name, val) \
294 dma_writel_native((val), &(__dw_regs(dw)->name)) 338 dma_writel_native((val), &(__dw_regs(dw)->name))
295 339
340#define idma32_readq(dw, name) \
341 hi_lo_readq(&(__dw_regs(dw)->name))
342#define idma32_writeq(dw, name, val) \
343 hi_lo_writeq((val), &(__dw_regs(dw)->name))
344
296#define channel_set_bit(dw, reg, mask) \ 345#define channel_set_bit(dw, reg, mask) \
297 dma_writel(dw, reg, ((mask) << 8) | (mask)) 346 dma_writel(dw, reg, ((mask) << 8) | (mask))
298#define channel_clear_bit(dw, reg, mask) \ 347#define channel_clear_bit(dw, reg, mask) \
diff --git a/drivers/dma/ipu/ipu_irq.c b/drivers/dma/ipu/ipu_irq.c
index dd184b50e5b4..284627806b88 100644
--- a/drivers/dma/ipu/ipu_irq.c
+++ b/drivers/dma/ipu/ipu_irq.c
@@ -272,7 +272,7 @@ static void ipu_irq_handler(struct irq_desc *desc)
272 u32 status; 272 u32 status;
273 int i, line; 273 int i, line;
274 274
275 for (i = IPU_IRQ_NR_FN_BANKS; i < IPU_IRQ_NR_BANKS; i++) { 275 for (i = 0; i < IPU_IRQ_NR_BANKS; i++) {
276 struct ipu_irq_bank *bank = irq_bank + i; 276 struct ipu_irq_bank *bank = irq_bank + i;
277 277
278 raw_spin_lock(&bank_lock); 278 raw_spin_lock(&bank_lock);
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 4c357d475465..48b22d5c8602 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1724,6 +1724,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
1724 1724
1725 dmac->dev = &pdev->dev; 1725 dmac->dev = &pdev->dev;
1726 platform_set_drvdata(pdev, dmac); 1726 platform_set_drvdata(pdev, dmac);
1727 dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1727 1728
1728 ret = rcar_dmac_parse_of(&pdev->dev, dmac); 1729 ret = rcar_dmac_parse_of(&pdev->dev, dmac);
1729 if (ret < 0) 1730 if (ret < 0)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 8684d11b29bb..a6620b671d1d 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2809,12 +2809,14 @@ static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma,
2809 2809
2810static void d40_ops_init(struct d40_base *base, struct dma_device *dev) 2810static void d40_ops_init(struct d40_base *base, struct dma_device *dev)
2811{ 2811{
2812 if (dma_has_cap(DMA_SLAVE, dev->cap_mask)) 2812 if (dma_has_cap(DMA_SLAVE, dev->cap_mask)) {
2813 dev->device_prep_slave_sg = d40_prep_slave_sg; 2813 dev->device_prep_slave_sg = d40_prep_slave_sg;
2814 dev->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
2815 }
2814 2816
2815 if (dma_has_cap(DMA_MEMCPY, dev->cap_mask)) { 2817 if (dma_has_cap(DMA_MEMCPY, dev->cap_mask)) {
2816 dev->device_prep_dma_memcpy = d40_prep_memcpy; 2818 dev->device_prep_dma_memcpy = d40_prep_memcpy;
2817 2819 dev->directions = BIT(DMA_MEM_TO_MEM);
2818 /* 2820 /*
2819 * This controller can only access address at even 2821 * This controller can only access address at even
2820 * 32bit boundaries, i.e. 2^2 2822 * 32bit boundaries, i.e. 2^2
@@ -2836,6 +2838,7 @@ static void d40_ops_init(struct d40_base *base, struct dma_device *dev)
2836 dev->device_pause = d40_pause; 2838 dev->device_pause = d40_pause;
2837 dev->device_resume = d40_resume; 2839 dev->device_resume = d40_resume;
2838 dev->device_terminate_all = d40_terminate_all; 2840 dev->device_terminate_all = d40_terminate_all;
2841 dev->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
2839 dev->dev = base->dev; 2842 dev->dev = base->dev;
2840} 2843}
2841 2844
diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
index 3056ce7f8c69..49f86cabcfec 100644
--- a/drivers/dma/stm32-dma.c
+++ b/drivers/dma/stm32-dma.c
@@ -114,6 +114,7 @@
114#define STM32_DMA_MAX_CHANNELS 0x08 114#define STM32_DMA_MAX_CHANNELS 0x08
115#define STM32_DMA_MAX_REQUEST_ID 0x08 115#define STM32_DMA_MAX_REQUEST_ID 0x08
116#define STM32_DMA_MAX_DATA_PARAM 0x03 116#define STM32_DMA_MAX_DATA_PARAM 0x03
117#define STM32_DMA_MAX_BURST 16
117 118
118enum stm32_dma_width { 119enum stm32_dma_width {
119 STM32_DMA_BYTE, 120 STM32_DMA_BYTE,
@@ -403,6 +404,13 @@ static int stm32_dma_terminate_all(struct dma_chan *c)
403 return 0; 404 return 0;
404} 405}
405 406
407static void stm32_dma_synchronize(struct dma_chan *c)
408{
409 struct stm32_dma_chan *chan = to_stm32_dma_chan(c);
410
411 vchan_synchronize(&chan->vchan);
412}
413
406static void stm32_dma_dump_reg(struct stm32_dma_chan *chan) 414static void stm32_dma_dump_reg(struct stm32_dma_chan *chan)
407{ 415{
408 struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan); 416 struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan);
@@ -421,7 +429,7 @@ static void stm32_dma_dump_reg(struct stm32_dma_chan *chan)
421 dev_dbg(chan2dev(chan), "SFCR: 0x%08x\n", sfcr); 429 dev_dbg(chan2dev(chan), "SFCR: 0x%08x\n", sfcr);
422} 430}
423 431
424static int stm32_dma_start_transfer(struct stm32_dma_chan *chan) 432static void stm32_dma_start_transfer(struct stm32_dma_chan *chan)
425{ 433{
426 struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan); 434 struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan);
427 struct virt_dma_desc *vdesc; 435 struct virt_dma_desc *vdesc;
@@ -432,12 +440,12 @@ static int stm32_dma_start_transfer(struct stm32_dma_chan *chan)
432 440
433 ret = stm32_dma_disable_chan(chan); 441 ret = stm32_dma_disable_chan(chan);
434 if (ret < 0) 442 if (ret < 0)
435 return ret; 443 return;
436 444
437 if (!chan->desc) { 445 if (!chan->desc) {
438 vdesc = vchan_next_desc(&chan->vchan); 446 vdesc = vchan_next_desc(&chan->vchan);
439 if (!vdesc) 447 if (!vdesc)
440 return -EPERM; 448 return;
441 449
442 chan->desc = to_stm32_dma_desc(vdesc); 450 chan->desc = to_stm32_dma_desc(vdesc);
443 chan->next_sg = 0; 451 chan->next_sg = 0;
@@ -471,7 +479,7 @@ static int stm32_dma_start_transfer(struct stm32_dma_chan *chan)
471 479
472 chan->busy = true; 480 chan->busy = true;
473 481
474 return 0; 482 dev_dbg(chan2dev(chan), "vchan %p: started\n", &chan->vchan);
475} 483}
476 484
477static void stm32_dma_configure_next_sg(struct stm32_dma_chan *chan) 485static void stm32_dma_configure_next_sg(struct stm32_dma_chan *chan)
@@ -500,8 +508,6 @@ static void stm32_dma_configure_next_sg(struct stm32_dma_chan *chan)
500 dev_dbg(chan2dev(chan), "CT=0 <=> SM1AR: 0x%08x\n", 508 dev_dbg(chan2dev(chan), "CT=0 <=> SM1AR: 0x%08x\n",
501 stm32_dma_read(dmadev, STM32_DMA_SM1AR(id))); 509 stm32_dma_read(dmadev, STM32_DMA_SM1AR(id)));
502 } 510 }
503
504 chan->next_sg++;
505 } 511 }
506} 512}
507 513
@@ -510,6 +516,7 @@ static void stm32_dma_handle_chan_done(struct stm32_dma_chan *chan)
510 if (chan->desc) { 516 if (chan->desc) {
511 if (chan->desc->cyclic) { 517 if (chan->desc->cyclic) {
512 vchan_cyclic_callback(&chan->desc->vdesc); 518 vchan_cyclic_callback(&chan->desc->vdesc);
519 chan->next_sg++;
513 stm32_dma_configure_next_sg(chan); 520 stm32_dma_configure_next_sg(chan);
514 } else { 521 } else {
515 chan->busy = false; 522 chan->busy = false;
@@ -552,15 +559,13 @@ static void stm32_dma_issue_pending(struct dma_chan *c)
552{ 559{
553 struct stm32_dma_chan *chan = to_stm32_dma_chan(c); 560 struct stm32_dma_chan *chan = to_stm32_dma_chan(c);
554 unsigned long flags; 561 unsigned long flags;
555 int ret;
556 562
557 spin_lock_irqsave(&chan->vchan.lock, flags); 563 spin_lock_irqsave(&chan->vchan.lock, flags);
558 if (!chan->busy) { 564 if (vchan_issue_pending(&chan->vchan) && !chan->desc && !chan->busy) {
559 if (vchan_issue_pending(&chan->vchan) && !chan->desc) { 565 dev_dbg(chan2dev(chan), "vchan %p: issued\n", &chan->vchan);
560 ret = stm32_dma_start_transfer(chan); 566 stm32_dma_start_transfer(chan);
561 if ((!ret) && (chan->desc->cyclic)) 567 if (chan->desc->cyclic)
562 stm32_dma_configure_next_sg(chan); 568 stm32_dma_configure_next_sg(chan);
563 }
564 } 569 }
565 spin_unlock_irqrestore(&chan->vchan.lock, flags); 570 spin_unlock_irqrestore(&chan->vchan.lock, flags);
566} 571}
@@ -848,26 +853,40 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_dma_memcpy(
848 return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); 853 return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
849} 854}
850 855
856static u32 stm32_dma_get_remaining_bytes(struct stm32_dma_chan *chan)
857{
858 u32 dma_scr, width, ndtr;
859 struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan);
860
861 dma_scr = stm32_dma_read(dmadev, STM32_DMA_SCR(chan->id));
862 width = STM32_DMA_SCR_PSIZE_GET(dma_scr);
863 ndtr = stm32_dma_read(dmadev, STM32_DMA_SNDTR(chan->id));
864
865 return ndtr << width;
866}
867
851static size_t stm32_dma_desc_residue(struct stm32_dma_chan *chan, 868static size_t stm32_dma_desc_residue(struct stm32_dma_chan *chan,
852 struct stm32_dma_desc *desc, 869 struct stm32_dma_desc *desc,
853 u32 next_sg) 870 u32 next_sg)
854{ 871{
855 struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan); 872 u32 residue = 0;
856 u32 dma_scr, width, residue, count;
857 int i; 873 int i;
858 874
859 residue = 0; 875 /*
876 * In cyclic mode, for the last period, residue = remaining bytes from
877 * NDTR
878 */
879 if (chan->desc->cyclic && next_sg == 0)
880 return stm32_dma_get_remaining_bytes(chan);
860 881
882 /*
883 * For all other periods in cyclic mode, and in sg mode,
884 * residue = remaining bytes from NDTR + remaining periods/sg to be
885 * transferred
886 */
861 for (i = next_sg; i < desc->num_sgs; i++) 887 for (i = next_sg; i < desc->num_sgs; i++)
862 residue += desc->sg_req[i].len; 888 residue += desc->sg_req[i].len;
863 889 residue += stm32_dma_get_remaining_bytes(chan);
864 if (next_sg != 0) {
865 dma_scr = stm32_dma_read(dmadev, STM32_DMA_SCR(chan->id));
866 width = STM32_DMA_SCR_PSIZE_GET(dma_scr);
867 count = stm32_dma_read(dmadev, STM32_DMA_SNDTR(chan->id));
868
869 residue += count << width;
870 }
871 890
872 return residue; 891 return residue;
873} 892}
@@ -964,27 +983,36 @@ static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec,
964 struct of_dma *ofdma) 983 struct of_dma *ofdma)
965{ 984{
966 struct stm32_dma_device *dmadev = ofdma->of_dma_data; 985 struct stm32_dma_device *dmadev = ofdma->of_dma_data;
986 struct device *dev = dmadev->ddev.dev;
967 struct stm32_dma_cfg cfg; 987 struct stm32_dma_cfg cfg;
968 struct stm32_dma_chan *chan; 988 struct stm32_dma_chan *chan;
969 struct dma_chan *c; 989 struct dma_chan *c;
970 990
971 if (dma_spec->args_count < 4) 991 if (dma_spec->args_count < 4) {
992 dev_err(dev, "Bad number of cells\n");
972 return NULL; 993 return NULL;
994 }
973 995
974 cfg.channel_id = dma_spec->args[0]; 996 cfg.channel_id = dma_spec->args[0];
975 cfg.request_line = dma_spec->args[1]; 997 cfg.request_line = dma_spec->args[1];
976 cfg.stream_config = dma_spec->args[2]; 998 cfg.stream_config = dma_spec->args[2];
977 cfg.threshold = dma_spec->args[3]; 999 cfg.threshold = dma_spec->args[3];
978 1000
979 if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) || (cfg.request_line >= 1001 if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) ||
980 STM32_DMA_MAX_REQUEST_ID)) 1002 (cfg.request_line >= STM32_DMA_MAX_REQUEST_ID)) {
1003 dev_err(dev, "Bad channel and/or request id\n");
981 return NULL; 1004 return NULL;
1005 }
982 1006
983 chan = &dmadev->chan[cfg.channel_id]; 1007 chan = &dmadev->chan[cfg.channel_id];
984 1008
985 c = dma_get_slave_channel(&chan->vchan.chan); 1009 c = dma_get_slave_channel(&chan->vchan.chan);
986 if (c) 1010 if (!c) {
987 stm32_dma_set_config(chan, &cfg); 1011 dev_err(dev, "No more channel avalaible\n");
1012 return NULL;
1013 }
1014
1015 stm32_dma_set_config(chan, &cfg);
988 1016
989 return c; 1017 return c;
990} 1018}
@@ -1048,6 +1076,7 @@ static int stm32_dma_probe(struct platform_device *pdev)
1048 dd->device_prep_dma_cyclic = stm32_dma_prep_dma_cyclic; 1076 dd->device_prep_dma_cyclic = stm32_dma_prep_dma_cyclic;
1049 dd->device_config = stm32_dma_slave_config; 1077 dd->device_config = stm32_dma_slave_config;
1050 dd->device_terminate_all = stm32_dma_terminate_all; 1078 dd->device_terminate_all = stm32_dma_terminate_all;
1079 dd->device_synchronize = stm32_dma_synchronize;
1051 dd->src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | 1080 dd->src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
1052 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | 1081 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
1053 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); 1082 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
@@ -1056,6 +1085,7 @@ static int stm32_dma_probe(struct platform_device *pdev)
1056 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); 1085 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
1057 dd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); 1086 dd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
1058 dd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; 1087 dd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
1088 dd->max_burst = STM32_DMA_MAX_BURST;
1059 dd->dev = &pdev->dev; 1089 dd->dev = &pdev->dev;
1060 INIT_LIST_HEAD(&dd->channels); 1090 INIT_LIST_HEAD(&dd->channels);
1061 1091
diff --git a/drivers/dma/zx296702_dma.c b/drivers/dma/zx_dma.c
index 380276d078b2..2bb695315300 100644
--- a/drivers/dma/zx296702_dma.c
+++ b/drivers/dma/zx_dma.c
@@ -26,7 +26,7 @@
26 26
27#define DRIVER_NAME "zx-dma" 27#define DRIVER_NAME "zx-dma"
28#define DMA_ALIGN 4 28#define DMA_ALIGN 4
29#define DMA_MAX_SIZE (0x10000 - PAGE_SIZE) 29#define DMA_MAX_SIZE (0x10000 - 512)
30#define LLI_BLOCK_SIZE (4 * PAGE_SIZE) 30#define LLI_BLOCK_SIZE (4 * PAGE_SIZE)
31 31
32#define REG_ZX_SRC_ADDR 0x00 32#define REG_ZX_SRC_ADDR 0x00
@@ -365,7 +365,8 @@ static enum dma_status zx_dma_tx_status(struct dma_chan *chan,
365 365
366 bytes = 0; 366 bytes = 0;
367 clli = zx_dma_get_curr_lli(p); 367 clli = zx_dma_get_curr_lli(p);
368 index = (clli - ds->desc_hw_lli) / sizeof(struct zx_desc_hw); 368 index = (clli - ds->desc_hw_lli) /
369 sizeof(struct zx_desc_hw) + 1;
369 for (; index < ds->desc_num; index++) { 370 for (; index < ds->desc_num; index++) {
370 bytes += ds->desc_hw[index].src_x; 371 bytes += ds->desc_hw[index].src_x;
371 /* end of lli */ 372 /* end of lli */
@@ -812,6 +813,7 @@ static int zx_dma_probe(struct platform_device *op)
812 INIT_LIST_HEAD(&d->slave.channels); 813 INIT_LIST_HEAD(&d->slave.channels);
813 dma_cap_set(DMA_SLAVE, d->slave.cap_mask); 814 dma_cap_set(DMA_SLAVE, d->slave.cap_mask);
814 dma_cap_set(DMA_MEMCPY, d->slave.cap_mask); 815 dma_cap_set(DMA_MEMCPY, d->slave.cap_mask);
816 dma_cap_set(DMA_CYCLIC, d->slave.cap_mask);
815 dma_cap_set(DMA_PRIVATE, d->slave.cap_mask); 817 dma_cap_set(DMA_PRIVATE, d->slave.cap_mask);
816 d->slave.dev = &op->dev; 818 d->slave.dev = &op->dev;
817 d->slave.device_free_chan_resources = zx_dma_free_chan_resources; 819 d->slave.device_free_chan_resources = zx_dma_free_chan_resources;
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 388574ea38ed..28e3cf1465ab 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -87,7 +87,7 @@ struct async_submit_ctl {
87 void *scribble; 87 void *scribble;
88}; 88};
89 89
90#ifdef CONFIG_DMA_ENGINE 90#if defined(CONFIG_DMA_ENGINE) && !defined(CONFIG_ASYNC_TX_CHANNEL_SWITCH)
91#define async_tx_issue_pending_all dma_issue_pending_all 91#define async_tx_issue_pending_all dma_issue_pending_all
92 92
93/** 93/**
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
index ccfd0c3777df..b63b25814d77 100644
--- a/include/linux/dma/dw.h
+++ b/include/linux/dma/dw.h
@@ -23,6 +23,7 @@ struct dw_dma;
23/** 23/**
24 * struct dw_dma_chip - representation of DesignWare DMA controller hardware 24 * struct dw_dma_chip - representation of DesignWare DMA controller hardware
25 * @dev: struct device of the DMA controller 25 * @dev: struct device of the DMA controller
26 * @id: instance ID
26 * @irq: irq line 27 * @irq: irq line
27 * @regs: memory mapped I/O space 28 * @regs: memory mapped I/O space
28 * @clk: hclk clock 29 * @clk: hclk clock
@@ -31,6 +32,7 @@ struct dw_dma;
31 */ 32 */
32struct dw_dma_chip { 33struct dw_dma_chip {
33 struct device *dev; 34 struct device *dev;
35 int id;
34 int irq; 36 int irq;
35 void __iomem *regs; 37 void __iomem *regs;
36 struct clk *clk; 38 struct clk *clk;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index feee6ec6a13b..533680860865 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -894,6 +894,17 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memset(
894 len, flags); 894 len, flags);
895} 895}
896 896
897static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_memcpy(
898 struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
899 size_t len, unsigned long flags)
900{
901 if (!chan || !chan->device || !chan->device->device_prep_dma_memcpy)
902 return NULL;
903
904 return chan->device->device_prep_dma_memcpy(chan, dest, src,
905 len, flags);
906}
907
897static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg( 908static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg(
898 struct dma_chan *chan, 909 struct dma_chan *chan,
899 struct scatterlist *dst_sg, unsigned int dst_nents, 910 struct scatterlist *dst_sg, unsigned int dst_nents,
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
index e69e415d0d98..896cb71a382c 100644
--- a/include/linux/platform_data/dma-dw.h
+++ b/include/linux/platform_data/dma-dw.h
@@ -41,6 +41,7 @@ struct dw_dma_slave {
41 * @is_private: The device channels should be marked as private and not for 41 * @is_private: The device channels should be marked as private and not for
42 * by the general purpose DMA channel allocator. 42 * by the general purpose DMA channel allocator.
43 * @is_memcpy: The device channels do support memory-to-memory transfers. 43 * @is_memcpy: The device channels do support memory-to-memory transfers.
44 * @is_idma32: The type of the DMA controller is iDMA32
44 * @chan_allocation_order: Allocate channels starting from 0 or 7 45 * @chan_allocation_order: Allocate channels starting from 0 or 7
45 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0. 46 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
46 * @block_size: Maximum block size supported by the controller 47 * @block_size: Maximum block size supported by the controller
@@ -53,6 +54,7 @@ struct dw_dma_platform_data {
53 unsigned int nr_channels; 54 unsigned int nr_channels;
54 bool is_private; 55 bool is_private;
55 bool is_memcpy; 56 bool is_memcpy;
57 bool is_idma32;
56#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */ 58#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
57#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */ 59#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
58 unsigned char chan_allocation_order; 60 unsigned char chan_allocation_order;