Skip to contentSkip to conversation

Resend [PATCH] intel_mid: Add Mrst & Mfld DMA Drivers

PATCH Vinod Koul 3 participants 5 messages Jul 21, 2010 – Jul 28, 2010

Subsystems (14)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

Hello Dan,

The second rev of patch fixes the comments recieved last time. I have also cleaned up the driver and few more cosmetic changes

This patch add DMA drivers for DMA controllers in Langwell chipset of Intel(R) Moorestown platform and DMA controllers in Penwell of Intel(R) Medfield platfrom

This patch adds support for Moorestown DMAC1 and DMAC2 controllers. It also add support for Medfiled GP DMA and DMAC1 controllers. These controllers supports memory to peripheral and peripheral to memory transfers. It support only single block transfers.

This driver is based on Kernel DMA engine
Anyone who wishes to use this controller should use DMA engine APIs

This controller exposes DMA_SLAVE capabilities and notifies the client drivers of DMA transaction completion

Config option required to be enabled CONFIG_INTEL_MID_DMAC=y

---
 drivers/dma/Kconfig              |   13 +
 drivers/dma/Makefile             |    1 +
 drivers/dma/intel_mid_dma.c      | 1143 ++++++++++++++++++++++++++++++++++++++
 drivers/dma/intel_mid_dma_regs.h |  260 +++++++++
 include/linux/intel_mid_dma.h    |   86 +++
 5 files changed, 1503 insertions(+), 0 deletions(-)
 create mode 100644 drivers/dma/intel_mid_dma.c
 create mode 100644 drivers/dma/intel_mid_dma_regs.h
 create mode 100644 include/linux/intel_mid_dma.h
drivers/dma/Kconfig +13 -0
index 9e01e96..6a3e5bf 100644
@@ -33,6 +33,19 @@ if DMADEVICES
 
 comment "DMA Devices"
 
+config INTEL_MID_DMAC
+	tristate "Intel MID DMA support for Peripheral DMA controllers"
+	depends on PCI && X86
+	select DMA_ENGINE
+	default n
+	help
+	  Enable support for the Intel(R) MID DMA engine present
+	  in Intel MID chipsets.
+
+	  Say Y here if you have such a chipset.
+
+	  If unsure, say N.
+
 config ASYNC_TX_DISABLE_CHANNEL_SWITCH
 	bool
 
drivers/dma/Makefile +1 -0
index 0fe5ebb..27b6c69 100644
@@ -7,6 +7,7 @@ endif
 
 obj-$(CONFIG_DMA_ENGINE) += dmaengine.o
 obj-$(CONFIG_NET_DMA) += iovlock.o
+obj-$(CONFIG_INTEL_MID_DMAC) += intel_mid_dma.o
 obj-$(CONFIG_DMATEST) += dmatest.o
 obj-$(CONFIG_INTEL_IOATDMA) += ioat/
 obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o
drivers/dma/intel_mid_dma.c new file +1143 -0

1,143 lines not on this page · raw message

drivers/dma/intel_mid_dma_regs.h new file +260 -0

260 lines not on this page · raw message

include/linux/intel_mid_dma.h new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
1.6.6.1
#1 lore raw
Quoted 8 lines

Hello Dan,

The second rev of patch fixes the comments recieved last time. I have also cleaned up the driver and few more cosmetic changes

This patch add DMA drivers for DMA controllers in Langwell chipset of Intel(R) Moorestown platform and DMA controllers in Penwell of Intel(R) Medfield platfrom

Dan,

Do you have any more comments on this patch. How do you want this to be coordinated wrt DMA engine patch by Linus.

-Vinod

#2 lore raw
In reply to Vinod Koul
Quoted 35 lines · Vinod Koul

Hello Dan,

The second rev of patch fixes the comments recieved last time. I have also cleaned up the driver and few more cosmetic changes

This patch add DMA drivers for DMA controllers in Langwell chipset of Intel(R) Moorestown platform and DMA controllers in Penwell of Intel(R) Medfield platfrom

This patch adds support for Moorestown DMAC1 and DMAC2 controllers. It also add support for Medfiled GP DMA and DMAC1 controllers. These controllers supports memory to peripheral and peripheral to memory transfers. It support only single block transfers.

This driver is based on Kernel DMA engine
Anyone who wishes to use this controller should use DMA engine APIs

This controller exposes DMA_SLAVE capabilities and notifies the client drivers of DMA transaction completion

Config option required to be enabled CONFIG_INTEL_MID_DMAC=y

---
 drivers/dma/Kconfig              |   13 +
 drivers/dma/Makefile             |    1 + drivers/dma/intel_mid_dma.c      | 1143 ++++++++++++++++++++++++++++++++++++++ drivers/dma/intel_mid_dma_regs.h |  260 +++++++++ include/linux/intel_mid_dma.h    |   86 +++

 5 files changed, 1503 insertions(+), 0 deletions(-)

 create mode 100644 drivers/dma/intel_mid_dma.c create mode 100644 drivers/dma/intel_mid_dma_regs.h create mode 100644 include/linux/intel_mid_dma.h

[..]

Quoted 5 lines
drivers/dma/intel_mid_dma.c new file +5 -0
+/**
+ * intel_mid_dma_prep_memcpy - Prep memcpy txn
+ * @chan: chan for DMA transfer
+ * @dest: destn address
+ * @src: src address

drivers/dma/intel_mid_dma.c line 489

Quoted 10 lines
drivers/dma/intel_mid_dma.c new file +10 -0
+ * @len: DMA transfer len
+ * @flags: DMA flags
+ *
+ * Perform a DMA memcpy. Note we support slave periphral DMA transfers only
+ * The periphral txn details should be filled in slave structure properly
+ * Returns the descriptor for this txn
+ */
+static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
+                       struct dma_chan *chan, dma_addr_t dest,
+                       dma_addr_t src, size_t len, unsigned long flags)

The use of the prep_dma_memcpy routine instead of prep_slave_sg is a bit odd for device-to-memory dma because the dma_addr_t type only describes the bus address view of host memory from the device perspective. Other slave dma devices are using a backdoor method (since a good abstraction does not exist) to associate a known channel to a known device and then specifying the host address and a direction via prep_slave_sg. I see that this usage of dma_addr_t was inherited from the dw_spi implementation, so not much we can do about it now, but I don't think its a model we want to perpetuate.

I do see that the dw_spi_mid driver is only calling dma_request_channel(mask, NULL, NULL). Are we guaranteed that dw_spi_mid silicon collateral will only ever exist on an intel_mid_dma platform? Otherwise can the dw_mid_spi driver survive talking to another random DMA_SLAVE|DMA_MEMCPY channel? The purpose of the filter_fn parameter to dma_request_channel() is to guarantee (by arch-specific hackery) that you are talking to a known compatible channel for your device.

Quoted 10 lines
drivers/dma/intel_mid_dma.c new file +10 -0
+{
+       struct intel_mid_dma_chan *midc;
+       struct intel_mid_dma_desc *desc = NULL;
+       struct intel_mid_dma_slave *mids;
+       union intel_mid_dma_ctl_lo ctl_lo;
+       union intel_mid_dma_ctl_hi ctl_hi;
+       union intel_mid_dma_cfg_lo cfg_lo;
+       union intel_mid_dma_cfg_hi cfg_hi;
+       enum intel_mid_dma_width width = 0;
+

drivers/dma/intel_mid_dma.c line 509

Quoted 10 lines
drivers/dma/intel_mid_dma.c new file +10 -0
+       pr_debug("MDMA: Prep for memcpy\n");
+       WARN_ON(!chan);
+       if (!len)
+               return NULL;
+
+       mids = chan->private;
+       WARN_ON(!mids);
+
+       midc = to_intel_mid_dma_chan(chan);
+       WARN_ON(!midc);

These WARN_ONs are a bit odd because if they trigger we'll hit null pointer dereferences soon afterwards. Is that what you wanted?

[..]

Quoted 13 lines
include/linux/intel_mid_dma.h new file +13 -0
+/**
+ * struct intel_mid_dma_slave - DMA slave structure
+ *
+ * @dirn: DMA trf direction
+ * @src_width: tx register width
+ * @dst_width: rx register width
+ * @hs_mode: HW/SW handshaking mode
+ * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
+ * @src_msize: Source DMA burst size
+ * @dst_msize: Dst DMA burst size
+ * @device_instance: DMA peripheral device instance, we can have multiple
+ *             peripheral device connected to single DMAC
+ */

include/linux/intel_mid_dma.h line 84

Quoted 10 lines
include/linux/intel_mid_dma.h new file +10 -0
+struct intel_mid_dma_slave {
+       enum dma_data_direction         dirn;
+       enum intel_mid_dma_width        src_width; /*width of DMA src txn*/
+       enum intel_mid_dma_width        dst_width; /*width of DMA dst txn*/
+       enum intel_mid_dma_hs_mode      hs_mode;  /*handshaking*/
+       enum intel_mid_dma_mode         cfg_mode; /*mode configuration*/
+       enum intel_mid_dma_msize        src_msize; /*size if src burst*/
+       enum intel_mid_dma_msize        dst_msize; /*size of dst burst*/
+       unsigned int            device_instance; /*0, 1 for periphral instance*/
+};

For 2.6.37 I'd like to see a conversion of this to the result of Linus' dma_slave_config work, but this isn't a blocker for 2.6.36.

The dw_mid_spi issues (dma_addr_t and dma_request_channel() usage) are outside the drivers/dma/ tree, so I'll go ahead and apply this*. If you want to fix up the WARN_ON issues just send an incremental cleanup patch.

--
Dan

*applied with a fix for:
drivers/dma/intel_mid_dma.c:511: warning: format %d expects type int, but argument 4 has type size_t

#3 lore raw
Quoted 9 lines

The use of the prep_dma_memcpy routine instead of prep_slave_sg is a bit odd for device-to-memory dma because the dma_addr_t type only describes the bus address view of host memory from the device perspective. Other slave dma devices are using a backdoor method (since a good abstraction does not exist) to associate a known channel to a known device and then specifying the host address and a direction via prep_slave_sg. I see that this usage of dma_addr_t was inherited from the dw_spi implementation, so not much we can do about it now, but I don't think its a model we want to perpetuate.

For the four controllers this drivers supports, two don't have sg support in hardware. For the other two I am going to add the sg support next, expect the patch for that in few weeks or so.

Quoted 8 lines

I do see that the dw_spi_mid driver is only calling dma_request_channel(mask, NULL, NULL). Are we guaranteed that dw_spi_mid silicon collateral will only ever exist on an intel_mid_dma platform? Otherwise can the dw_mid_spi driver survive talking to another random DMA_SLAVE|DMA_MEMCPY channel? The purpose of the filter_fn parameter to dma_request_channel() is to guarantee (by arch-specific hackery) that you are talking to a known compatible channel for your device.

Yes, the filter function in these drivers is supposed to look for this device and accept dma channel for specific controller only.
I looked at dw_spi_mid driver and yes it is indeed doing the wrong thing, I will send the patch to its maintainer to fix this.
Other driver which use this and are not upstream seem to be using the filter function properly

Quoted 15 lines
Quoted 15 lines
drivers/dma/intel_mid_dma.c new file +15 -0
+{
+       struct intel_mid_dma_chan *midc;
+       struct intel_mid_dma_desc *desc = NULL;
+       struct intel_mid_dma_slave *mids;
+       union intel_mid_dma_ctl_lo ctl_lo;
+       union intel_mid_dma_ctl_hi ctl_hi;
+       union intel_mid_dma_cfg_lo cfg_lo;
+       union intel_mid_dma_cfg_hi cfg_hi;
+       enum intel_mid_dma_width width = 0;
+
+       pr_debug("MDMA: Prep for memcpy\n");
+       WARN_ON(!chan);
+       if (!len)
+               return NULL;
+
Quoted 8 lines
Quoted 5 lines

+       mids = chan->private;
+       WARN_ON(!mids);
+
+       midc = to_intel_mid_dma_chan(chan);
+       WARN_ON(!midc);

These WARN_ONs are a bit odd because if they trigger we'll hit null pointer dereferences soon afterwards. Is that what you wanted?

Agreed, I will send another patch to fix this

Quoted 1 line
Quoted 1 line

+struct intel_mid_dma_slave {

[snip]

Quoted 3 lines

For 2.6.37 I'd like to see a conversion of this to the result of Linus' dma_slave_config work, but this isn't a blocker for 2.6.36.

Yes, I will update this to use dma_slave_config when I add the DMA sg support

Quoted 4 lines

*applied with a fix for:
drivers/dma/intel_mid_dma.c:511: warning: format %d expects type int, but argument 4 has type size_t

#4 lore raw
In reply to Dan Williams

2010/7/28 Dan Williams <[email protected]>:

Quoted 18 lines · Vinod Koul

[..]

Quoted 5 lines
(quoted diff) +5 -0
+/**
+ * intel_mid_dma_prep_memcpy - Prep memcpy txn
+ * @chan: chan for DMA transfer
+ * @dest: destn address
+ * @src: src address

Review

Quoted 10 lines
(quoted diff) +10 -0
+ * @len: DMA transfer len
+ * @flags: DMA flags
+ *
+ * Perform a DMA memcpy. Note we support slave periphral DMA transfers only
+ * The periphral txn details should be filled in slave structure properly
+ * Returns the descriptor for this txn
+ */
+static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
+                       struct dma_chan *chan, dma_addr_t dest,
+                       dma_addr_t src, size_t len, unsigned long flags)
Quoted 7 lines

The use of the prep_dma_memcpy routine instead of prep_slave_sg is a bit odd for device-to-memory dma because the dma_addr_t type only describes the bus address view of host memory from the device perspective.  Other slave dma devices are using a backdoor method (since a good abstraction does not exist) to associate a known channel to a known device and then specifying the host address and a direction via prep_slave_sg.

I see two distinct problems this is trying to solve:

1) No runtime channel control (patch pending!)

2) lacking in the DMA engine is actually a prep_slave_buffer() hook that takes a buffer to/from a certain channel, this is often preferable to sglists for simple DMA jobs. I mean a little something like this:

From: Linus Walleij <[email protected]>
Date: Thu, 29 Jul 2010 00:14:06 +0200
Subject: [PATCH] DMAENGINE: add a slave buffer prep call

This makes it possible for engines to implement slave transfers to be done to/from a simple kmalloc():ed memory buffer and not just from scatterlists.

---
 include/linux/dmaengine.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
include/linux/dmaengine.h +8 -1
index 5204f01..3caff1c 100644
@@ -350,7 +350,10 @@ struct dma_tx_state {
  * @device_prep_dma_pq_val: prepares a pqzero_sum operation
  * @device_prep_dma_memset: prepares a memset operation
  * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
- * @device_prep_slave_sg: prepares a slave dma operation
+ * @device_prep_slave_buffer: prepares a slave DMA operation to/from a
+ *     buffer
+ * @device_prep_slave_sg: prepares a slave dma operation to/from a
+ *     scatterlist
  * @device_control: manipulate all pending operations on a channel, returns
  *     zero or error code
  * @device_tx_status: poll for transaction completion, the optional
@@ -403,6 +406,10 @@ struct dma_device {
        struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
                struct dma_chan *chan, unsigned long flags);
 
+       struct dma_async_tx_descriptor *(*device_prep_slave_buffer)(
+               struct dma_chan *chan, char *buffer,
+               enum dma_data_direction direction,
+               unsigned long flags);
        struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
                struct dma_chan *chan, struct scatterlist *sgl,
                unsigned int sg_len, enum dma_data_direction direction,
Signature · 45 lines
1.7.2


Evidently the above function should be be possible to implement across
all drivers, and checked for in dmaengine.c. But it is probably best to make
this optional and make the fact that most engines only support sglists
a bit explicit, so we wrap up the buffer support like this:


From: Linus Walleij <[email protected]>
Date: Thu, 29 Jul 2010 00:42:58 +0200
Subject: [PATCH] DMAENGINE: slave sglists and buffers

This renames the DMA engine capability DMA_SLAVE to
DMA_SLAVE_SGLIST with the semantics that the current implementations
assume DMA_SLAVE means the slave supports only scatterlists for
inbound/outbound transfers. This completes the previous patch
by adding as specific single-buffer DMA capability to the API
and renaming all the old users as described.

Signed-off-by: Linus Walleij <[email protected]>
---
 arch/arm/mach-at91/at91sam9g45_devices.c |    2 +-
 drivers/dma/at_hdmac.c                   |    8 ++++----
 drivers/dma/coh901318.c                  |    2 +-
 drivers/dma/dmaengine.c                  |    9 ++++++---
 drivers/dma/dw_dmac.c                    |    2 +-
 drivers/dma/fsldma.c                     |   11 ++++++-----
 drivers/dma/ipu/ipu_idmac.c              |    4 ++--
 drivers/dma/pl330.c                      |    2 +-
 drivers/dma/shdma.c                      |    4 ++--
 drivers/dma/ste_dma40.c                  |    9 +++++----
 drivers/dma/timb_dma.c                   |    2 +-
 drivers/dma/txx9dmac.c                   |    5 +++--
 drivers/media/video/mx3_camera.c         |    2 +-
 drivers/mmc/host/atmel-mci.c             |    2 +-
 drivers/mmc/host/tmio_mmc.c              |    2 +-
 drivers/serial/sh-sci.c                  |    2 +-
 drivers/video/mx3fb.c                    |    2 +-
 include/linux/dmaengine.h                |    5 +++--
 sound/atmel/abdac.c                      |    2 +-
 sound/atmel/ac97c.c                      |    4 ++--
 sound/soc/sh/siu_pcm.c                   |    2 +-
 sound/soc/txx9/txx9aclc.c                |    2 +-
 22 files changed, 46 insertions(+), 39 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-at91/at91sam9g45_devices.c
index 809114d..a005bc9 100644

arch/arm/mach-at91/at91sam9g45_devices.c +1 -1
@@ -68,7 +68,7 @@ static struct platform_device at_hdmac_device = {
 void __init at91_add_device_hdmac(void)
 {
 	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
-	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
drivers/dma/at_hdmac.c +1 -1
index e880760..f94b9d1 100644
@@ -615,7 +615,7 @@ err_desc_get:
 
 
 /**
- * atc_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
+ * atc_prep_slave_sg - prepare descriptors for a DMA_SLAVE_SGLIST transaction
  * @chan: DMA channel
  * @sgl: scatterlist to transfer to/from
  * @sg_len: number of entries in @scatterlist
@@ -1093,7 +1093,7 @@ static int __init at_dma_probe(struct

platform_device *pdev)
if (dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask))
atdma->dma_common.device_prep_dma_memcpy = atc_prep_dma_memcpy;

- if (dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)) {
+ if (dma_has_cap(DMA_SLAVE_SGLIST, atdma->dma_common.cap_mask)) {
atdma->dma_common.device_prep_slave_sg = atc_prep_slave_sg; atdma->dma_common.device_control = atc_control;
}
@@ -1102,8 +1102,8 @@ static int __init at_dma_probe(struct platform_device *pdev)

dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",

-	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  atdma->dma_common.chancnt);
+	  dma_has_cap(DMA_SLAVE_SGLIST, atdma->dma_common.cap_mask) ?

+ "slave " : "", atdma->dma_common.chancnt);

dma_async_device_register(&atdma->dma_common);

drivers/dma/coh901318.c +0 -0
index a724e6b..d744493 100644
@@ -1349,7 +1349,7 @@ static int __init coh901318_probe(struct

platform_device *pdev)
base);

dma_cap_zero(base->dma_slave.cap_mask);
- dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, base->dma_slave.cap_mask);

base->dma_slave.device_alloc_chan_resources = coh901318_alloc_chan_resources; base->dma_slave.device_free_chan_resources = coh901318_free_chan_resources;

drivers/dma/dmaengine.c +6 -3
index 9d31d5e..0d37c76 100644
@@ -300,7 +300,6 @@ static int __init dma_channel_table_init(void)
 	 */
 	clear_bit(DMA_INTERRUPT, dma_cap_mask_all.bits);
 	clear_bit(DMA_PRIVATE, dma_cap_mask_all.bits);
-	clear_bit(DMA_SLAVE, dma_cap_mask_all.bits);
 
 	for_each_dma_cap_mask(cap, dma_cap_mask_all) {
 		channel_table[cap] = alloc_percpu(struct dma_chan_tbl_ent);
@@ -690,9 +689,13 @@ int dma_async_device_register(struct dma_device *device)
 		!device->device_prep_dma_memset);
 	BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) &&
 		!device->device_prep_dma_interrupt);
-	BUG_ON(dma_has_cap(DMA_SLAVE, device->cap_mask) &&
+	BUG_ON(dma_has_cap(DMA_SLAVE_SGLIST, device->cap_mask) &&
 		!device->device_prep_slave_sg);
-	BUG_ON(dma_has_cap(DMA_SLAVE, device->cap_mask) &&
+	BUG_ON(dma_has_cap(DMA_SLAVE_SGLIST, device->cap_mask) &&
+		!device->device_control);
+	BUG_ON(dma_has_cap(DMA_SLAVE_BUFFER, device->cap_mask) &&
+		!device->device_prep_slave_buffer);
+	BUG_ON(dma_has_cap(DMA_SLAVE_BUFFER, device->cap_mask) &&
 		!device->device_control);
 
 	BUG_ON(!device->device_alloc_chan_resources);
drivers/dma/dw_dmac.c +1 -1
index a3991ab..e38ea35 100644
@@ -1334,7 +1334,7 @@ static int __init dw_probe(struct platform_device *pdev)
 	channel_clear_bit(dw, MASK.ERROR, dw->all_chan_mask);
 
 	dma_cap_set(DMA_MEMCPY, dw->dma.cap_mask);
-	dma_cap_set(DMA_SLAVE, dw->dma.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, dw->dma.cap_mask);
 	dw->dma.dev = &pdev->dev;
 	dw->dma.device_alloc_chan_resources = dwc_alloc_chan_resources;
 	dw->dma.device_free_chan_resources = dwc_free_chan_resources;
drivers/dma/fsldma.c +6 -5
index 8088b14..1b9760a 100644
@@ -584,16 +584,17 @@ fail:
 }
 
 /**
- * fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
+ * fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE_SGLIST
+ * transaction
  * @chan: DMA channel
  * @sgl: scatterlist to transfer to/from
  * @sg_len: number of entries in @scatterlist
  * @direction: DMA direction
  * @flags: DMAEngine flags
  *
- * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
- * DMA_SLAVE API, this gets the device-specific information from the
- * chan->private variable.
+ * Prepare a set of descriptors for a DMA_SLAVE_SGLIST transaction.
+ * Following the DMA_SLAVE API, this gets the device-specific information
+ * from the chan->private variable.
  */
 static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
 	struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
@@ -1327,7 +1328,7 @@ static int __devinit fsldma_of_probe(struct of_device *op,
 
 	dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
 	dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
-	dma_cap_set(DMA_SLAVE, fdev->common.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, fdev->common.cap_mask);
 	fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources;
 	fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources;
 	fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
drivers/dma/ipu/ipu_idmac.c +2 -2
index cb26ee9..27d8226 100644
@@ -1665,7 +1665,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
 	struct dma_device *dma = &idmac->dma;
 	int i;
 
-	dma_cap_set(DMA_SLAVE, dma->cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, dma->cap_mask);
 	dma_cap_set(DMA_PRIVATE, dma->cap_mask);
 
 	/* Compulsory common fields */
@@ -1675,7 +1675,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
 	dma->device_tx_status			= idmac_tx_status;
 	dma->device_issue_pending		= idmac_issue_pending;
 
-	/* Compulsory for DMA_SLAVE fields */
+	/* Compulsory for DMA_SLAVE_SGLIST fields */
 	dma->device_prep_slave_sg		= idmac_prep_slave_sg;
 	dma->device_control			= idmac_control;
 
drivers/dma/pl330.c +1 -1
index 7c50f6d..3974357 100644
@@ -727,7 +727,7 @@ pl330_probe(struct amba_device *adev, struct amba_id *id)
 			break;
 		case MEMTODEV:
 		case DEVTOMEM:
-			dma_cap_set(DMA_SLAVE, pd->cap_mask);
+			dma_cap_set(DMA_SLAVE_SGLIST, pd->cap_mask);
 			break;
 		default:
 			dev_err(&adev->dev, "DEVTODEV Not Supported\n");
drivers/dma/shdma.c +0 -0
index fb64cf3..5b09f81 100644
@@ -1040,7 +1040,7 @@ static int __init sh_dmae_probe(struct

platform_device *pdev)

dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); if (dmars)
- dma_cap_set(DMA_SLAVE, shdev->common.cap_mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, shdev->common.cap_mask);

shdev->common.device_alloc_chan_resources
= sh_dmae_alloc_chan_resources;
@@ -1049,7 +1049,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
shdev->common.device_tx_status = sh_dmae_tx_status; shdev->common.device_issue_pending = sh_dmae_memcpy_issue_pending;

- /* Compulsory for DMA_SLAVE fields */
+ /* Compulsory for DMA_SLAVE_SGLIST fields */
shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg; shdev->common.device_control = sh_dmae_control;

drivers/dma/ste_dma40.c +3 -2
index 21a7597..f153800 100644
@@ -1210,14 +1210,15 @@ static int d40_config_memcpy(struct d40_chan *d40c)
 {
 	dma_cap_mask_t cap = d40c->chan.device->cap_mask;
 
-	if (dma_has_cap(DMA_MEMCPY, cap) && !dma_has_cap(DMA_SLAVE, cap)) {
+	if (dma_has_cap(DMA_MEMCPY, cap) &&
+		!dma_has_cap(DMA_SLAVE_SGLIST, cap)) {
 		d40c->dma_cfg = *d40c->base->plat_data->memcpy_conf_log;
 		d40c->dma_cfg.src_dev_type = STEDMA40_DEV_SRC_MEMORY;
 		d40c->dma_cfg.dst_dev_type = d40c->base->plat_data->
 			memcpy[d40c->chan.chan_id];
 
 	} else if (dma_has_cap(DMA_MEMCPY, cap) &&
-		   dma_has_cap(DMA_SLAVE, cap)) {
+		   dma_has_cap(DMA_SLAVE_SGLIST, cap)) {
 		d40c->dma_cfg = *d40c->base->plat_data->memcpy_conf_phy;
 	} else {
 		dev_err(&d40c->chan.dev->device, "[%s] No memcpy\n",
@@ -2143,7 +2144,7 @@ static int __init d40_dmaengine_init(struct

d40_base *base,
0, base->num_log_chans);

dma_cap_zero(base->dma_slave.cap_mask);
- dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, base->dma_slave.cap_mask);

base->dma_slave.device_alloc_chan_resources = d40_alloc_chan_resources; base->dma_slave.device_free_chan_resources = d40_free_chan_resources;
@@ -2196,7 +2197,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
0, num_reserved_chans);

dma_cap_zero(base->dma_both.cap_mask);
- dma_cap_set(DMA_SLAVE, base->dma_both.cap_mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, base->dma_both.cap_mask);
dma_cap_set(DMA_MEMCPY, base->dma_both.cap_mask);

base->dma_both.device_alloc_chan_resources = d40_alloc_chan_resources;

drivers/dma/timb_dma.c +1 -1
index 2ec1ed5..75149883 100644
@@ -744,7 +744,7 @@ static int __devinit td_probe(struct platform_device *pdev)
 	td->dma.device_tx_status		= td_tx_status;
 	td->dma.device_issue_pending		= td_issue_pending;
 
-	dma_cap_set(DMA_SLAVE, td->dma.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, td->dma.cap_mask);
 	dma_cap_set(DMA_PRIVATE, td->dma.cap_mask);
 	td->dma.device_prep_slave_sg = td_prep_slave_sg;
 	td->dma.device_control = td_control;
drivers/dma/txx9dmac.c +0 -0
index cbd83e36..c2d1343 100644
@@ -1164,7 +1164,7 @@ static int __init txx9dmac_chan_probe(struct

platform_device *pdev)
dma_cap_set(DMA_MEMCPY, dc->dma.cap_mask);
} else {
dc->dma.device_prep_slave_sg = txx9dmac_prep_slave_sg;
- dma_cap_set(DMA_SLAVE, dc->dma.cap_mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, dc->dma.cap_mask);
dma_cap_set(DMA_PRIVATE, dc->dma.cap_mask);
}

@@ -1208,7 +1208,8 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "TXx9 DMA Channel (dma%d%s%s)\n",
dc->dma.dev_id,
dma_has_cap(DMA_MEMCPY, dc->dma.cap_mask) ? " memcpy" : "",
- dma_has_cap(DMA_SLAVE, dc->dma.cap_mask) ? " slave" : "");
+ dma_has_cap(DMA_SLAVE_SGLIST, dc->dma.cap_mask) ?
+ " slave" : "");

return 0;
}

drivers/media/video/mx3_camera.c +0 -0
index a9be14c..fd6f735 100644
@@ -780,7 +780,7 @@ static int acquire_dma_channel(struct

mx3_camera_dev *mx3_cam)
}

dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, mask);
dma_cap_set(DMA_PRIVATE, mask);
chan = dma_request_channel(mask, chan_filter, &rq); if (!chan)

drivers/mmc/host/atmel-mci.c +1 -1
index 95ef864..fae4b39 100644
@@ -1728,7 +1728,7 @@ static void atmci_configure_dma(struct atmel_mci *host)
 
 		/* Try to grab a DMA channel */
 		dma_cap_zero(mask);
-		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, mask);
 		host->dma.chan =
 			dma_request_channel(mask, filter, pdata->dma_slave);
 	}
drivers/mmc/host/tmio_mmc.c +1 -1
index ee7d0a5..905ffb2 100644
@@ -591,7 +591,7 @@ static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
 		dma_cap_mask_t mask;
 
 		dma_cap_zero(mask);
-		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 		host->chan_tx = dma_request_channel(mask, tmio_mmc_filter,
 						    pdata->dma->chan_priv_tx);
drivers/serial/sh-sci.c +1 -1
index c291b3a..0efab71 100644
@@ -1316,7 +1316,7 @@ static void sci_request_dma(struct uart_port *port)
 		return;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 	param = &s->param_tx;
 
drivers/video/mx3fb.c +1 -1
index 7cfc170..ced7d86 100644
@@ -1482,7 +1482,7 @@ static int mx3fb_probe(struct platform_device *pdev)
 	rq.mx3fb = mx3fb;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 	dma_cap_set(DMA_PRIVATE, mask);
 	rq.id = IDMAC_SDC_0;
 	chan = dma_request_channel(mask, chan_filter, &rq);
include/linux/dmaengine.h +3 -2
index 3caff1c..b23be6e 100644
@@ -66,11 +66,12 @@ enum dma_transaction_type {
 	DMA_INTERRUPT,
 	DMA_PRIVATE,
 	DMA_ASYNC_TX,
-	DMA_SLAVE,
+	DMA_SLAVE_SGLIST,
+	DMA_SLAVE_BUFFER,
 };
 
 /* last transaction type for creation of the capabilities mask */
-#define DMA_TX_TYPE_END (DMA_SLAVE + 1)
+#define DMA_TX_TYPE_END (DMA_SLAVE_BUFFER + 1)
 
 
 /**
sound/atmel/abdac.c +0 -0
index f2f41c8..642bdea 100644
@@ -473,7 +473,7 @@ static int __devinit atmel_abdac_probe(struct

platform_device *pdev)
dws->tx_reg = regs->start + DAC_DATA;

dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, mask);

dac->dma.chan = dma_request_channel(mask, filter, dws);
}

sound/atmel/ac97c.c +0 -0
index 10c3a87..1f0d328 100644
@@ -1013,7 +1013,7 @@ static int __devinit atmel_ac97c_probe(struct

platform_device *pdev)
dws->rx_reg = regs->start + AC97C_CARHR + 2;

dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, mask);

chip->dma.rx_chan = dma_request_channel(mask, filter,
dws);
@@ -1030,7 +1030,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
dws->tx_reg = regs->start + AC97C_CATHR + 2;

dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, mask);

chip->dma.tx_chan = dma_request_channel(mask, filter,
dws);

sound/soc/sh/siu_pcm.c +1 -1
index 36170be..a8a8738 100644
@@ -350,7 +350,7 @@ static int siu_pcm_open(struct snd_pcm_substream *ss)
 	struct sh_dmae_slave *param;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 	dev_dbg(dev, "%s, port=%d@%p\n", __func__, port, port_info);
 
sound/soc/txx9/txx9aclc.c +0 -0
index 0e345230..11c9525 100644
@@ -331,7 +331,7 @@ static int txx9aclc_dma_init(struct

txx9aclc_soc_device *dev,

/* Try to grab a DMA channel */
dma_cap_zero(mask);
- dma_cap_set(DMA_SLAVE, mask);
+ dma_cap_set(DMA_SLAVE_SGLIST, mask);
dmadata->dma_chan = dma_request_channel(mask, filter, dmadata); if (!dmadata->dma_chan) {
dev_err(dev->soc_dev.dev,

Signature · 8 lines
1.7.2


Both patches are also conveniently attached.


Yours,
Linus Walleij

From 7691634e4a7a39c6a3b3c4bf03af86e371ba3040 Mon Sep 17 00:00:00 2001
From: Linus Walleij <[email protected]>
Date: Thu, 29 Jul 2010 00:14:06 +0200
Subject: [PATCH 1/2] DMAENGINE: add a slave buffer prep call

This makes it possible for engines to implement slave transfers to be done to/from a simple kmalloc():ed memory buffer and not just from scatterlists.

---
 include/linux/dmaengine.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
include/linux/dmaengine.h +8 -1
index 5204f01..3caff1c 100644
@@ -350,7 +350,10 @@ struct dma_tx_state {
  * @device_prep_dma_pq_val: prepares a pqzero_sum operation
  * @device_prep_dma_memset: prepares a memset operation
  * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
- * @device_prep_slave_sg: prepares a slave dma operation
+ * @device_prep_slave_buffer: prepares a slave DMA operation to/from a
+ *	buffer
+ * @device_prep_slave_sg: prepares a slave dma operation to/from a
+ *	scatterlist
  * @device_control: manipulate all pending operations on a channel, returns
  *	zero or error code
  * @device_tx_status: poll for transaction completion, the optional
@@ -403,6 +406,10 @@ struct dma_device {
 	struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
 		struct dma_chan *chan, unsigned long flags);
 
+	struct dma_async_tx_descriptor *(*device_prep_slave_buffer)(
+		struct dma_chan *chan, char *buffer,
+		enum dma_data_direction direction,
+		unsigned long flags);
 	struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
 		struct dma_chan *chan, struct scatterlist *sgl,
 		unsigned int sg_len, enum dma_data_direction direction,
Signature · 1 line
1.7.2

From 1d42fa40f5bd89beca59240a45cf941ab8e17535 Mon Sep 17 00:00:00 2001
From: Linus Walleij <[email protected]>
Date: Thu, 29 Jul 2010 00:42:58 +0200
Subject: [PATCH 2/2] DMAENGINE: slave sglists and buffers

This renames the DMA engine capability DMA_SLAVE to DMA_SLAVE_SGLIST with the semantics that the current implementations assume DMA_SLAVE means the slave supports only scatterlists for inbound/outbound transfers. This completes the previous patch by adding as specific single-buffer DMA capability to the API and renaming all the old users as described.

---
 arch/arm/mach-at91/at91sam9g45_devices.c |    2 +-
 drivers/dma/at_hdmac.c                   |    8 ++++----
 drivers/dma/coh901318.c                  |    2 +-
 drivers/dma/dmaengine.c                  |    9 ++++++---
 drivers/dma/dw_dmac.c                    |    2 +-
 drivers/dma/fsldma.c                     |   11 ++++++-----
 drivers/dma/ipu/ipu_idmac.c              |    4 ++--
 drivers/dma/pl330.c                      |    2 +-
 drivers/dma/shdma.c                      |    4 ++--
 drivers/dma/ste_dma40.c                  |    9 +++++----
 drivers/dma/timb_dma.c                   |    2 +-
 drivers/dma/txx9dmac.c                   |    5 +++--
 drivers/media/video/mx3_camera.c         |    2 +-
 drivers/mmc/host/atmel-mci.c             |    2 +-
 drivers/mmc/host/tmio_mmc.c              |    2 +-
 drivers/serial/sh-sci.c                  |    2 +-
 drivers/video/mx3fb.c                    |    2 +-
 include/linux/dmaengine.h                |    5 +++--
 sound/atmel/abdac.c                      |    2 +-
 sound/atmel/ac97c.c                      |    4 ++--
 sound/soc/sh/siu_pcm.c                   |    2 +-
 sound/soc/txx9/txx9aclc.c                |    2 +-
 22 files changed, 46 insertions(+), 39 deletions(-)
arch/arm/mach-at91/at91sam9g45_devices.c +1 -1
index 809114d..a005bc9 100644
@@ -68,7 +68,7 @@ static struct platform_device at_hdmac_device = {
 void __init at91_add_device_hdmac(void)
 {
 	dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask);
-	dma_cap_set(DMA_SLAVE, atdma_pdata.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, atdma_pdata.cap_mask);
 	platform_device_register(&at_hdmac_device);
 }
 #else
drivers/dma/at_hdmac.c +4 -4
index e880760..f94b9d1 100644
@@ -615,7 +615,7 @@ err_desc_get:
 
 
 /**
- * atc_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
+ * atc_prep_slave_sg - prepare descriptors for a DMA_SLAVE_SGLIST transaction
  * @chan: DMA channel
  * @sgl: scatterlist to transfer to/from
  * @sg_len: number of entries in @scatterlist
@@ -1093,7 +1093,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	if (dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask))
 		atdma->dma_common.device_prep_dma_memcpy = atc_prep_dma_memcpy;
 
-	if (dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)) {
+	if (dma_has_cap(DMA_SLAVE_SGLIST, atdma->dma_common.cap_mask)) {
 		atdma->dma_common.device_prep_slave_sg = atc_prep_slave_sg;
 		atdma->dma_common.device_control = atc_control;
 	}
@@ -1102,8 +1102,8 @@ static int __init at_dma_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",
 	  dma_has_cap(DMA_MEMCPY, atdma->dma_common.cap_mask) ? "cpy " : "",
-	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
-	  atdma->dma_common.chancnt);
+	  dma_has_cap(DMA_SLAVE_SGLIST, atdma->dma_common.cap_mask) ?
+		"slave " : "", atdma->dma_common.chancnt);
 
 	dma_async_device_register(&atdma->dma_common);
 
drivers/dma/coh901318.c +1 -1
index a724e6b..d744493 100644
@@ -1349,7 +1349,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
 			    base);
 
 	dma_cap_zero(base->dma_slave.cap_mask);
-	dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, base->dma_slave.cap_mask);
 
 	base->dma_slave.device_alloc_chan_resources = coh901318_alloc_chan_resources;
 	base->dma_slave.device_free_chan_resources = coh901318_free_chan_resources;
drivers/dma/dmaengine.c +6 -3
index 9d31d5e..0d37c76 100644
@@ -300,7 +300,6 @@ static int __init dma_channel_table_init(void)
 	 */
 	clear_bit(DMA_INTERRUPT, dma_cap_mask_all.bits);
 	clear_bit(DMA_PRIVATE, dma_cap_mask_all.bits);
-	clear_bit(DMA_SLAVE, dma_cap_mask_all.bits);
 
 	for_each_dma_cap_mask(cap, dma_cap_mask_all) {
 		channel_table[cap] = alloc_percpu(struct dma_chan_tbl_ent);
@@ -690,9 +689,13 @@ int dma_async_device_register(struct dma_device *device)
 		!device->device_prep_dma_memset);
 	BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) &&
 		!device->device_prep_dma_interrupt);
-	BUG_ON(dma_has_cap(DMA_SLAVE, device->cap_mask) &&
+	BUG_ON(dma_has_cap(DMA_SLAVE_SGLIST, device->cap_mask) &&
 		!device->device_prep_slave_sg);
-	BUG_ON(dma_has_cap(DMA_SLAVE, device->cap_mask) &&
+	BUG_ON(dma_has_cap(DMA_SLAVE_SGLIST, device->cap_mask) &&
+		!device->device_control);
+	BUG_ON(dma_has_cap(DMA_SLAVE_BUFFER, device->cap_mask) &&
+		!device->device_prep_slave_buffer);
+	BUG_ON(dma_has_cap(DMA_SLAVE_BUFFER, device->cap_mask) &&
 		!device->device_control);
 
 	BUG_ON(!device->device_alloc_chan_resources);
drivers/dma/dw_dmac.c +1 -1
index a3991ab..e38ea35 100644
@@ -1334,7 +1334,7 @@ static int __init dw_probe(struct platform_device *pdev)
 	channel_clear_bit(dw, MASK.ERROR, dw->all_chan_mask);
 
 	dma_cap_set(DMA_MEMCPY, dw->dma.cap_mask);
-	dma_cap_set(DMA_SLAVE, dw->dma.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, dw->dma.cap_mask);
 	dw->dma.dev = &pdev->dev;
 	dw->dma.device_alloc_chan_resources = dwc_alloc_chan_resources;
 	dw->dma.device_free_chan_resources = dwc_free_chan_resources;
drivers/dma/fsldma.c +6 -5
index 8088b14..1b9760a 100644
@@ -584,16 +584,17 @@ fail:
 }
 
 /**
- * fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
+ * fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE_SGLIST
+ * transaction
  * @chan: DMA channel
  * @sgl: scatterlist to transfer to/from
  * @sg_len: number of entries in @scatterlist
  * @direction: DMA direction
  * @flags: DMAEngine flags
  *
- * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
- * DMA_SLAVE API, this gets the device-specific information from the
- * chan->private variable.
+ * Prepare a set of descriptors for a DMA_SLAVE_SGLIST transaction.
+ * Following the DMA_SLAVE API, this gets the device-specific information
+ * from the chan->private variable.
  */
 static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
 	struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
@@ -1327,7 +1328,7 @@ static int __devinit fsldma_of_probe(struct of_device *op,
 
 	dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
 	dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
-	dma_cap_set(DMA_SLAVE, fdev->common.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, fdev->common.cap_mask);
 	fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources;
 	fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources;
 	fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
drivers/dma/ipu/ipu_idmac.c +2 -2
index cb26ee9..27d8226 100644
@@ -1665,7 +1665,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
 	struct dma_device *dma = &idmac->dma;
 	int i;
 
-	dma_cap_set(DMA_SLAVE, dma->cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, dma->cap_mask);
 	dma_cap_set(DMA_PRIVATE, dma->cap_mask);
 
 	/* Compulsory common fields */
@@ -1675,7 +1675,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
 	dma->device_tx_status			= idmac_tx_status;
 	dma->device_issue_pending		= idmac_issue_pending;
 
-	/* Compulsory for DMA_SLAVE fields */
+	/* Compulsory for DMA_SLAVE_SGLIST fields */
 	dma->device_prep_slave_sg		= idmac_prep_slave_sg;
 	dma->device_control			= idmac_control;
 
drivers/dma/pl330.c +1 -1
index 7c50f6d..3974357 100644
@@ -727,7 +727,7 @@ pl330_probe(struct amba_device *adev, struct amba_id *id)
 			break;
 		case MEMTODEV:
 		case DEVTOMEM:
-			dma_cap_set(DMA_SLAVE, pd->cap_mask);
+			dma_cap_set(DMA_SLAVE_SGLIST, pd->cap_mask);
 			break;
 		default:
 			dev_err(&adev->dev, "DEVTODEV Not Supported\n");
drivers/dma/shdma.c +2 -2
index fb64cf3..5b09f81 100644
@@ -1040,7 +1040,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask);
 	if (dmars)
-		dma_cap_set(DMA_SLAVE, shdev->common.cap_mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, shdev->common.cap_mask);
 
 	shdev->common.device_alloc_chan_resources
 		= sh_dmae_alloc_chan_resources;
@@ -1049,7 +1049,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
 	shdev->common.device_tx_status = sh_dmae_tx_status;
 	shdev->common.device_issue_pending = sh_dmae_memcpy_issue_pending;
 
-	/* Compulsory for DMA_SLAVE fields */
+	/* Compulsory for DMA_SLAVE_SGLIST fields */
 	shdev->common.device_prep_slave_sg = sh_dmae_prep_slave_sg;
 	shdev->common.device_control = sh_dmae_control;
 
drivers/dma/ste_dma40.c +5 -4
index 21a7597..f153800 100644
@@ -1210,14 +1210,15 @@ static int d40_config_memcpy(struct d40_chan *d40c)
 {
 	dma_cap_mask_t cap = d40c->chan.device->cap_mask;
 
-	if (dma_has_cap(DMA_MEMCPY, cap) && !dma_has_cap(DMA_SLAVE, cap)) {
+	if (dma_has_cap(DMA_MEMCPY, cap) &&
+		!dma_has_cap(DMA_SLAVE_SGLIST, cap)) {
 		d40c->dma_cfg = *d40c->base->plat_data->memcpy_conf_log;
 		d40c->dma_cfg.src_dev_type = STEDMA40_DEV_SRC_MEMORY;
 		d40c->dma_cfg.dst_dev_type = d40c->base->plat_data->
 			memcpy[d40c->chan.chan_id];
 
 	} else if (dma_has_cap(DMA_MEMCPY, cap) &&
-		   dma_has_cap(DMA_SLAVE, cap)) {
+		   dma_has_cap(DMA_SLAVE_SGLIST, cap)) {
 		d40c->dma_cfg = *d40c->base->plat_data->memcpy_conf_phy;
 	} else {
 		dev_err(&d40c->chan.dev->device, "[%s] No memcpy\n",
@@ -2143,7 +2144,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
 		      0, base->num_log_chans);
 
 	dma_cap_zero(base->dma_slave.cap_mask);
-	dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, base->dma_slave.cap_mask);
 
 	base->dma_slave.device_alloc_chan_resources = d40_alloc_chan_resources;
 	base->dma_slave.device_free_chan_resources = d40_free_chan_resources;
@@ -2196,7 +2197,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
 		      0, num_reserved_chans);
 
 	dma_cap_zero(base->dma_both.cap_mask);
-	dma_cap_set(DMA_SLAVE, base->dma_both.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, base->dma_both.cap_mask);
 	dma_cap_set(DMA_MEMCPY, base->dma_both.cap_mask);
 
 	base->dma_both.device_alloc_chan_resources = d40_alloc_chan_resources;
drivers/dma/timb_dma.c +1 -1
index 2ec1ed5..75149883 100644
@@ -744,7 +744,7 @@ static int __devinit td_probe(struct platform_device *pdev)
 	td->dma.device_tx_status		= td_tx_status;
 	td->dma.device_issue_pending		= td_issue_pending;
 
-	dma_cap_set(DMA_SLAVE, td->dma.cap_mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, td->dma.cap_mask);
 	dma_cap_set(DMA_PRIVATE, td->dma.cap_mask);
 	td->dma.device_prep_slave_sg = td_prep_slave_sg;
 	td->dma.device_control = td_control;
drivers/dma/txx9dmac.c +3 -2
index cbd83e36..c2d1343 100644
@@ -1164,7 +1164,7 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev)
 		dma_cap_set(DMA_MEMCPY, dc->dma.cap_mask);
 	} else {
 		dc->dma.device_prep_slave_sg = txx9dmac_prep_slave_sg;
-		dma_cap_set(DMA_SLAVE, dc->dma.cap_mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, dc->dma.cap_mask);
 		dma_cap_set(DMA_PRIVATE, dc->dma.cap_mask);
 	}
 
@@ -1208,7 +1208,8 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev)
 	dev_dbg(&pdev->dev, "TXx9 DMA Channel (dma%d%s%s)\n",
 		dc->dma.dev_id,
 		dma_has_cap(DMA_MEMCPY, dc->dma.cap_mask) ? " memcpy" : "",
-		dma_has_cap(DMA_SLAVE, dc->dma.cap_mask) ? " slave" : "");
+		dma_has_cap(DMA_SLAVE_SGLIST, dc->dma.cap_mask) ?
+		" slave" : "");
 
 	return 0;
 }
drivers/media/video/mx3_camera.c +1 -1
index a9be14c..fd6f735 100644
@@ -780,7 +780,7 @@ static int acquire_dma_channel(struct mx3_camera_dev *mx3_cam)
 	}
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 	dma_cap_set(DMA_PRIVATE, mask);
 	chan = dma_request_channel(mask, chan_filter, &rq);
 	if (!chan)
drivers/mmc/host/atmel-mci.c +1 -1
index 95ef864..fae4b39 100644
@@ -1728,7 +1728,7 @@ static void atmci_configure_dma(struct atmel_mci *host)
 
 		/* Try to grab a DMA channel */
 		dma_cap_zero(mask);
-		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, mask);
 		host->dma.chan =
 			dma_request_channel(mask, filter, pdata->dma_slave);
 	}
drivers/mmc/host/tmio_mmc.c +1 -1
index ee7d0a5..905ffb2 100644
@@ -591,7 +591,7 @@ static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
 		dma_cap_mask_t mask;
 
 		dma_cap_zero(mask);
-		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 		host->chan_tx = dma_request_channel(mask, tmio_mmc_filter,
 						    pdata->dma->chan_priv_tx);
drivers/serial/sh-sci.c +1 -1
index c291b3a..0efab71 100644
@@ -1316,7 +1316,7 @@ static void sci_request_dma(struct uart_port *port)
 		return;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 	param = &s->param_tx;
 
drivers/video/mx3fb.c +1 -1
index 7cfc170..ced7d86 100644
@@ -1482,7 +1482,7 @@ static int mx3fb_probe(struct platform_device *pdev)
 	rq.mx3fb = mx3fb;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 	dma_cap_set(DMA_PRIVATE, mask);
 	rq.id = IDMAC_SDC_0;
 	chan = dma_request_channel(mask, chan_filter, &rq);
include/linux/dmaengine.h +3 -2
index 3caff1c..b23be6e 100644
@@ -66,11 +66,12 @@ enum dma_transaction_type {
 	DMA_INTERRUPT,
 	DMA_PRIVATE,
 	DMA_ASYNC_TX,
-	DMA_SLAVE,
+	DMA_SLAVE_SGLIST,
+	DMA_SLAVE_BUFFER,
 };
 
 /* last transaction type for creation of the capabilities mask */
-#define DMA_TX_TYPE_END (DMA_SLAVE + 1)
+#define DMA_TX_TYPE_END (DMA_SLAVE_BUFFER + 1)
 
 
 /**
sound/atmel/abdac.c +1 -1
index f2f41c8..642bdea 100644
@@ -473,7 +473,7 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev)
 		dws->tx_reg = regs->start + DAC_DATA;
 
 		dma_cap_zero(mask);
-		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 		dac->dma.chan = dma_request_channel(mask, filter, dws);
 	}
sound/atmel/ac97c.c +2 -2
index 10c3a87..1f0d328 100644
@@ -1013,7 +1013,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
 			dws->rx_reg = regs->start + AC97C_CARHR + 2;
 
 			dma_cap_zero(mask);
-			dma_cap_set(DMA_SLAVE, mask);
+			dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 			chip->dma.rx_chan = dma_request_channel(mask, filter,
 								dws);
@@ -1030,7 +1030,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
 			dws->tx_reg = regs->start + AC97C_CATHR + 2;
 
 			dma_cap_zero(mask);
-			dma_cap_set(DMA_SLAVE, mask);
+			dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 			chip->dma.tx_chan = dma_request_channel(mask, filter,
 								dws);
sound/soc/sh/siu_pcm.c +1 -1
index 36170be..a8a8738 100644
@@ -350,7 +350,7 @@ static int siu_pcm_open(struct snd_pcm_substream *ss)
 	struct sh_dmae_slave *param;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 
 	dev_dbg(dev, "%s, port=%d@%p\n", __func__, port, port_info);
 
sound/soc/txx9/txx9aclc.c +1 -1
index 0e345230..11c9525 100644
@@ -331,7 +331,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev,
 
 	/* Try to grab a DMA channel */
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
+	dma_cap_set(DMA_SLAVE_SGLIST, mask);
 	dmadata->dma_chan = dma_request_channel(mask, filter, dmadata);
 	if (!dmadata->dma_chan) {
 		dev_err(dev->soc_dev.dev,
Signature · 1 line
1.7.2