Skip to contentSkip to conversation

dmaengine: move to enum dma_transfer_direction

PATCH In review Vinod Koul 17 participants 52 messages Oct 14, 2011 – Nov 21, 2011

Subsystems (26)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

cover dmaengine: move to enum dma_transfer_direction

From: Vinod Koul <[email protected]>

As discussed recently on new interleaved dma patchset, the direction in dmaengine needs improvement and as suggested by Jassi, this patchset move dmaengine and dmacs, clients to use new enum dma_transfer_direction to indicate the dma direction and mode

Vinod Koul (10):
dmaengine: add new enum dma_transfer_direction
dmaengine: move drivers to dma_transfer_direction
plat-samsung: move to dma_transfer_direction
media-video: move to dma_transfer_direction
carma: move to dma_transfer_direction
mmc-host: move to dma_transfer_direction spi, serial: move to dma_transfer_direction
sound-soc: move to dma_transfer_direction
USB: move to dma_transfer_direction
net-ks8842: move to dma_transfer_direction

 arch/arm/mach-ep93xx/include/mach/dma.h        |    6 ++--
 arch/arm/plat-nomadik/include/plat/ste_dma40.h |    4 +-
 arch/arm/plat-samsung/dma-ops.c                |    4 +-
 arch/arm/plat-samsung/include/plat/dma-ops.h   |    4 +-
 drivers/dma/amba-pl08x.c                       |   24 +++++++++++-----------
 drivers/dma/at_hdmac.c                         |   22 ++++++++++----------
 drivers/dma/coh901318.c                        |   12 +++++-----
 drivers/dma/coh901318_lli.c                    |   23 ++++++++++-----------
 drivers/dma/coh901318_lli.h                    |    4 +-
 drivers/dma/dw_dmac.c                          |   14 ++++++------
 drivers/dma/ep93xx_dma.c                       |   22 ++++++++++----------
 drivers/dma/fsldma.c                           |    4 +-
 drivers/dma/imx-dma.c                          |   10 ++++----
 drivers/dma/imx-sdma.c                         |   10 ++++----
 drivers/dma/intel_mid_dma.c                    |   14 ++++++------
 drivers/dma/intel_mid_dma_regs.h               |    2 +-
 drivers/dma/ipu/ipu_idmac.c                    |    4 +-
 drivers/dma/mxs-dma.c                          |    8 +++---
 drivers/dma/pch_dma.c                          |   12 +++++-----
 drivers/dma/pl330.c                            |   18 ++++++++--------
 drivers/dma/shdma.c                            |   25 +++++++++++------------
 drivers/dma/ste_dma40.c                        |   26 ++++++++++++------------
 drivers/dma/timb_dma.c                         |   18 ++++++++--------
 drivers/dma/txx9dmac.c                         |   12 +++++-----
 drivers/media/video/mx3_camera.c               |    2 +-
 drivers/media/video/timblogiw.c                |    2 +-
 drivers/misc/carma/carma-fpga-program.c        |    2 +-
 drivers/mmc/host/atmel-mci.c                   |    9 +++++--
 drivers/mmc/host/mmci.c                        |   11 ++++++---
 drivers/mmc/host/mxcmmc.c                      |   10 ++++++--
 drivers/mmc/host/mxs-mmc.c                     |    7 +++++-
 drivers/mmc/host/sh_mmcif.c                    |    4 +-
 drivers/mmc/host/tmio_mmc_dma.c                |    4 +-
 drivers/net/ks8842.c                           |    4 +-
 drivers/spi/spi-dw-mid.c                       |    8 +++---
 drivers/spi/spi-ep93xx.c                       |    5 +++-
 drivers/spi/spi-pl022.c                        |    8 +++---
 drivers/spi/spi-topcliff-pch.c                 |    4 +-
 drivers/tty/serial/amba-pl011.c                |    8 +++---
 drivers/tty/serial/pch_uart.c                  |    4 +-
 drivers/tty/serial/sh-sci.c                    |    4 +-
 drivers/usb/musb/ux500_dma.c                   |    4 +-
 drivers/usb/renesas_usbhs/fifo.c               |    4 +-
 drivers/video/mx3fb.c                          |    4 +-
 include/linux/amba/pl08x.h                     |    4 +-
 include/linux/dmaengine.h                      |   22 +++++++++++++++----
 include/linux/dw_dmac.h                        |    2 +-
 include/linux/sh_dma.h                         |    2 +-
 sound/atmel/abdac.c                            |    2 +-
 sound/atmel/ac97c.c                            |   10 ++++----
 sound/soc/ep93xx/ep93xx-pcm.c                  |    4 +-
 sound/soc/imx/imx-pcm-dma-mx2.c                |    6 ++--
 sound/soc/samsung/dma.c                        |    4 +-
 sound/soc/sh/siu_pcm.c                         |    4 +-
 sound/soc/txx9/txx9aclc.c                      |    2 +-
 55 files changed, 250 insertions(+), 222 deletions(-)
author
#1 lore raw

PATCH 1/10 dmaengine: add new enum dma_transfer_direction

From: Vinod Koul <[email protected]>

This new enum removes usage of dma_data_direction for dma direction. The new enum cleans tells the DMA direction and mode
This further paves way for merging the dmaengine _prep operations and also for interleaved dma

---
 include/linux/dmaengine.h |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
include/linux/dmaengine.h +17 -5
index ace51af..24942ad 100644
@@ -23,7 +23,6 @@
 
 #include <linux/device.h>
 #include <linux/uio.h>
-#include <linux/dma-direction.h>
 #include <linux/scatterlist.h>
 
 /**
@@ -75,6 +74,19 @@ enum dma_transaction_type {
 /* last transaction type for creation of the capabilities mask */
 #define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
 
+/**
+ * enum dma_transfer_direction - dma transfer mode and direction indicator
+ * @MEM_TO_MEM: Async/Memcpy mode
+ * @MEM_TO_DEV: Slave mode & From Memory to Device
+ * @DEV_TO_MEM: Slave mode & From Device to Memory
+ * @DEV_TO_DEV: Slave mode & From Device to Device
+ */
+enum dma_transfer_direction {
+	MEM_TO_MEM,
+	MEM_TO_DEV,
+	DEV_TO_MEM,
+	DEV_TO_DEV,
+};
 
 /**
  * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -267,7 +279,7 @@ enum dma_slave_buswidth {
  * struct, if applicable.
  */
 struct dma_slave_config {
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	dma_addr_t src_addr;
 	dma_addr_t dst_addr;
 	enum dma_slave_buswidth src_addr_width;
@@ -490,11 +502,11 @@ struct dma_device {
 
 	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,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags);
 	struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
 		struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
-		size_t period_len, enum dma_data_direction direction);
+		size_t period_len, enum dma_transfer_direction direction);
 	int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 		unsigned long arg);
 
@@ -520,7 +532,7 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
 
 static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
 	struct dma_chan *chan, void *buf, size_t len,
-	enum dma_data_direction dir, unsigned long flags)
+	enum dma_transfer_direction dir, unsigned long flags)
 {
 	struct scatterlist sg;
 	sg_init_one(&sg, buf, len);
Signature · 1 line
1.7.0.4
Reviewed-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] dmaengine: add new enum dma_transfer_direction

2011/10/14 Vinod Koul <[email protected]>:

Quoted 9 lines

From: Vinod Koul <[email protected]>

This new enum removes usage of dma_data_direction for dma direction. The new enum cleans tells the DMA direction and mode
This further paves way for merging the dmaengine _prep operations and also for interleaved dma

Quoted 72 lines

---
 include/linux/dmaengine.h |   22 +++++++++++++++++-----

 1 files changed, 17 insertions(+), 5 deletions(-)
include/linux/dmaengine.h +14 -2
index ace51af..24942ad 100644
@@ -23,7 +23,6 @@
 
  #include <linux/device.h>
  #include <linux/uio.h>
-#include <linux/dma-direction.h>
  #include <linux/scatterlist.h>
 
  /**
@@ -75,6 +74,19 @@ enum dma_transaction_type {
  /* last transaction type for creation of the capabilities mask */
  #define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
 
+/**
+ * enum dma_transfer_direction - dma transfer mode and direction indicator
+ * @MEM_TO_MEM: Async/Memcpy mode
+ * @MEM_TO_DEV: Slave mode & From Memory to Device
+ * @DEV_TO_MEM: Slave mode & From Device to Memory
+ * @DEV_TO_DEV: Slave mode & From Device to Device
+ */
+enum dma_transfer_direction {
+       MEM_TO_MEM,
+       MEM_TO_DEV,
+       DEV_TO_MEM,
+       DEV_TO_DEV,
+};
 
  /**
  * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -267,7 +279,7 @@ enum dma_slave_buswidth {
  * struct, if applicable.
  */
  struct dma_slave_config {
-       enum dma_data_direction direction;
+       enum dma_transfer_direction direction;
        dma_addr_t src_addr;
        dma_addr_t dst_addr;
        enum dma_slave_buswidth src_addr_width;
@@ -490,11 +502,11 @@ struct dma_device {
 

       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,
+               unsigned int sg_len, enum dma_transfer_direction direction, unsigned long flags);
       struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
-               size_t period_len, enum dma_data_direction direction);
+               size_t period_len, enum dma_transfer_direction direction); int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned long arg);

include/linux/dmaengine.h +0 -0
@@ -520,7 +532,7 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
 

 static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( struct dma_chan *chan, void *buf, size_t len,
-       enum dma_data_direction dir, unsigned long flags)
+       enum dma_transfer_direction dir, unsigned long flags)
 {
       struct scatterlist sg;
       sg_init_one(&sg, buf, len);
--
1.7.0.4

#3 lore raw

Re: [PATCH 01/10] dmaengine: add new enum dma_transfer_direction

In reply to Vinod Koul
Quoted 44 lines · Vinod Koul

This new enum removes usage of dma_data_direction for dma direction. The new enum cleans tells the DMA direction and mode
This further paves way for merging the dmaengine _prep operations and also for interleaved dma

---
 include/linux/dmaengine.h |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
include/linux/dmaengine.h +13 -1
index ace51af..24942ad 100644
@@ -23,7 +23,6 @@
 
 #include <linux/device.h>
 #include <linux/uio.h>
-#include <linux/dma-direction.h>
 #include <linux/scatterlist.h>
 
 /**
@@ -75,6 +74,19 @@ enum dma_transaction_type {
 /* last transaction type for creation of the capabilities mask */
 #define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
 
+/**
+ * enum dma_transfer_direction - dma transfer mode and direction indicator
+ * @MEM_TO_MEM: Async/Memcpy mode
+ * @MEM_TO_DEV: Slave mode & From Memory to Device
+ * @DEV_TO_MEM: Slave mode & From Device to Memory
+ * @DEV_TO_DEV: Slave mode & From Device to Device
+ */
+enum dma_transfer_direction {
+	MEM_TO_MEM,
+	MEM_TO_DEV,
+	DEV_TO_MEM,
+	DEV_TO_DEV,
+};
 
 /**
  * enum dma_ctrl_flags - DMA flags to augment operation preparation,

include/linux/dmaengine.h enum dma_slave_buswidth { · line 282

Quoted 5 lines
include/linux/dmaengine.h +1 -1
@@ -267,7 +279,7 @@ enum dma_slave_buswidth {
  * struct, if applicable.
  */
 struct dma_slave_config {
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;

I thought we were killing this off - surely now is a good time, rather than allowing it to persist with this ambiguous change of functionality.

include/linux/dmaengine.h struct dma_device { · line 505

Quoted 9 lines
include/linux/dmaengine.h +1 -1
 	dma_addr_t src_addr;
 	dma_addr_t dst_addr;
 	enum dma_slave_buswidth src_addr_width;
@@ -490,11 +502,11 @@ struct dma_device {
 
 	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,
+		unsigned int sg_len, enum dma_transfer_direction direction,

Does this make any sense? The API takes a single scatterlist of memory locations - so MEM_TO_MEM and DEV_TO_DEV are meaningless for this API.

If it took two scatterlists and two device addresses, then maybe it would - but I don't see the point of this change (and all the users of this API also needing to change) when the API is specifically for memory scatterlist to/from a device.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#4 lore raw

Re: [PATCH 01/10] dmaengine: add new enum dma_transfer_direction

2011/10/15 Russell King <[email protected]>:

Quoted 59 lines · Vinod Koul
Quoted 44 lines

This new enum removes usage of dma_data_direction for dma direction. The new enum cleans tells the DMA direction and mode
This further paves way for merging the dmaengine _prep operations and also for interleaved dma

---
 include/linux/dmaengine.h |   22 +++++++++++++++++-----

 1 files changed, 17 insertions(+), 5 deletions(-)
include/linux/dmaengine.h +13 -1
index ace51af..24942ad 100644
@@ -23,7 +23,6 @@
 
  #include <linux/device.h>
  #include <linux/uio.h>
-#include <linux/dma-direction.h>
  #include <linux/scatterlist.h>
 
  /**
@@ -75,6 +74,19 @@ enum dma_transaction_type {
  /* last transaction type for creation of the capabilities mask */
  #define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
 
+/**
+ * enum dma_transfer_direction - dma transfer mode and direction indicator
+ * @MEM_TO_MEM: Async/Memcpy mode
+ * @MEM_TO_DEV: Slave mode & From Memory to Device
+ * @DEV_TO_MEM: Slave mode & From Device to Memory
+ * @DEV_TO_DEV: Slave mode & From Device to Device
+ */
+enum dma_transfer_direction {
+     MEM_TO_MEM,
+     MEM_TO_DEV,
+     DEV_TO_MEM,
+     DEV_TO_DEV,
+};
 
  /**
   * enum dma_ctrl_flags - DMA flags to augment operation preparation,

include/linux/dmaengine.h enum dma_slave_buswidth { · line 282

Quoted 5 lines
include/linux/dmaengine.h +1 -1
@@ -267,7 +279,7 @@ enum dma_slave_buswidth {
   * struct, if applicable.
   */
  struct dma_slave_config {
-     enum dma_data_direction direction;
+     enum dma_transfer_direction direction;

I thought we were killing this off - surely now is a good time, rather than allowing it to persist with this ambiguous change of functionality.

Quoted 5 lines
include/linux/dmaengine.h +0 -0
       dma_addr_t src_addr;
       dma_addr_t dst_addr;
       enum dma_slave_buswidth src_addr_width;
@@ -490,11 +502,11 @@ struct dma_device {
 
Quoted 7 lines
Quoted 4 lines

      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,
+             unsigned int sg_len, enum dma_transfer_direction direction,

Does this make any sense?  The API takes a single scatterlist of memory locations - so MEM_TO_MEM and DEV_TO_DEV are meaningless for this API.

so people don't give MEM_TO_MEM and DEV_TO_DEV to this function. This function only accept a subset of the data_transfer_direction.

if we use dma_data_direction, this function doesn't accept DMA_BIDIRECTIONAL and DMA_NONE as well:
enum dma_data_direction {
DMA_BIDIRECTIONAL = 0,
DMA_TO_DEVICE = 1,
DMA_FROM_DEVICE = 2,
DMA_NONE = 3,
};
DMA_BIDIRECTIONAL and DMA_NONE are also meaningless for this API.

i think this patch makes sense if we consider dma_data_direction is actually mapping direction. dma_transfer_direction is a new structure describling the real dma source and dest. and the new interleaved api will accept all 4 directions.

Quoted 11 lines

If it took two scatterlists and two device addresses, then maybe it would - but I don't see the point of this change (and all the users of this API also needing to change) when the API is specifically for memory scatterlist to/from a device.

--
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

-barry

#5 lore raw

Re: [PATCH 01/10] dmaengine: add new enum dma_transfer_direction

In reply to Russell King
Quoted 6 lines · Russell King
Quoted 5 lines · Vinod Koul

This new enum removes usage of dma_data_direction for dma direction. The new enum cleans tells the DMA direction and mode
This further paves way for merging the dmaengine _prep operations and also for interleaved dma

Quoted 11 lines

include/linux/dmaengine.h enum dma_slave_buswidth { · line 282

Quoted 8 lines

/**
* enum dma_ctrl_flags - DMA flags to augment operation preparation,

include/linux/dmaengine.h +1 -1
@@ -267,7 +279,7 @@ enum dma_slave_buswidth {
  * struct, if applicable.
  */
 struct dma_slave_config {
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;

I thought we were killing this off - surely now is a good time, rather than allowing it to persist with this ambiguous change of functionality.

Ah yes, I will probably do that next week, this is by product of global replace done on this file :)

Quoted 14 lines

include/linux/dmaengine.h struct dma_device { · line 505

Quoted 10 lines
include/linux/dmaengine.h +1 -1
 	dma_addr_t src_addr;
 	dma_addr_t dst_addr;
 	enum dma_slave_buswidth src_addr_width;
@@ -490,11 +502,11 @@ struct dma_device {
 
 	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,
+		unsigned int sg_len, enum dma_transfer_direction direction,

Does this make any sense? The API takes a single scatterlist of memory locations - so MEM_TO_MEM and DEV_TO_DEV are meaningless for this API.

Quoted 4 lines

If it took two scatterlists and two device addresses, then maybe it would - but I don't see the point of this change (and all the users of this API also needing to change) when the API is specifically for memory scatterlist to/from a device.

dma_data_direction is meaningless to dmacs. We were overloading that to convey slave direction, so we came up with better way to handle this. The big plus point would be for the proposed interleaved dmaengine api, this would convey what is mode (memcpy/slave) and direction in case of slave cleanly.

Signature · 1 line
~Vinod
author
#6 lore raw

PATCH 2/10 dmaengine: move drivers to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Jassi Brar <[email protected]>
Cc Russell King <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc H Hartley Sweeten <[email protected]>
Cc Li Yang <[email protected]>
Cc Zhang Wei <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Yong Wang <[email protected]>
Cc Tomoya MORINAGA <[email protected]>
Cc Boojin Kim <[email protected]>
Cc Barry Song <[email protected]>
---
 arch/arm/mach-ep93xx/include/mach/dma.h        |    6 ++--
 arch/arm/plat-nomadik/include/plat/ste_dma40.h |    4 +-
 drivers/dma/amba-pl08x.c                       |   24 +++++++++++-----------
 drivers/dma/at_hdmac.c                         |   22 ++++++++++----------
 drivers/dma/coh901318.c                        |   12 +++++-----
 drivers/dma/coh901318_lli.c                    |   23 ++++++++++-----------
 drivers/dma/coh901318_lli.h                    |    4 +-
 drivers/dma/dw_dmac.c                          |   14 ++++++------
 drivers/dma/ep93xx_dma.c                       |   22 ++++++++++----------
 drivers/dma/fsldma.c                           |    4 +-
 drivers/dma/imx-dma.c                          |   10 ++++----
 drivers/dma/imx-sdma.c                         |   10 ++++----
 drivers/dma/intel_mid_dma.c                    |   14 ++++++------
 drivers/dma/intel_mid_dma_regs.h               |    2 +-
 drivers/dma/ipu/ipu_idmac.c                    |    4 +-
 drivers/dma/mxs-dma.c                          |    8 +++---
 drivers/dma/pch_dma.c                          |   12 +++++-----
 drivers/dma/pl330.c                            |   18 ++++++++--------
 drivers/dma/shdma.c                            |   25 +++++++++++------------
 drivers/dma/ste_dma40.c                        |   26 ++++++++++++------------
 drivers/dma/timb_dma.c                         |   18 ++++++++--------
 drivers/dma/txx9dmac.c                         |   12 +++++-----
 include/linux/amba/pl08x.h                     |    4 +-
 include/linux/dw_dmac.h                        |    2 +-
 include/linux/sh_dma.h                         |    2 +-
 25 files changed, 150 insertions(+), 152 deletions(-)
arch/arm/mach-ep93xx/include/mach/dma.h +3 -3
index 46d4d87..ba4767b 100644
@@ -37,7 +37,7 @@
  */
 struct ep93xx_dma_data {
 	int				port;
-	enum dma_data_direction		direction;
+	enum dma_transfer_direction	direction;
 	const char			*name;
 };
 
@@ -80,14 +80,14 @@ static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan)
  * channel supports given DMA direction. Only M2P channels have such
  * limitation, for M2M channels the direction is configurable.
  */
-static inline enum dma_data_direction
+static inline enum dma_transfer_direction
 ep93xx_dma_chan_direction(struct dma_chan *chan)
 {
 	if (!ep93xx_dma_chan_is_m2p(chan))
 		return DMA_NONE;
 
 	/* even channels are for TX, odd for RX */
-	return (chan->chan_id % 2 == 0) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	return (chan->chan_id % 2 == 0) ? MEM_TO_DEV : DEV_TO_MEM;
 }
 
 #endif /* __ASM_ARCH_DMA_H */
arch/arm/plat-nomadik/include/plat/ste_dma40.h +2 -2
index 685c787..38b041a 100644
@@ -187,7 +187,7 @@ static inline struct
 dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
 					    dma_addr_t addr,
 					    unsigned int size,
-					    enum dma_data_direction direction,
+					    enum dma_transfer_direction direction,
 					    unsigned long flags)
 {
 	struct scatterlist sg;
@@ -209,7 +209,7 @@ static inline struct
 dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
 					    dma_addr_t addr,
 					    unsigned int size,
-					    enum dma_data_direction direction,
+					    enum dma_transfer_direction direction,
 					    unsigned long flags)
 {
 	return NULL;
drivers/dma/amba-pl08x.c +12 -12
index b7cbd1a..36cb9af 100644
@@ -882,9 +882,9 @@ static int prep_phy_channel(struct pl08x_dma_chan *plchan,
 		ch->signal = ret;
 
 		/* Assign the flow control signal to this channel */
-		if (txd->direction == DMA_TO_DEVICE)
+		if (txd->direction == MEM_TO_DEV)
 			txd->ccfg |= ch->signal << PL080_CONFIG_DST_SEL_SHIFT;
-		else if (txd->direction == DMA_FROM_DEVICE)
+		else if (txd->direction == DEV_TO_MEM)
 			txd->ccfg |= ch->signal << PL080_CONFIG_SRC_SEL_SHIFT;
 	}
 
@@ -1102,10 +1102,10 @@ static int dma_set_runtime_config(struct dma_chan *chan,
 
 	/* Transfer direction */
 	plchan->runtime_direction = config->direction;
-	if (config->direction == DMA_TO_DEVICE) {
+	if (config->direction == MEM_TO_DEV) {
 		addr_width = config->dst_addr_width;
 		maxburst = config->dst_maxburst;
-	} else if (config->direction == DMA_FROM_DEVICE) {
+	} else if (config->direction == DEV_TO_MEM) {
 		addr_width = config->src_addr_width;
 		maxburst = config->src_maxburst;
 	} else {
@@ -1136,7 +1136,7 @@ static int dma_set_runtime_config(struct dma_chan *chan,
 	cctl |= burst << PL080_CONTROL_SB_SIZE_SHIFT;
 	cctl |= burst << PL080_CONTROL_DB_SIZE_SHIFT;
 
-	if (plchan->runtime_direction == DMA_FROM_DEVICE) {
+	if (plchan->runtime_direction == DEV_TO_MEM) {
 		plchan->src_addr = config->src_addr;
 		plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR |
 			pl08x_select_bus(plchan->cd->periph_buses,
@@ -1152,7 +1152,7 @@ static int dma_set_runtime_config(struct dma_chan *chan,
 		"configured channel %s (%s) for %s, data width %d, "
 		"maxburst %d words, LE, CCTL=0x%08x\n",
 		dma_chan_name(chan), plchan->name,
-		(config->direction == DMA_FROM_DEVICE) ? "RX" : "TX",
+		(config->direction == DEV_TO_MEM) ? "RX" : "TX",
 		addr_width,
 		maxburst,
 		cctl);
@@ -1322,7 +1322,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
 
 static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
 		struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
@@ -1354,10 +1354,10 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
 	 */
 	txd->direction = direction;
 
-	if (direction == DMA_TO_DEVICE) {
+	if (direction == MEM_TO_DEV) {
 		txd->cctl = plchan->dst_cctl;
 		slave_addr = plchan->dst_addr;
-	} else if (direction == DMA_FROM_DEVICE) {
+	} else if (direction == DEV_TO_MEM) {
 		txd->cctl = plchan->src_cctl;
 		slave_addr = plchan->src_addr;
 	} else {
@@ -1368,10 +1368,10 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
 	}
 
 	if (plchan->cd->device_fc)
-		tmp = (direction == DMA_TO_DEVICE) ? PL080_FLOW_MEM2PER_PER :
+		tmp = (direction == MEM_TO_DEV) ? PL080_FLOW_MEM2PER_PER :
 			PL080_FLOW_PER2MEM_PER;
 	else
-		tmp = (direction == DMA_TO_DEVICE) ? PL080_FLOW_MEM2PER :
+		tmp = (direction == MEM_TO_DEV) ? PL080_FLOW_MEM2PER :
 			PL080_FLOW_PER2MEM;
 
 	txd->ccfg |= tmp << PL080_CONFIG_FLOW_CONTROL_SHIFT;
@@ -1387,7 +1387,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
 		list_add_tail(&dsg->node, &txd->dsg_list);
 
 		dsg->len = sg_dma_len(sg);
-		if (direction == DMA_TO_DEVICE) {
+		if (direction == MEM_TO_DEV) {
 			dsg->src_addr = sg_phys(sg);
 			dsg->dst_addr = slave_addr;
 		} else {
drivers/dma/at_hdmac.c +11 -11
index fcfa0a8..7968a81 100644
@@ -660,7 +660,7 @@ err_desc_get:
  */
 static struct dma_async_tx_descriptor *
 atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
@@ -678,7 +678,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 
 	dev_vdbg(chan2dev(chan), "prep_slave_sg (%d): %s f0x%lx\n",
 			sg_len,
-			direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE",
+			direction == MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
 			flags);
 
 	if (unlikely(!atslave || !sg_len)) {
@@ -692,7 +692,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	ctrlb = ATC_IEN;
 
 	switch (direction) {
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		ctrla |=  ATC_DST_WIDTH(reg_width);
 		ctrlb |=  ATC_DST_ADDR_MODE_FIXED
 			| ATC_SRC_ADDR_MODE_INCR
@@ -725,7 +725,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			total_len += len;
 		}
 		break;
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		ctrla |=  ATC_SRC_WIDTH(reg_width);
 		ctrlb |=  ATC_DST_ADDR_MODE_INCR
 			| ATC_SRC_ADDR_MODE_FIXED
@@ -787,7 +787,7 @@ err_desc_get:
  */
 static int
 atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	if (period_len > (ATC_BTSIZE_MAX << reg_width))
 		goto err_out;
@@ -795,7 +795,7 @@ atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
 		goto err_out;
 	if (unlikely(buf_addr & ((1 << reg_width) - 1)))
 		goto err_out;
-	if (unlikely(!(direction & (DMA_TO_DEVICE | DMA_FROM_DEVICE))))
+	if (unlikely(!(direction & (DEV_TO_MEM | MEM_TO_DEV))))
 		goto err_out;
 
 	return 0;
@@ -810,7 +810,7 @@ err_out:
 static int
 atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
 		unsigned int period_index, dma_addr_t buf_addr,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	u32		ctrla;
 	unsigned int	reg_width = atslave->reg_width;
@@ -822,7 +822,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
 		| period_len >> reg_width;
 
 	switch (direction) {
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		desc->lli.saddr = buf_addr + (period_len * period_index);
 		desc->lli.daddr = atslave->tx_reg;
 		desc->lli.ctrla = ctrla;
@@ -833,7 +833,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
 				| ATC_DIF(AT_DMA_PER_IF);
 		break;
 
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		desc->lli.saddr = atslave->rx_reg;
 		desc->lli.daddr = buf_addr + (period_len * period_index);
 		desc->lli.ctrla = ctrla;
@@ -861,7 +861,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
  */
 static struct dma_async_tx_descriptor *
 atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma_slave	*atslave = chan->private;
@@ -872,7 +872,7 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
 	unsigned int		i;
 
 	dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@0x%08x - %d (%d/%d)\n",
-			direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE",
+			direction == MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
 			buf_addr,
 			periods, buf_len, period_len);
 
drivers/dma/coh901318.c +6 -6
index 4234f41..ca4d6c1 100644
@@ -39,7 +39,7 @@ struct coh901318_desc {
 	struct scatterlist *sg;
 	unsigned int sg_len;
 	struct coh901318_lli *lli;
-	enum dma_data_direction dir;
+	enum dma_transfer_direction dir;
 	unsigned long flags;
 	u32 head_config;
 	u32 head_ctrl;
@@ -1034,7 +1034,7 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 
 static struct dma_async_tx_descriptor *
 coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-			unsigned int sg_len, enum dma_data_direction direction,
+			unsigned int sg_len, enum dma_transfer_direction direction,
 			unsigned long flags)
 {
 	struct coh901318_chan *cohc = to_coh901318_chan(chan);
@@ -1077,7 +1077,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	ctrl_last |= cohc->runtime_ctrl;
 	ctrl |= cohc->runtime_ctrl;
 
-	if (direction == DMA_TO_DEVICE) {
+	if (direction == MEM_TO_DEV) {
 		u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE |
 			COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE;
 
@@ -1085,7 +1085,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		ctrl_chained |= tx_flags;
 		ctrl_last |= tx_flags;
 		ctrl |= tx_flags;
-	} else if (direction == DMA_FROM_DEVICE) {
+	} else if (direction == DEV_TO_MEM) {
 		u32 rx_flags = COH901318_CX_CTRL_PRDD_DEST |
 			COH901318_CX_CTRL_DST_ADDR_INC_ENABLE;
 
@@ -1274,11 +1274,11 @@ static void coh901318_dma_set_runtimeconfig(struct dma_chan *chan,
 	int i = 0;
 
 	/* We only support mem to per or per to mem transfers */
-	if (config->direction == DMA_FROM_DEVICE) {
+	if (config->direction == DEV_TO_MEM) {
 		addr = config->src_addr;
 		addr_width = config->src_addr_width;
 		maxburst = config->src_maxburst;
-	} else if (config->direction == DMA_TO_DEVICE) {
+	} else if (config->direction == MEM_TO_DEV) {
 		addr = config->dst_addr;
 		addr_width = config->dst_addr_width;
 		maxburst = config->dst_maxburst;
drivers/dma/coh901318_lli.c +11 -12
index 9f7e0e6..c895bd8 100644
@@ -7,11 +7,10 @@
  * Author: Per Friden <[email protected]>
  */
 
-#include <linux/dma-mapping.h>
 #include <linux/spinlock.h>
-#include <linux/dmapool.h>
 #include <linux/memory.h>
 #include <linux/gfp.h>
+#include <linux/dmapool.h>
 #include <mach/coh901318.h>
 
 #include "coh901318_lli.h"
@@ -177,18 +176,18 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
 			  struct coh901318_lli *lli,
 			  dma_addr_t buf, unsigned int size,
 			  dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_eom,
-			  enum dma_data_direction dir)
+			  enum dma_transfer_direction dir)
 {
 	int s = size;
 	dma_addr_t src;
 	dma_addr_t dst;
 
 
-	if (dir == DMA_TO_DEVICE) {
+	if (dir == MEM_TO_DEV) {
 		src = buf;
 		dst = dev_addr;
 
-	} else if (dir == DMA_FROM_DEVICE) {
+	} else if (dir == DEV_TO_MEM) {
 
 		src = dev_addr;
 		dst = buf;
@@ -215,9 +214,9 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
 
 		lli = coh901318_lli_next(lli);
 
-		if (dir == DMA_TO_DEVICE)
+		if (dir == MEM_TO_DEV)
 			src += block_size;
-		else if (dir == DMA_FROM_DEVICE)
+		else if (dir == DEV_TO_MEM)
 			dst += block_size;
 	}
 
@@ -234,7 +233,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
 		      struct scatterlist *sgl, unsigned int nents,
 		      dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl,
 		      u32 ctrl_last,
-		      enum dma_data_direction dir, u32 ctrl_irq_mask)
+		      enum dma_transfer_direction dir, u32 ctrl_irq_mask)
 {
 	int i;
 	struct scatterlist *sg;
@@ -249,9 +248,9 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
 
 	spin_lock(&pool->lock);
 
-	if (dir == DMA_TO_DEVICE)
+	if (dir == MEM_TO_DEV)
 		dst = dev_addr;
-	else if (dir == DMA_FROM_DEVICE)
+	else if (dir == DEV_TO_MEM)
 		src = dev_addr;
 	else
 		goto err;
@@ -269,7 +268,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
 			ctrl_sg = ctrl ? ctrl : ctrl_last;
 
 
-		if (dir == DMA_TO_DEVICE)
+		if (dir == MEM_TO_DEV)
 			/* increment source address */
 			src = sg_phys(sg);
 		else
@@ -293,7 +292,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
 			lli->src_addr = src;
 			lli->dst_addr = dst;
 
-			if (dir == DMA_FROM_DEVICE)
+			if (dir == DEV_TO_MEM)
 				dst += elem_size;
 			else
 				src += elem_size;
drivers/dma/coh901318_lli.h +2 -2
index 7a5c809..abff371 100644
@@ -97,7 +97,7 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
 			  struct coh901318_lli *lli,
 			  dma_addr_t buf, unsigned int size,
 			  dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_last,
-			  enum dma_data_direction dir);
+			  enum dma_transfer_direction dir);
 
 /**
  * coh901318_lli_fill_single() - Prepares the lli:s for dma scatter list transfer
@@ -119,6 +119,6 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
 		      struct scatterlist *sg, unsigned int nents,
 		      dma_addr_t dev_addr, u32 ctrl_chained,
 		      u32 ctrl, u32 ctrl_last,
-		      enum dma_data_direction dir, u32 ctrl_irq_mask);
+		      enum dma_transfer_direction dir, u32 ctrl_irq_mask);
 
 #endif /* COH901318_LLI_H */
drivers/dma/dw_dmac.c +7 -7
index 9bfd6d3..ff05382 100644
@@ -696,7 +696,7 @@ err_desc_get:
 
 static struct dma_async_tx_descriptor *
 dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
@@ -720,7 +720,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	prev = first = NULL;
 
 	switch (direction) {
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		ctllo = (DWC_DEFAULT_CTLLO(chan->private)
 				| DWC_CTLL_DST_WIDTH(reg_width)
 				| DWC_CTLL_DST_FIX
@@ -777,7 +777,7 @@ slave_sg_todev_fill_desc:
 				goto slave_sg_todev_fill_desc;
 		}
 		break;
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		ctllo = (DWC_DEFAULT_CTLLO(chan->private)
 				| DWC_CTLL_SRC_WIDTH(reg_width)
 				| DWC_CTLL_DST_INC
@@ -1165,7 +1165,7 @@ EXPORT_SYMBOL(dw_dma_cyclic_stop);
  */
 struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
 		dma_addr_t buf_addr, size_t buf_len, size_t period_len,
-		enum dma_data_direction direction)
+		enum dma_transfer_direction direction)
 {
 	struct dw_dma_chan		*dwc = to_dw_dma_chan(chan);
 	struct dw_cyclic_desc		*cdesc;
@@ -1206,7 +1206,7 @@ struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
 		goto out_err;
 	if (unlikely(buf_addr & ((1 << reg_width) - 1)))
 		goto out_err;
-	if (unlikely(!(direction & (DMA_TO_DEVICE | DMA_FROM_DEVICE))))
+	if (unlikely(!(direction & (MEM_TO_DEV | DEV_TO_MEM))))
 		goto out_err;
 
 	retval = ERR_PTR(-ENOMEM);
@@ -1228,7 +1228,7 @@ struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
 			goto out_err_desc_get;
 
 		switch (direction) {
-		case DMA_TO_DEVICE:
+		case MEM_TO_DEV:
 			desc->lli.dar = dws->tx_reg;
 			desc->lli.sar = buf_addr + (period_len * i);
 			desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan->private)
@@ -1239,7 +1239,7 @@ struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
 					| DWC_CTLL_FC(dws->fc)
 					| DWC_CTLL_INT_EN);
 			break;
-		case DMA_FROM_DEVICE:
+		case DEV_TO_MEM:
 			desc->lli.dar = buf_addr + (period_len * i);
 			desc->lli.sar = dws->rx_reg;
 			desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan->private)
drivers/dma/ep93xx_dma.c +11 -11
index 5d7a49b..42c4698 100644
@@ -329,7 +329,7 @@ static void m2p_fill_desc(struct ep93xx_dma_chan *edmac)
 	struct ep93xx_dma_desc *desc = ep93xx_dma_get_active(edmac);
 	u32 bus_addr;
 
-	if (ep93xx_dma_chan_direction(&edmac->chan) == DMA_TO_DEVICE)
+	if (ep93xx_dma_chan_direction(&edmac->chan) == MEM_TO_DEV)
 		bus_addr = desc->src_addr;
 	else
 		bus_addr = desc->dst_addr;
@@ -442,7 +442,7 @@ static int m2m_hw_setup(struct ep93xx_dma_chan *edmac)
 		control = (5 << M2M_CONTROL_PWSC_SHIFT);
 		control |= M2M_CONTROL_NO_HDSK;
 
-		if (data->direction == DMA_TO_DEVICE) {
+		if (data->direction == MEM_TO_DEV) {
 			control |= M2M_CONTROL_DAH;
 			control |= M2M_CONTROL_TM_TX;
 			control |= M2M_CONTROL_RSS_SSPTX;
@@ -462,7 +462,7 @@ static int m2m_hw_setup(struct ep93xx_dma_chan *edmac)
 		control |= M2M_CONTROL_RSS_IDE;
 		control |= M2M_CONTROL_PW_16;
 
-		if (data->direction == DMA_TO_DEVICE) {
+		if (data->direction == MEM_TO_DEV) {
 			/* Worst case from the UG */
 			control = (3 << M2M_CONTROL_PWSC_SHIFT);
 			control |= M2M_CONTROL_DAH;
@@ -802,8 +802,8 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
 			switch (data->port) {
 			case EP93XX_DMA_SSP:
 			case EP93XX_DMA_IDE:
-				if (data->direction != DMA_TO_DEVICE &&
-				    data->direction != DMA_FROM_DEVICE)
+				if (data->direction != MEM_TO_DEV &&
+				    data->direction != DEV_TO_MEM)
 					return -EINVAL;
 				break;
 			default:
@@ -951,7 +951,7 @@ fail:
  */
 static struct dma_async_tx_descriptor *
 ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-			 unsigned int sg_len, enum dma_data_direction dir,
+			 unsigned int sg_len, enum dma_transfer_direction dir,
 			 unsigned long flags)
 {
 	struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
@@ -987,7 +987,7 @@ ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			goto fail;
 		}
 
-		if (dir == DMA_TO_DEVICE) {
+		if (dir == MEM_TO_DEV) {
 			desc->src_addr = sg_dma_address(sg);
 			desc->dst_addr = edmac->runtime_addr;
 		} else {
@@ -1031,7 +1031,7 @@ fail:
 static struct dma_async_tx_descriptor *
 ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
 			   size_t buf_len, size_t period_len,
-			   enum dma_data_direction dir)
+			   enum dma_transfer_direction dir)
 {
 	struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
 	struct ep93xx_dma_desc *desc, *first;
@@ -1064,7 +1064,7 @@ ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
 			goto fail;
 		}
 
-		if (dir == DMA_TO_DEVICE) {
+		if (dir == MEM_TO_DEV) {
 			desc->src_addr = dma_addr + offset;
 			desc->dst_addr = edmac->runtime_addr;
 		} else {
@@ -1132,12 +1132,12 @@ static int ep93xx_dma_slave_config(struct ep93xx_dma_chan *edmac,
 		return -EINVAL;
 
 	switch (config->direction) {
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		width = config->src_addr_width;
 		addr = config->src_addr;
 		break;
 
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		width = config->dst_addr_width;
 		addr = config->dst_addr;
 		break;
drivers/dma/fsldma.c +2 -2
index 8a78154..fc980f0 100644
@@ -772,7 +772,7 @@ fail:
  */
 static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
 	struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
-	enum dma_data_direction direction, unsigned long flags)
+	enum dma_transfer_direction direction, unsigned long flags)
 {
 	/*
 	 * This operation is not supported on the Freescale DMA controller
@@ -819,7 +819,7 @@ static int fsl_dma_device_control(struct dma_chan *dchan,
 			return -ENXIO;
 
 		/* we set the controller burst size depending on direction */
-		if (config->direction == DMA_TO_DEVICE)
+		if (config->direction == MEM_TO_DEV)
 			size = config->dst_addr_width * config->dst_maxburst;
 		else
 			size = config->src_addr_width * config->src_maxburst;
drivers/dma/imx-dma.c +5 -5
index d746899..a47c312 100644
@@ -106,7 +106,7 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 		imx_dma_disable(imxdmac->imxdma_channel);
 		return 0;
 	case DMA_SLAVE_CONFIG:
-		if (dmaengine_cfg->direction == DMA_FROM_DEVICE) {
+		if (dmaengine_cfg->direction == DEV_TO_MEM) {
 			imxdmac->per_address = dmaengine_cfg->src_addr;
 			imxdmac->watermark_level = dmaengine_cfg->src_maxburst;
 			imxdmac->word_size = dmaengine_cfg->src_addr_width;
@@ -223,7 +223,7 @@ static void imxdma_free_chan_resources(struct dma_chan *chan)
 
 static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
 		struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
@@ -240,7 +240,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
 		dma_length += sg->length;
 	}
 
-	if (direction == DMA_FROM_DEVICE)
+	if (direction == DEV_TO_MEM)
 		dmamode = DMA_MODE_READ;
 	else
 		dmamode = DMA_MODE_WRITE;
@@ -270,7 +270,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
 
 static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
 		struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
 	struct imxdma_engine *imxdma = imxdmac->imxdma;
@@ -316,7 +316,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
 	imxdmac->sg_list[periods].page_link =
 		((unsigned long)imxdmac->sg_list | 0x01) & ~0x02;
 
-	if (direction == DMA_FROM_DEVICE)
+	if (direction == DEV_TO_MEM)
 		dmamode = DMA_MODE_READ;
 	else
 		dmamode = DMA_MODE_WRITE;
drivers/dma/imx-sdma.c +5 -5
index eab1fe7..ae0c9a0 100644
@@ -246,7 +246,7 @@ struct sdma_engine;
 struct sdma_channel {
 	struct sdma_engine		*sdma;
 	unsigned int			channel;
-	enum dma_data_direction		direction;
+	enum dma_transfer_direction		direction;
 	enum sdma_peripheral_type	peripheral_type;
 	unsigned int			event_id0;
 	unsigned int			event_id1;
@@ -649,7 +649,7 @@ static int sdma_load_context(struct sdma_channel *sdmac)
 	struct sdma_buffer_descriptor *bd0 = sdma->channel[0].bd;
 	int ret;
 
-	if (sdmac->direction == DMA_FROM_DEVICE) {
+	if (sdmac->direction == DEV_TO_MEM) {
 		load_address = sdmac->pc_from_device;
 	} else {
 		load_address = sdmac->pc_to_device;
@@ -910,7 +910,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
 static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
 		struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct sdma_channel *sdmac = to_sdma_chan(chan);
@@ -1007,7 +1007,7 @@ err_out:
 
 static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
 		struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	struct sdma_channel *sdmac = to_sdma_chan(chan);
 	struct sdma_engine *sdma = sdmac->sdma;
@@ -1092,7 +1092,7 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 		sdma_disable_channel(sdmac);
 		return 0;
 	case DMA_SLAVE_CONFIG:
-		if (dmaengine_cfg->direction == DMA_FROM_DEVICE) {
+		if (dmaengine_cfg->direction == DEV_TO_MEM) {
 			sdmac->per_address = dmaengine_cfg->src_addr;
 			sdmac->watermark_level = dmaengine_cfg->src_maxburst;
 			sdmac->word_size = dmaengine_cfg->src_addr_width;
drivers/dma/intel_mid_dma.c +7 -7
index cf74a66..e4f34c4 100644
@@ -396,10 +396,10 @@ static int midc_lli_fill_sg(struct intel_mid_dma_chan *midc,
 							midc->dma->block_size);
 		/*Populate SAR and DAR values*/
 		sg_phy_addr = sg_phys(sg);
-		if (desc->dirn ==  DMA_TO_DEVICE) {
+		if (desc->dirn ==  MEM_TO_DEV) {
 			lli_bloc_desc->sar  = sg_phy_addr;
 			lli_bloc_desc->dar  = mids->dma_slave.dst_addr;
-		} else if (desc->dirn ==  DMA_FROM_DEVICE) {
+		} else if (desc->dirn ==  DEV_TO_MEM) {
 			lli_bloc_desc->sar  = mids->dma_slave.src_addr;
 			lli_bloc_desc->dar  = sg_phy_addr;
 		}
@@ -633,13 +633,13 @@ static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
 		if (midc->dma->pimr_mask) {
 			cfg_hi.cfgx.protctl = 0x0; /*default value*/
 			cfg_hi.cfgx.fifo_mode = 1;
-			if (mids->dma_slave.direction == DMA_TO_DEVICE) {
+			if (mids->dma_slave.direction == MEM_TO_DEV) {
 				cfg_hi.cfgx.src_per = 0;
 				if (mids->device_instance == 0)
 					cfg_hi.cfgx.dst_per = 3;
 				if (mids->device_instance == 1)
 					cfg_hi.cfgx.dst_per = 1;
-			} else if (mids->dma_slave.direction == DMA_FROM_DEVICE) {
+			} else if (mids->dma_slave.direction == DEV_TO_MEM) {
 				if (mids->device_instance == 0)
 					cfg_hi.cfgx.src_per = 2;
 				if (mids->device_instance == 1)
@@ -683,11 +683,11 @@ static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
 		ctl_lo.ctlx.sinc = 0;
 		ctl_lo.ctlx.dinc = 0;
 	} else {
-		if (mids->dma_slave.direction == DMA_TO_DEVICE) {
+		if (mids->dma_slave.direction == MEM_TO_DEV) {
 			ctl_lo.ctlx.sinc = 0;
 			ctl_lo.ctlx.dinc = 2;
 			ctl_lo.ctlx.tt_fc = 1;
-		} else if (mids->dma_slave.direction == DMA_FROM_DEVICE) {
+		} else if (mids->dma_slave.direction == DEV_TO_MEM) {
 			ctl_lo.ctlx.sinc = 2;
 			ctl_lo.ctlx.dinc = 0;
 			ctl_lo.ctlx.tt_fc = 2;
@@ -733,7 +733,7 @@ err_desc_get:
  */
 static struct dma_async_tx_descriptor *intel_mid_dma_prep_slave_sg(
 			struct dma_chan *chan, struct scatterlist *sgl,
-			unsigned int sg_len, enum dma_data_direction direction,
+			unsigned int sg_len, enum dma_transfer_direction direction,
 			unsigned long flags)
 {
 	struct intel_mid_dma_chan *midc = NULL;
drivers/dma/intel_mid_dma_regs.h +1 -1
index aea5ee8..c6de919 100644
@@ -262,7 +262,7 @@ struct intel_mid_dma_desc {
 	unsigned int			lli_length;
 	unsigned int			current_lli;
 	dma_addr_t			next;
-	enum dma_data_direction		dirn;
+	enum dma_transfer_direction		dirn;
 	enum dma_status			status;
 	enum dma_slave_buswidth		width; /*width of DMA txn*/
 	enum intel_mid_dma_mode		cfg_mode; /*mode configuration*/
drivers/dma/ipu/ipu_idmac.c +2 -2
index 6815905..8bb6556 100644
@@ -1362,7 +1362,7 @@ static void ipu_gc_tasklet(unsigned long arg)
 /* Allocate and initialise a transfer descriptor. */
 static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan,
 		struct scatterlist *sgl, unsigned int sg_len,
-		enum dma_data_direction direction, unsigned long tx_flags)
+		enum dma_transfer_direction direction, unsigned long tx_flags)
 {
 	struct idmac_channel *ichan = to_idmac_chan(chan);
 	struct idmac_tx_desc *desc = NULL;
@@ -1374,7 +1374,7 @@ static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan
 	    chan->chan_id != IDMAC_IC_7)
 		return NULL;
 
-	if (direction != DMA_FROM_DEVICE && direction != DMA_TO_DEVICE) {
+	if (direction != DEV_TO_MEM && direction != MEM_TO_DEV) {
 		dev_err(chan->device->dev, "Invalid DMA direction %d!\n", direction);
 		return NULL;
 	}
drivers/dma/mxs-dma.c +4 -4
index b4588bd..be3c613 100644
@@ -377,7 +377,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan)
 
 static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
 		struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long append)
 {
 	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
@@ -450,7 +450,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
 			ccw->bits |= CCW_CHAIN;
 			ccw->bits |= CCW_HALT_ON_TERM;
 			ccw->bits |= CCW_TERM_FLUSH;
-			ccw->bits |= BF_CCW(direction == DMA_FROM_DEVICE ?
+			ccw->bits |= BF_CCW(direction == DEV_TO_MEM ?
 					MXS_DMA_CMD_WRITE : MXS_DMA_CMD_READ,
 					COMMAND);
 
@@ -472,7 +472,7 @@ err_out:
 
 static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
 		struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -515,7 +515,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
 		ccw->bits |= CCW_IRQ;
 		ccw->bits |= CCW_HALT_ON_TERM;
 		ccw->bits |= CCW_TERM_FLUSH;
-		ccw->bits |= BF_CCW(direction == DMA_FROM_DEVICE ?
+		ccw->bits |= BF_CCW(direction == DEV_TO_MEM ?
 				MXS_DMA_CMD_WRITE : MXS_DMA_CMD_READ, COMMAND);
 
 		dma_addr += period_len;
drivers/dma/pch_dma.c +6 -6
index a6d0e3d..cd35e59 100644
@@ -99,7 +99,7 @@ struct pch_dma_desc {
 struct pch_dma_chan {
 	struct dma_chan		chan;
 	void __iomem *membase;
-	enum dma_data_direction	dir;
+	enum dma_transfer_direction dir;
 	struct tasklet_struct	tasklet;
 	unsigned long		err_status;
 
@@ -224,7 +224,7 @@ static void pdc_set_dir(struct dma_chan *chan)
 		mask_ctl = DMA_MASK_CTL0_MODE & ~(DMA_CTL0_MODE_MASK_BITS <<
 				       (DMA_CTL0_BITS_PER_CH * chan->chan_id));
 		val &= mask_mode;
-		if (pd_chan->dir == DMA_TO_DEVICE)
+		if (pd_chan->dir == MEM_TO_DEV)
 			val |= 0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id +
 				       DMA_CTL0_DIR_SHIFT_BITS);
 		else
@@ -242,7 +242,7 @@ static void pdc_set_dir(struct dma_chan *chan)
 		mask_ctl = DMA_MASK_CTL2_MODE & ~(DMA_CTL0_MODE_MASK_BITS <<
 						 (DMA_CTL0_BITS_PER_CH * ch));
 		val &= mask_mode;
-		if (pd_chan->dir == DMA_TO_DEVICE)
+		if (pd_chan->dir == MEM_TO_DEV)
 			val |= 0x1 << (DMA_CTL0_BITS_PER_CH * ch +
 				       DMA_CTL0_DIR_SHIFT_BITS);
 		else
@@ -607,7 +607,7 @@ static void pd_issue_pending(struct dma_chan *chan)
 
 static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
 			struct scatterlist *sgl, unsigned int sg_len,
-			enum dma_data_direction direction, unsigned long flags)
+			enum dma_transfer_direction direction, unsigned long flags)
 {
 	struct pch_dma_chan *pd_chan = to_pd_chan(chan);
 	struct pch_dma_slave *pd_slave = chan->private;
@@ -623,9 +623,9 @@ static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
 		return NULL;
 	}
 
-	if (direction == DMA_FROM_DEVICE)
+	if (direction == DEV_TO_MEM)
 		reg = pd_slave->rx_reg;
-	else if (direction == DMA_TO_DEVICE)
+	else if (direction == MEM_TO_DEV)
 		reg = pd_slave->tx_reg;
 	else
 		return NULL;
drivers/dma/pl330.c +9 -9
index 5710414..91e8d1f 100644
@@ -320,14 +320,14 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
 	case DMA_SLAVE_CONFIG:
 		slave_config = (struct dma_slave_config *)arg;
 
-		if (slave_config->direction == DMA_TO_DEVICE) {
+		if (slave_config->direction == MEM_TO_DEV) {
 			if (slave_config->dst_addr)
 				pch->fifo_addr = slave_config->dst_addr;
 			if (slave_config->dst_addr_width)
 				pch->burst_sz = __ffs(slave_config->dst_addr_width);
 			if (slave_config->dst_maxburst)
 				pch->burst_len = slave_config->dst_maxburst;
-		} else if (slave_config->direction == DMA_FROM_DEVICE) {
+		} else if (slave_config->direction == DEV_TO_MEM) {
 			if (slave_config->src_addr)
 				pch->fifo_addr = slave_config->src_addr;
 			if (slave_config->src_addr_width)
@@ -597,7 +597,7 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len)
 
 static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
 		struct dma_chan *chan, dma_addr_t dma_addr, size_t len,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	struct dma_pl330_desc *desc;
 	struct dma_pl330_chan *pch = to_pchan(chan);
@@ -612,13 +612,13 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
 	}
 
 	switch (direction) {
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		desc->rqcfg.src_inc = 1;
 		desc->rqcfg.dst_inc = 0;
 		src = dma_addr;
 		dst = pch->fifo_addr;
 		break;
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		desc->rqcfg.src_inc = 0;
 		desc->rqcfg.dst_inc = 1;
 		src = pch->fifo_addr;
@@ -687,7 +687,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
 
 static struct dma_async_tx_descriptor *
 pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flg)
 {
 	struct dma_pl330_desc *first, *desc = NULL;
@@ -702,9 +702,9 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		return NULL;
 
 	/* Make sure the direction is consistent */
-	if ((direction == DMA_TO_DEVICE &&
+	if ((direction == MEM_TO_DEV &&
 				peri->rqtype != MEMTODEV) ||
-			(direction == DMA_FROM_DEVICE &&
+			(direction == DEV_TO_MEM &&
 				peri->rqtype != DEVTOMEM)) {
 		dev_err(pch->dmac->pif.dev, "%s:%d Invalid Direction\n",
 				__func__, __LINE__);
@@ -747,7 +747,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		else
 			list_add_tail(&desc->node, &first->node);
 
-		if (direction == DMA_TO_DEVICE) {
+		if (direction == MEM_TO_DEV) {
 			desc->rqcfg.src_inc = 1;
 			desc->rqcfg.dst_inc = 0;
 			fill_px(&desc->px,
drivers/dma/shdma.c +12 -13
index 81809c2..cab7d3e 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/dmaengine.h>
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/sh_dma.h>
@@ -479,19 +478,19 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
  * @sh_chan:	DMA channel
  * @flags:	DMA transfer flags
  * @dest:	destination DMA address, incremented when direction equals
- *		DMA_FROM_DEVICE or DMA_BIDIRECTIONAL
+ *		DEV_TO_MEM
  * @src:	source DMA address, incremented when direction equals
- *		DMA_TO_DEVICE or DMA_BIDIRECTIONAL
+ *		MEM_TO_DEV
  * @len:	DMA transfer length
  * @first:	if NULL, set to the current descriptor and cookie set to -EBUSY
  * @direction:	needed for slave DMA to decide which address to keep constant,
- *		equals DMA_BIDIRECTIONAL for MEMCPY
+ *		equals MEM_TO_MEM for MEMCPY
  * Returns 0 or an error
  * Locks: called with desc_lock held
  */
 static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
 	unsigned long flags, dma_addr_t *dest, dma_addr_t *src, size_t *len,
-	struct sh_desc **first, enum dma_data_direction direction)
+	struct sh_desc **first, enum dma_transfer_direction direction)
 {
 	struct sh_desc *new;
 	size_t copy_size;
@@ -531,9 +530,9 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
 	new->direction = direction;
 
 	*len -= copy_size;
-	if (direction == DMA_BIDIRECTIONAL || direction == DMA_TO_DEVICE)
+	if (direction == MEM_TO_MEM || direction == MEM_TO_DEV)
 		*src += copy_size;
-	if (direction == DMA_BIDIRECTIONAL || direction == DMA_FROM_DEVICE)
+	if (direction == MEM_TO_MEM || direction == DEV_TO_MEM)
 		*dest += copy_size;
 
 	return new;
@@ -546,12 +545,12 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
  * converted to scatter-gather to guarantee consistent locking and a correct
  * list manipulation. For slave DMA direction carries the usual meaning, and,
  * logically, the SG list is RAM and the addr variable contains slave address,
- * e.g., the FIFO I/O register. For MEMCPY direction equals DMA_BIDIRECTIONAL
+ * e.g., the FIFO I/O register. For MEMCPY direction equals MEM_TO_MEM
  * and the SG list contains only one element and points at the source buffer.
  */
 static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_chan,
 	struct scatterlist *sgl, unsigned int sg_len, dma_addr_t *addr,
-	enum dma_data_direction direction, unsigned long flags)
+	enum dma_transfer_direction direction, unsigned long flags)
 {
 	struct scatterlist *sg;
 	struct sh_desc *first = NULL, *new = NULL /* compiler... */;
@@ -592,7 +591,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_c
 			dev_dbg(sh_chan->dev, "Add SG #%d@%p[%d], dma %llx\n",
 				i, sg, len, (unsigned long long)sg_addr);
 
-			if (direction == DMA_FROM_DEVICE)
+			if (direction == DEV_TO_MEM)
 				new = sh_dmae_add_desc(sh_chan, flags,
 						&sg_addr, addr, &len, &first,
 						direction);
@@ -646,13 +645,13 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
 	sg_dma_address(&sg) = dma_src;
 	sg_dma_len(&sg) = len;
 
-	return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, DMA_BIDIRECTIONAL,
+	return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, MEM_TO_MEM,
 			       flags);
 }
 
 static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 	struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
-	enum dma_data_direction direction, unsigned long flags)
+	enum dma_transfer_direction direction, unsigned long flags)
 {
 	struct sh_dmae_slave *param;
 	struct sh_dmae_chan *sh_chan;
@@ -996,7 +995,7 @@ static void dmae_do_tasklet(unsigned long data)
 	spin_lock_irq(&sh_chan->desc_lock);
 	list_for_each_entry(desc, &sh_chan->ld_queue, node) {
 		if (desc->mark == DESC_SUBMITTED &&
-		    ((desc->direction == DMA_FROM_DEVICE &&
+		    ((desc->direction == DEV_TO_MEM &&
 		      (desc->hw.dar + desc->hw.tcr) == dar_buf) ||
 		     (desc->hw.sar + desc->hw.tcr) == sar_buf)) {
 			dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n",
drivers/dma/ste_dma40.c +13 -13
index 467e4dc..1e600e2 100644
@@ -216,7 +216,7 @@ struct d40_chan {
 	struct d40_log_lli_full		*lcpa;
 	/* Runtime reconfiguration */
 	dma_addr_t			runtime_addr;
-	enum dma_data_direction		runtime_direction;
+	enum dma_transfer_direction	runtime_direction;
 };
 
 /**
@@ -1854,7 +1854,7 @@ err:
 }
 
 static dma_addr_t
-d40_get_dev_addr(struct d40_chan *chan, enum dma_data_direction direction)
+d40_get_dev_addr(struct d40_chan *chan, enum dma_transfer_direction direction)
 {
 	struct stedma40_platform_data *plat = chan->base->plat_data;
 	struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
@@ -1863,9 +1863,9 @@ d40_get_dev_addr(struct d40_chan *chan, enum dma_data_direction direction)
 	if (chan->runtime_addr)
 		return chan->runtime_addr;
 
-	if (direction == DMA_FROM_DEVICE)
+	if (direction == DEV_TO_MEM)
 		addr = plat->dev_rx[cfg->src_dev_type];
-	else if (direction == DMA_TO_DEVICE)
+	else if (direction == MEM_TO_DEV)
 		addr = plat->dev_tx[cfg->dst_dev_type];
 
 	return addr;
@@ -1874,7 +1874,7 @@ d40_get_dev_addr(struct d40_chan *chan, enum dma_data_direction direction)
 static struct dma_async_tx_descriptor *
 d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
 	    struct scatterlist *sg_dst, unsigned int sg_len,
-	    enum dma_data_direction direction, unsigned long dma_flags)
+	    enum dma_transfer_direction direction, unsigned long dma_flags)
 {
 	struct d40_chan *chan = container_of(dchan, struct d40_chan, chan);
 	dma_addr_t src_dev_addr = 0;
@@ -1901,9 +1901,9 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
 	if (direction != DMA_NONE) {
 		dma_addr_t dev_addr = d40_get_dev_addr(chan, direction);
 
-		if (direction == DMA_FROM_DEVICE)
+		if (direction == DEV_TO_MEM)
 			src_dev_addr = dev_addr;
-		else if (direction == DMA_TO_DEVICE)
+		else if (direction == MEM_TO_DEV)
 			dst_dev_addr = dev_addr;
 	}
 
@@ -2107,10 +2107,10 @@ d40_prep_memcpy_sg(struct dma_chan *chan,
 static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
 							 struct scatterlist *sgl,
 							 unsigned int sg_len,
-							 enum dma_data_direction direction,
+							 enum dma_transfer_direction direction,
 							 unsigned long dma_flags)
 {
-	if (direction != DMA_FROM_DEVICE && direction != DMA_TO_DEVICE)
+	if (direction != DEV_TO_MEM && direction != MEM_TO_DEV)
 		return NULL;
 
 	return d40_prep_sg(chan, sgl, sgl, sg_len, direction, dma_flags);
@@ -2119,7 +2119,7 @@ static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
 static struct dma_async_tx_descriptor *
 dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
 		     size_t buf_len, size_t period_len,
-		     enum dma_data_direction direction)
+		     enum dma_transfer_direction direction)
 {
 	unsigned int periods = buf_len / period_len;
 	struct dma_async_tx_descriptor *txd;
@@ -2268,7 +2268,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
 	dst_addr_width = config->dst_addr_width;
 	dst_maxburst = config->dst_maxburst;
 
-	if (config->direction == DMA_FROM_DEVICE) {
+	if (config->direction == DEV_TO_MEM) {
 		dma_addr_t dev_addr_rx =
 			d40c->base->plat_data->dev_rx[cfg->src_dev_type];
 
@@ -2291,7 +2291,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
 		if (dst_maxburst == 0)
 			dst_maxburst = src_maxburst;
 
-	} else if (config->direction == DMA_TO_DEVICE) {
+	} else if (config->direction == MEM_TO_DEV) {
 		dma_addr_t dev_addr_tx =
 			d40c->base->plat_data->dev_tx[cfg->dst_dev_type];
 
@@ -2356,7 +2356,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
 		"configured channel %s for %s, data width %d/%d, "
 		"maxburst %d/%d elements, LE, no flow control\n",
 		dma_chan_name(chan),
-		(config->direction == DMA_FROM_DEVICE) ? "RX" : "TX",
+		(config->direction == DEV_TO_MEM) ? "RX" : "TX",
 		src_addr_width, dst_addr_width,
 		src_maxburst, dst_maxburst);
 
drivers/dma/timb_dma.c +9 -9
index a4a398f..764ae74 100644
@@ -90,7 +90,7 @@ struct timb_dma_chan {
 	struct list_head	queue;
 	struct list_head	free_list;
 	unsigned int		bytes_per_line;
-	enum dma_data_direction	direction;
+	enum dma_transfer_direction	direction;
 	unsigned int		descs; /* Descriptors to allocate */
 	unsigned int		desc_elems; /* number of elems per descriptor */
 };
@@ -235,7 +235,7 @@ static void __td_start_dma(struct timb_dma_chan *td_chan)
 		"td_chan: %p, chan: %d, membase: %p\n",
 		td_chan, td_chan->chan.chan_id, td_chan->membase);
 
-	if (td_chan->direction == DMA_FROM_DEVICE) {
+	if (td_chan->direction == DEV_TO_MEM) {
 
 		/* descriptor address */
 		iowrite32(0, td_chan->membase + TIMBDMA_OFFS_RX_DHAR);
@@ -278,7 +278,7 @@ static void __td_finish(struct timb_dma_chan *td_chan)
 		txd->cookie);
 
 	/* make sure to stop the transfer */
-	if (td_chan->direction == DMA_FROM_DEVICE)
+	if (td_chan->direction == DEV_TO_MEM)
 		iowrite32(0, td_chan->membase + TIMBDMA_OFFS_RX_ER);
 /* Currently no support for stopping DMA transfers
 	else
@@ -398,7 +398,7 @@ static struct timb_dma_desc *td_alloc_init_desc(struct timb_dma_chan *td_chan)
 	td_desc->txd.flags = DMA_CTRL_ACK;
 
 	td_desc->txd.phys = dma_map_single(chan2dmadev(chan),
-		td_desc->desc_list, td_desc->desc_list_len, DMA_TO_DEVICE);
+		td_desc->desc_list, td_desc->desc_list_len, MEM_TO_DEV);
 
 	err = dma_mapping_error(chan2dmadev(chan), td_desc->txd.phys);
 	if (err) {
@@ -419,7 +419,7 @@ static void td_free_desc(struct timb_dma_desc *td_desc)
 {
 	dev_dbg(chan2dev(td_desc->txd.chan), "Freeing desc: %p\n", td_desc);
 	dma_unmap_single(chan2dmadev(td_desc->txd.chan), td_desc->txd.phys,
-		td_desc->desc_list_len, DMA_TO_DEVICE);
+		td_desc->desc_list_len, MEM_TO_DEV);
 
 	kfree(td_desc->desc_list);
 	kfree(td_desc);
@@ -558,7 +558,7 @@ static void td_issue_pending(struct dma_chan *chan)
 
 static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
 	struct scatterlist *sgl, unsigned int sg_len,
-	enum dma_data_direction direction, unsigned long flags)
+	enum dma_transfer_direction direction, unsigned long flags)
 {
 	struct timb_dma_chan *td_chan =
 		container_of(chan, struct timb_dma_chan, chan);
@@ -606,7 +606,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
 	}
 
 	dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys,
-		td_desc->desc_list_len, DMA_TO_DEVICE);
+		td_desc->desc_list_len, MEM_TO_DEV);
 
 	return &td_desc->txd;
 }
@@ -775,8 +775,8 @@ static int __devinit td_probe(struct platform_device *pdev)
 		td_chan->descs = pchan->descriptors;
 		td_chan->desc_elems = pchan->descriptor_elements;
 		td_chan->bytes_per_line = pchan->bytes_per_line;
-		td_chan->direction = pchan->rx ? DMA_FROM_DEVICE :
-			DMA_TO_DEVICE;
+		td_chan->direction = pchan->rx ? DEV_TO_MEM :
+			MEM_TO_DEV;
 
 		td_chan->membase = td->membase +
 			(i / 2) * TIMBDMA_INSTANCE_OFFSET +
drivers/dma/txx9dmac.c +6 -6
index cbd83e3..ce6e772 100644
@@ -845,7 +845,7 @@ txx9dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 
 static struct dma_async_tx_descriptor *
 txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct txx9dmac_chan *dc = to_txx9dmac_chan(chan);
@@ -860,9 +860,9 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 
 	BUG_ON(!ds || !ds->reg_width);
 	if (ds->tx_reg)
-		BUG_ON(direction != DMA_TO_DEVICE);
+		BUG_ON(direction != MEM_TO_DEV);
 	else
-		BUG_ON(direction != DMA_FROM_DEVICE);
+		BUG_ON(direction != DEV_TO_MEM);
 	if (unlikely(!sg_len))
 		return NULL;
 
@@ -882,7 +882,7 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		mem = sg_dma_address(sg);
 
 		if (__is_dmac64(ddev)) {
-			if (direction == DMA_TO_DEVICE) {
+			if (direction == MEM_TO_DEV) {
 				desc->hwdesc.SAR = mem;
 				desc->hwdesc.DAR = ds->tx_reg;
 			} else {
@@ -891,7 +891,7 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			}
 			desc->hwdesc.CNTR = sg_dma_len(sg);
 		} else {
-			if (direction == DMA_TO_DEVICE) {
+			if (direction == MEM_TO_DEV) {
 				desc->hwdesc32.SAR = mem;
 				desc->hwdesc32.DAR = ds->tx_reg;
 			} else {
@@ -900,7 +900,7 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			}
 			desc->hwdesc32.CNTR = sg_dma_len(sg);
 		}
-		if (direction == DMA_TO_DEVICE) {
+		if (direction == MEM_TO_DEV) {
 			sai = ds->reg_width;
 			dai = 0;
 		} else {
include/linux/amba/pl08x.h +2 -2
index 9eabffb..033f6aa 100644
@@ -134,7 +134,7 @@ struct pl08x_txd {
 	struct dma_async_tx_descriptor tx;
 	struct list_head node;
 	struct list_head dsg_list;
-	enum dma_data_direction	direction;
+	enum dma_transfer_direction direction;
 	dma_addr_t llis_bus;
 	struct pl08x_lli *llis_va;
 	/* Default cctl value for LLIs */
@@ -197,7 +197,7 @@ struct pl08x_dma_chan {
 	dma_addr_t dst_addr;
 	u32 src_cctl;
 	u32 dst_cctl;
-	enum dma_data_direction	runtime_direction;
+	enum dma_transfer_direction runtime_direction;
 	dma_cookie_t lc;
 	struct list_head pend_list;
 	struct pl08x_txd *at;
include/linux/dw_dmac.h +1 -1
index 4bfe0a2..f2c64f9 100644
@@ -127,7 +127,7 @@ struct dw_cyclic_desc {
 
 struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
 		dma_addr_t buf_addr, size_t buf_len, size_t period_len,
-		enum dma_data_direction direction);
+		enum dma_transfer_direction direction);
 void dw_dma_cyclic_free(struct dma_chan *chan);
 int dw_dma_cyclic_start(struct dma_chan *chan);
 void dw_dma_cyclic_stop(struct dma_chan *chan);
include/linux/sh_dma.h +1 -1
index cb2dd11..62ef693 100644
@@ -30,7 +30,7 @@ struct sh_desc {
 	struct sh_dmae_regs hw;
 	struct list_head node;
 	struct dma_async_tx_descriptor async_tx;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	dma_cookie_t cookie;
 	size_t partial;
 	int chunks;
Signature · 1 line
1.7.0.4
Acked-by on v1 2/10
#7 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

Quoted 9 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Jassi Brar <[email protected]>
Cc Russell King <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Mika Westerberg <[email protected]>

For the ep93xx_dma part,

Acked-by on v1 2/10
#9 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

In reply to Vinod Koul
Quoted 38 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Jassi Brar <[email protected]>
Cc Russell King <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc H Hartley Sweeten <[email protected]>
Cc Li Yang <[email protected]>
Cc Zhang Wei <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Yong Wang <[email protected]>
Cc Tomoya MORINAGA <[email protected]>
Cc Boojin Kim <[email protected]>
Cc Barry Song <[email protected]>
---
 arch/arm/mach-ep93xx/include/mach/dma.h        |    6 ++--
 arch/arm/plat-nomadik/include/plat/ste_dma40.h |    4 +-
 drivers/dma/amba-pl08x.c                       |   24 +++++++++++-----------
 drivers/dma/at_hdmac.c                         |   22 ++++++++++----------
 drivers/dma/coh901318.c                        |   12 +++++-----
 drivers/dma/coh901318_lli.c                    |   23 ++++++++++-----------
 drivers/dma/coh901318_lli.h                    |    4 +-
 drivers/dma/dw_dmac.c                          |   14 ++++++------
 drivers/dma/ep93xx_dma.c                       |   22 ++++++++++----------
 drivers/dma/fsldma.c                           |    4 +-
 drivers/dma/imx-dma.c                          |   10 ++++----
 drivers/dma/imx-sdma.c                         |   10 ++++----
 drivers/dma/intel_mid_dma.c                    |   14 ++++++------
 drivers/dma/intel_mid_dma_regs.h               |    2 +-
 drivers/dma/ipu/ipu_idmac.c                    |    4 +-
 drivers/dma/mxs-dma.c                          |    8 +++---
 drivers/dma/pch_dma.c                          |   12 +++++-----
 drivers/dma/pl330.c                            |   18 ++++++++--------
Quoted 8 lines
 drivers/dma/shdma.c                            |   25 +++++++++++------------
 drivers/dma/ste_dma40.c                        |   26 ++++++++++++------------
 drivers/dma/timb_dma.c                         |   18 ++++++++--------
 drivers/dma/txx9dmac.c                         |   12 +++++-----
 include/linux/amba/pl08x.h                     |    4 +-
 include/linux/dw_dmac.h                        |    2 +-
 include/linux/sh_dma.h                         |    2 +-
 25 files changed, 150 insertions(+), 152 deletions(-)

For amba-pl08x and dw_dmac:

Can you please add something in the commit message, to explain why is it done.

Signature · 1 line
viresh
#10 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

Quoted 3 lines · Viresh Kumar

For amba-pl08x and dw_dmac:

Thanks

Quoted 3 lines

Can you please add something in the commit message, to explain why is it done.

I think 01/10 explains it well

Signature · 1 line
~Vinod
#11 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

Quoted 3 lines · Vinod Koul
Quoted 2 lines
Quoted 2 lines

Can you please add something in the commit message, to explain why is it done.

I think 01/10 explains it well

Ok. I wasn't in cc of that patch, so couldn't link it. But still
i think every patch should have some sort of explanation or link to another patch that explains why is it done. Isn't it?

Signature · 1 line
viresh
Acked-by on v1 2/10
#12 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

In reply to Vinod Koul

On 10/14/2011 07:38 AM, Vinod Koul :

Quoted 8 lines

From: Vinod Koul <[email protected]>

Cc Jassi Brar <[email protected]>
Cc Russell King <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Nicolas Ferre <[email protected]>

[..]

Quoted 94 lines

index fcfa0a8..7968a81 100644

drivers/dma/at_hdmac.c +10 -10
@@ -660,7 +660,7 @@ err_desc_get:
  */
 static struct dma_async_tx_descriptor *
 atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
-		unsigned int sg_len, enum dma_data_direction direction,
+		unsigned int sg_len, enum dma_transfer_direction direction,
 		unsigned long flags)
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
@@ -678,7 +678,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 
 	dev_vdbg(chan2dev(chan), "prep_slave_sg (%d): %s f0x%lx\n",
 			sg_len,
-			direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE",
+			direction == MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
 			flags);
 
 	if (unlikely(!atslave || !sg_len)) {
@@ -692,7 +692,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	ctrlb = ATC_IEN;
 
 	switch (direction) {
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		ctrla |=  ATC_DST_WIDTH(reg_width);
 		ctrlb |=  ATC_DST_ADDR_MODE_FIXED
 			| ATC_SRC_ADDR_MODE_INCR
@@ -725,7 +725,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			total_len += len;
 		}
 		break;
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		ctrla |=  ATC_SRC_WIDTH(reg_width);
 		ctrlb |=  ATC_DST_ADDR_MODE_INCR
 			| ATC_SRC_ADDR_MODE_FIXED
@@ -787,7 +787,7 @@ err_desc_get:
  */
 static int
 atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	if (period_len > (ATC_BTSIZE_MAX << reg_width))
 		goto err_out;
@@ -795,7 +795,7 @@ atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
 		goto err_out;
 	if (unlikely(buf_addr & ((1 << reg_width) - 1)))
 		goto err_out;
-	if (unlikely(!(direction & (DMA_TO_DEVICE | DMA_FROM_DEVICE))))
+	if (unlikely(!(direction & (DEV_TO_MEM | MEM_TO_DEV))))
 		goto err_out;
 
 	return 0;
@@ -810,7 +810,7 @@ err_out:
 static int
 atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
 		unsigned int period_index, dma_addr_t buf_addr,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	u32		ctrla;
 	unsigned int	reg_width = atslave->reg_width;
@@ -822,7 +822,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
 		| period_len >> reg_width;
 
 	switch (direction) {
-	case DMA_TO_DEVICE:
+	case MEM_TO_DEV:
 		desc->lli.saddr = buf_addr + (period_len * period_index);
 		desc->lli.daddr = atslave->tx_reg;
 		desc->lli.ctrla = ctrla;
@@ -833,7 +833,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
 				| ATC_DIF(AT_DMA_PER_IF);
 		break;
 
-	case DMA_FROM_DEVICE:
+	case DEV_TO_MEM:
 		desc->lli.saddr = atslave->rx_reg;
 		desc->lli.daddr = buf_addr + (period_len * period_index);
 		desc->lli.ctrla = ctrla;
@@ -861,7 +861,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
  */
 static struct dma_async_tx_descriptor *
 atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
-		size_t period_len, enum dma_data_direction direction)
+		size_t period_len, enum dma_transfer_direction direction)
 {
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma_slave	*atslave = chan->private;

drivers/dma/at_hdmac.c atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, · line 878

Quoted 8 lines
drivers/dma/at_hdmac.c +1 -1
@@ -872,7 +872,7 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
 	unsigned int		i;
 
 	dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@0x%08x - %d (%d/%d)\n",
-			direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE",
+			direction == MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
 			buf_addr,
 			periods, buf_len, period_len);
 

For at_hdmac (Atmel DMA controller)

Best regards,

Signature · 1 line
Nicolas Ferre
#13 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

In reply to Vinod Koul

A general note to this rework. I haven't been cc'ed on patch 00/10, so, replying here. Are we sure it is a good idea to name these new macros like this:

MEM_TO_DEV,
DEV_TO_MEM,
...

i.e., without a common namespace? Wouldn't something like DMA_DIRECTION_* be better?

Quoted 20 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Jassi Brar <[email protected]>
Cc Russell King <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc H Hartley Sweeten <[email protected]>
Cc Li Yang <[email protected]>
Cc Zhang Wei <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Yong Wang <[email protected]>
Cc Tomoya MORINAGA <[email protected]>
Cc Boojin Kim <[email protected]>
Cc Barry Song <[email protected]>

---

[snip]

Quoted 13 lines
drivers/dma/shdma.c +0 -1
index 81809c2..cab7d3e 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/dmaengine.h>
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/sh_dma.h>

drivers/dma/shdma.c static void sh_dmae_free_chan_resources(struct dma_chan *chan) · line 483

Quoted 8 lines
drivers/dma/shdma.c +2 -2
@@ -479,19 +478,19 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
  * @sh_chan:	DMA channel
  * @flags:	DMA transfer flags
  * @dest:	destination DMA address, incremented when direction equals
- *		DMA_FROM_DEVICE or DMA_BIDIRECTIONAL
+ *		DEV_TO_MEM
  * @src:	source DMA address, incremented when direction equals
- *		DMA_TO_DEVICE or DMA_BIDIRECTIONAL
+ *		MEM_TO_DEV

Why have you changed the above two comments? Doesn't seem correct to me.

Quoted 68 lines
drivers/dma/shdma.c +9 -9
  * @len:	DMA transfer length
  * @first:	if NULL, set to the current descriptor and cookie set to -EBUSY
  * @direction:	needed for slave DMA to decide which address to keep constant,
- *		equals DMA_BIDIRECTIONAL for MEMCPY
+ *		equals MEM_TO_MEM for MEMCPY
  * Returns 0 or an error
  * Locks: called with desc_lock held
  */
 static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
 	unsigned long flags, dma_addr_t *dest, dma_addr_t *src, size_t *len,
-	struct sh_desc **first, enum dma_data_direction direction)
+	struct sh_desc **first, enum dma_transfer_direction direction)
 {
 	struct sh_desc *new;
 	size_t copy_size;
@@ -531,9 +530,9 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
 	new->direction = direction;
 
 	*len -= copy_size;
-	if (direction == DMA_BIDIRECTIONAL || direction == DMA_TO_DEVICE)
+	if (direction == MEM_TO_MEM || direction == MEM_TO_DEV)
 		*src += copy_size;
-	if (direction == DMA_BIDIRECTIONAL || direction == DMA_FROM_DEVICE)
+	if (direction == MEM_TO_MEM || direction == DEV_TO_MEM)
 		*dest += copy_size;
 
 	return new;
@@ -546,12 +545,12 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
  * converted to scatter-gather to guarantee consistent locking and a correct
  * list manipulation. For slave DMA direction carries the usual meaning, and,
  * logically, the SG list is RAM and the addr variable contains slave address,
- * e.g., the FIFO I/O register. For MEMCPY direction equals DMA_BIDIRECTIONAL
+ * e.g., the FIFO I/O register. For MEMCPY direction equals MEM_TO_MEM
  * and the SG list contains only one element and points at the source buffer.
  */
 static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_chan,
 	struct scatterlist *sgl, unsigned int sg_len, dma_addr_t *addr,
-	enum dma_data_direction direction, unsigned long flags)
+	enum dma_transfer_direction direction, unsigned long flags)
 {
 	struct scatterlist *sg;
 	struct sh_desc *first = NULL, *new = NULL /* compiler... */;
@@ -592,7 +591,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_sg(struct sh_dmae_chan *sh_c
 			dev_dbg(sh_chan->dev, "Add SG #%d@%p[%d], dma %llx\n",
 				i, sg, len, (unsigned long long)sg_addr);
 
-			if (direction == DMA_FROM_DEVICE)
+			if (direction == DEV_TO_MEM)
 				new = sh_dmae_add_desc(sh_chan, flags,
 						&sg_addr, addr, &len, &first,
 						direction);
@@ -646,13 +645,13 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
 	sg_dma_address(&sg) = dma_src;
 	sg_dma_len(&sg) = len;
 
-	return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, DMA_BIDIRECTIONAL,
+	return sh_dmae_prep_sg(sh_chan, &sg, 1, &dma_dest, MEM_TO_MEM,
 			       flags);
 }
 
 static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 	struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
-	enum dma_data_direction direction, unsigned long flags)
+	enum dma_transfer_direction direction, unsigned long flags)
 {
 	struct sh_dmae_slave *param;
 	struct sh_dmae_chan *sh_chan;

drivers/dma/shdma.c static void dmae_do_tasklet(unsigned long data) · line 1001

Quoted 8 lines
drivers/dma/shdma.c +1 -1
@@ -996,7 +995,7 @@ static void dmae_do_tasklet(unsigned long data)
 	spin_lock_irq(&sh_chan->desc_lock);
 	list_for_each_entry(desc, &sh_chan->ld_queue, node) {
 		if (desc->mark == DESC_SUBMITTED &&
-		    ((desc->direction == DMA_FROM_DEVICE &&
+		    ((desc->direction == DEV_TO_MEM &&
 		      (desc->hw.dar + desc->hw.tcr) == dar_buf) ||
 		     (desc->hw.sar + desc->hw.tcr) == sar_buf)) {
 			dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n",

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#14 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

Quoted 6 lines · Guennadi Liakhovetski

A general note to this rework. I haven't been cc'ed on patch 00/10, so,
replying here. Are we sure it is a good idea to name these new macros like
this:

Quoted 7 lines

MEM_TO_DEV,
DEV_TO_MEM,
...

i.e., without a common namespace? Wouldn't something like DMA_DIRECTION_*
be better?

Yes makes sense. I am leaning towards DMA_*

Signature · 1 line
~Vinod
#15 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

In reply to Guennadi Liakhovetski

On Mon, 2011-10-17 at 14:52 +0200, Guennadi Liakhovetski wrote:

Sorry for replying late...

Quoted 18 lines

drivers/dma/shdma.c static void sh_dmae_free_chan_resources(struct

Quoted 13 lines
drivers/dma/shdma.c +0 -1
index 81809c2..cab7d3e 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/dmaengine.h>
 #include <linux/delay.h>
-#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/sh_dma.h>
@@ -479,19 +478,19 @@ static void sh_dmae_free_chan_resources(struct

dma_chan *chan)

drivers/dma/shdma.c static void sh_dmae_free_chan_resources(struct dma_chan *chan)

Quoted 3 lines
drivers/dma/shdma.c +0 -0
  * @sh_chan: DMA channel
  * @flags:   DMA transfer flags
  * @dest:    destination DMA address, incremented when direction

equals

Quoted 8 lines

drivers/dma/shdma.c static void sh_dmae_free_chan_resources(struct dma_chan *chan) · line 483

Quoted 5 lines
drivers/dma/shdma.c +2 -2
- *           DMA_FROM_DEVICE or DMA_BIDIRECTIONAL
+ *           DEV_TO_MEM
  * @src:     source DMA address, incremented when direction equals
- *           DMA_TO_DEVICE or DMA_BIDIRECTIONAL
+ *           MEM_TO_DEV

Why have you changed the above two comments? Doesn't seem correct to me.

No this is the right comment.

After the direction flag changes, the sh_dmae_add_desc will take new flags for direction. The valid flags would be DEV_TO_MEM and DEV_TO_DEVICE only.

Signature · 1 line
~Vinod
#16 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

In reply to Vinod Koul

I haven't followed this discussion at all so perhaps you were aware but this introduces a Sparse warning in linux-next.

drivers/dma/timb_dma.c:168:17: warning: mixing different enum types
drivers/dma/timb_dma.c:168:17: int enum dma_transfer_direction versus
drivers/dma/timb_dma.c:168:17: int enum dma_data_direction
drivers/dma/timb_dma.c:172:32: warning: mixing different enum types
drivers/dma/timb_dma.c:172:32: int enum dma_transfer_direction versus
drivers/dma/timb_dma.c:172:32: int enum dma_data_direction

regards,
dan carpenter

author
#17 lore raw

Re: [PATCH 02/10] dmaengine: move drivers to dma_transfer_direction

Quoted 9 lines · Dan Carpenter

I haven't followed this discussion at all so perhaps you were aware but this introduces a Sparse warning in linux-next.

drivers/dma/timb_dma.c:168:17: warning: mixing different enum types
drivers/dma/timb_dma.c:168:17: int enum dma_transfer_direction versus
drivers/dma/timb_dma.c:168:17: int enum dma_data_direction
drivers/dma/timb_dma.c:172:32: warning: mixing different enum types
drivers/dma/timb_dma.c:172:32: int enum dma_transfer_direction versus
drivers/dma/timb_dma.c:172:32: int enum dma_data_direction

Thanks, below should fix this

drivers/dma/timb_dma.c +4 -4
index 8c88072..d142ae1 100644
@@ -166,10 +166,10 @@ static void __td_unmap_desc(struct timb_dma_chan *td_chan, const u8 *dma_desc,
 
 	if (single)
 		dma_unmap_single(chan2dev(&td_chan->chan), addr, len,
-			td_chan->direction);
+			DMA_TO_DEVICE);
 	else
 		dma_unmap_page(chan2dev(&td_chan->chan), addr, len,
-			td_chan->direction);
+			DMA_TO_DEVICE);
 }
 
 static void __td_unmap_descs(struct timb_dma_desc *td_desc, bool single)
@@ -398,7 +398,7 @@ static struct timb_dma_desc *td_alloc_init_desc(struct timb_dma_chan *td_chan)
 	td_desc->txd.flags = DMA_CTRL_ACK;
 
 	td_desc->txd.phys = dma_map_single(chan2dmadev(chan),
-		td_desc->desc_list, td_desc->desc_list_len, DMA_MEM_TO_DEV);
+		td_desc->desc_list, td_desc->desc_list_len, DMA_TO_DEVICE);
 
 	err = dma_mapping_error(chan2dmadev(chan), td_desc->txd.phys);
 	if (err) {
@@ -419,7 +419,7 @@ static void td_free_desc(struct timb_dma_desc *td_desc)
 {
 	dev_dbg(chan2dev(td_desc->txd.chan), "Freeing desc: %p\n", td_desc);
 	dma_unmap_single(chan2dmadev(td_desc->txd.chan), td_desc->txd.phys,
-		td_desc->desc_list_len, DMA_MEM_TO_DEV);
+		td_desc->desc_list_len, DMA_TO_DEVICE);
 
 	kfree(td_desc->desc_list);
 	kfree(td_desc);
Signature · 1 line
~Vinod
author
#18 lore raw

PATCH 3/10 plat-samsung: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Boojin Kim <[email protected]>
---
 arch/arm/plat-samsung/dma-ops.c              |    4 ++--
 arch/arm/plat-samsung/include/plat/dma-ops.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/plat-samsung/dma-ops.c +2 -2
index 6e3d9ab..a044171 100644
@@ -35,14 +35,14 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
 
 	chan = dma_request_channel(mask, pl330_filter, (void *)dma_ch);
 
-	if (info->direction == DMA_FROM_DEVICE) {
+	if (info->direction == DEV_TO_MEM) {
 		memset(&slave_config, 0, sizeof(struct dma_slave_config));
 		slave_config.direction = info->direction;
 		slave_config.src_addr = info->fifo;
 		slave_config.src_addr_width = info->width;
 		slave_config.src_maxburst = 1;
 		dmaengine_slave_config(chan, &slave_config);
-	} else if (info->direction == DMA_TO_DEVICE) {
+	} else if (info->direction == MEM_TO_DEV) {
 		memset(&slave_config, 0, sizeof(struct dma_slave_config));
 		slave_config.direction = info->direction;
 		slave_config.dst_addr = info->fifo;
arch/arm/plat-samsung/include/plat/dma-ops.h +2 -2
index 4c1a363..1256115 100644
@@ -17,7 +17,7 @@
 
 struct samsung_dma_prep_info {
 	enum dma_transaction_type cap;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	dma_addr_t buf;
 	unsigned long period;
 	unsigned long len;
@@ -27,7 +27,7 @@ struct samsung_dma_prep_info {
 
 struct samsung_dma_info {
 	enum dma_transaction_type cap;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	enum dma_slave_buswidth width;
 	dma_addr_t fifo;
 	struct s3c2410_dma_client *client;
Signature · 1 line
1.7.0.4
Acked-by on v1 3/10
#19 lore raw

RE: [PATCH 03/10] plat-samsung: move to dma_transfer_direction

Quoted 6 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>

Hi Vinod,
If you want to take this in your tree, you can go ahead with ack from me.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Review

Quoted 7 lines
Cc Boojin Kim <[email protected]>
---
 arch/arm/plat-samsung/dma-ops.c              |    4 ++--
 arch/arm/plat-samsung/include/plat/dma-ops.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-samsung/dma-ops.c

Quoted 46 lines

index 6e3d9ab..a044171 100644

arch/arm/plat-samsung/dma-ops.c +2 -2
@@ -35,14 +35,14 @@ static unsigned samsung_dmadev_request(enum dma_ch
 dma_ch,
 
 	chan = dma_request_channel(mask, pl330_filter, (void *)dma_ch);
 
-	if (info->direction == DMA_FROM_DEVICE) {
+	if (info->direction == DEV_TO_MEM) {
 		memset(&slave_config, 0, sizeof(struct dma_slave_config));
 		slave_config.direction = info->direction;
 		slave_config.src_addr = info->fifo;
 		slave_config.src_addr_width = info->width;
 		slave_config.src_maxburst = 1;
 		dmaengine_slave_config(chan, &slave_config);
-	} else if (info->direction == DMA_TO_DEVICE) {
+	} else if (info->direction == MEM_TO_DEV) {
 		memset(&slave_config, 0, sizeof(struct dma_slave_config));
 		slave_config.direction = info->direction;
arch/arm/plat-samsung/dma-ops.c +0 -0
 		slave_config.dst_addr = info->fifo;
arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/dma-ops.h +0 -0

samsung/include/plat/dma-ops.h
index 4c1a363..1256115 100644

arch/arm/plat-samsung/include/plat/dma-ops.h +2 -3
@@ -17,7 +17,7 @@
 
 struct samsung_dma_prep_info {
 	enum dma_transaction_type cap;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	dma_addr_t buf;
 	unsigned long period;
 	unsigned long len;
@@ -27,7 +27,7 @@ struct samsung_dma_prep_info {
 
 struct samsung_dma_info {
 	enum dma_transaction_type cap;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	enum dma_slave_buswidth width;
 	dma_addr_t fifo;
 	struct s3c2410_dma_client *client;
--

1.7.0.4

#20 lore raw

RE: [PATCH 03/10] plat-samsung: move to dma_transfer_direction

Quoted 8 lines · Kukjin Kim
Quoted 6 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Quoted 5 lines

Hi Vinod,
If you want to take this in your tree, you can go ahead with ack from me.

Thanks, I think I will take the series thru my tree, makes things easier to manage

Signature · 1 line
~Vinod
author
#21 lore raw

PATCH 4/10 media-video: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Mauro Carvalho Chehab <[email protected]>
Cc Paul Mundt <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
---
 drivers/media/video/mx3_camera.c |    2 +-
 drivers/media/video/timblogiw.c  |    2 +-
 drivers/video/mx3fb.c            |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/video/mx3_camera.c +1 -1
index c045b47..b6ac932 100644
@@ -251,7 +251,7 @@ static int mx3_videobuf_prepare(struct vb2_buffer *vb)
 		sg_dma_len(sg)		= new_size;
 
 		buf->txd = ichan->dma_chan.device->device_prep_slave_sg(
-			&ichan->dma_chan, sg, 1, DMA_FROM_DEVICE,
+			&ichan->dma_chan, sg, 1, DEV_TO_MEM,
 			DMA_PREP_INTERRUPT);
 		if (!buf->txd)
 			return -EIO;
drivers/media/video/timblogiw.c +1 -1
index 84cd1b6..1940d47 100644
@@ -564,7 +564,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
 	spin_unlock_irq(&fh->queue_lock);
 
 	desc = fh->chan->device->device_prep_slave_sg(fh->chan,
-		buf->sg, sg_elems, DMA_FROM_DEVICE,
+		buf->sg, sg_elems, DEV_TO_MEM,
 		DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
 	if (!desc) {
 		spin_lock_irq(&fh->queue_lock);
drivers/video/mx3fb.c +2 -2
index 7e3a490..7b0232f 100644
@@ -334,7 +334,7 @@ static void sdc_enable_channel(struct mx3fb_info *mx3_fbi)
 	/* This enables the channel */
 	if (mx3_fbi->cookie < 0) {
 		mx3_fbi->txd = dma_chan->device->device_prep_slave_sg(dma_chan,
-		      &mx3_fbi->sg[0], 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT);
+		      &mx3_fbi->sg[0], 1, MEM_TO_DEV, DMA_PREP_INTERRUPT);
 		if (!mx3_fbi->txd) {
 			dev_err(mx3fb->dev, "Cannot allocate descriptor on %d\n",
 				dma_chan->chan_id);
@@ -1104,7 +1104,7 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
 		async_tx_ack(mx3_fbi->txd);
 
 	txd = dma_chan->device->device_prep_slave_sg(dma_chan, sg +
-		mx3_fbi->cur_ipu_buf, 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT);
+		mx3_fbi->cur_ipu_buf, 1, MEM_TO_DEV, DMA_PREP_INTERRUPT);
 	if (!txd) {
 		dev_err(fbi->device,
 			"Error preparing a DMA transaction descriptor.\n");
Signature · 1 line
1.7.0.4
Acked-by on v1 4/10
#22 lore raw

Re: [PATCH 04/10] media-video: move to dma_transfer_direction

This patch is not purely media/video:

Quoted 10 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Mauro Carvalho Chehab <[email protected]>
Cc Paul Mundt <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
---
 drivers/media/video/mx3_camera.c |    2 +-
 drivers/media/video/timblogiw.c  |    2 +-
 drivers/video/mx3fb.c            |    4 ++--

This is a framebuffer driver, as such it has nothing to do with the media / v4l subsystem, it just happens to use the same dmaengine driver, as mx3_camera. Not sure if you want to split this patch, or at least adjust its description.

As for the contents: for mx3_camera and mx3fb:

Thanks
Guennadi

Quoted 53 lines
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/video/mx3_camera.c +1 -1
index c045b47..b6ac932 100644
@@ -251,7 +251,7 @@ static int mx3_videobuf_prepare(struct vb2_buffer *vb)
 		sg_dma_len(sg)		= new_size;
 
 		buf->txd = ichan->dma_chan.device->device_prep_slave_sg(
-			&ichan->dma_chan, sg, 1, DMA_FROM_DEVICE,
+			&ichan->dma_chan, sg, 1, DEV_TO_MEM,
 			DMA_PREP_INTERRUPT);
 		if (!buf->txd)
 			return -EIO;
drivers/media/video/timblogiw.c +1 -1
index 84cd1b6..1940d47 100644
@@ -564,7 +564,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
 	spin_unlock_irq(&fh->queue_lock);
 
 	desc = fh->chan->device->device_prep_slave_sg(fh->chan,
-		buf->sg, sg_elems, DMA_FROM_DEVICE,
+		buf->sg, sg_elems, DEV_TO_MEM,
 		DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
 	if (!desc) {
 		spin_lock_irq(&fh->queue_lock);
drivers/video/mx3fb.c +2 -2
index 7e3a490..7b0232f 100644
@@ -334,7 +334,7 @@ static void sdc_enable_channel(struct mx3fb_info *mx3_fbi)
 	/* This enables the channel */
 	if (mx3_fbi->cookie < 0) {
 		mx3_fbi->txd = dma_chan->device->device_prep_slave_sg(dma_chan,
-		      &mx3_fbi->sg[0], 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT);
+		      &mx3_fbi->sg[0], 1, MEM_TO_DEV, DMA_PREP_INTERRUPT);
 		if (!mx3_fbi->txd) {
 			dev_err(mx3fb->dev, "Cannot allocate descriptor on %d\n",
 				dma_chan->chan_id);
@@ -1104,7 +1104,7 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
 		async_tx_ack(mx3_fbi->txd);
 
 	txd = dma_chan->device->device_prep_slave_sg(dma_chan, sg +
-		mx3_fbi->cur_ipu_buf, 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT);
+		mx3_fbi->cur_ipu_buf, 1, MEM_TO_DEV, DMA_PREP_INTERRUPT);
 	if (!txd) {
 		dev_err(fbi->device,
 			"Error preparing a DMA transaction descriptor.\n");
Signature · 1 line
1.7.0.4

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

author
#23 lore raw

PATCH 5/10 carma: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

CC Ira W. Snyder <[email protected]>

---
 drivers/misc/carma/carma-fpga-program.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/misc/carma/carma-fpga-program.c +1 -1
index 7ce6065..c13e578 100644
@@ -513,7 +513,7 @@ static noinline int fpga_program_dma(struct fpga_dev *priv)
 	 * transaction, and then put it under external control
 	 */
 	memset(&config, 0, sizeof(config));
-	config.direction = DMA_TO_DEVICE;
+	config.direction = MEM_TO_DEV;
 	config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	config.dst_maxburst = fpga_fifo_size(priv->regs) / 2 / 4;
 	ret = chan->device->device_control(chan, DMA_SLAVE_CONFIG,
Signature · 1 line
1.7.0.4
author
#24 lore raw

PATCH 6/10 mmc-host: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Nicolas Ferre <[email protected]>
Cc Chris Ball <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
---
 drivers/mmc/host/atmel-mci.c    |    9 ++++++---
 drivers/mmc/host/mmci.c         |   11 +++++++----
 drivers/mmc/host/mxcmmc.c       |   10 +++++++---
 drivers/mmc/host/mxs-mmc.c      |    7 ++++++-
 drivers/mmc/host/sh_mmcif.c     |    4 ++--
 drivers/mmc/host/tmio_mmc_dma.c |    4 ++--
 6 files changed, 30 insertions(+), 15 deletions(-)
drivers/mmc/host/atmel-mci.c +6 -3
index fa8cae1..7c9d28a 100644
@@ -681,16 +681,19 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 	if (atmci_is_mci2())
 		mci_writel(host, DMA, MCI_DMA_CHKSIZE(3) | MCI_DMAEN);
 
-	if (data->flags & MMC_DATA_READ)
+	if (data->flags & MMC_DATA_READ) {
 		direction = DMA_FROM_DEVICE;
-	else
+		slave_dirn = DEV_TO_MEM;
+	} else {
 		direction = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
+	}
 
 	sglen = dma_map_sg(chan->device->dev, data->sg,
 			   data->sg_len, direction);
 
 	desc = chan->device->device_prep_slave_sg(chan,
-			data->sg, sglen, direction,
+			data->sg, sglen, slave_dirn,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc)
 		goto unmap_exit;
drivers/mmc/host/mmci.c +7 -4
index 56e9a41..efbc743 100644
@@ -372,6 +372,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
 	struct dma_chan *chan;
 	struct dma_device *device;
 	struct dma_async_tx_descriptor *desc;
+	enum dma_data_direction buffer_dirn;
 	int nr_sg;
 
 	/* Check if next job is already prepared */
@@ -385,10 +386,12 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
 	}
 
 	if (data->flags & MMC_DATA_READ) {
-		conf.direction = DMA_FROM_DEVICE;
+		conf.direction = DEV_TO_MEM;
+		buffer_dirn = DMA_FROM_DEVICE;
 		chan = host->dma_rx_channel;
 	} else {
-		conf.direction = DMA_TO_DEVICE;
+		conf.direction = MEM_TO_DEV;
+		buffer_dirn = DMA_TO_DEVICE;
 		chan = host->dma_tx_channel;
 	}
 
@@ -401,7 +404,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
 		return -EINVAL;
 
 	device = chan->device;
-	nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, conf.direction);
+	nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, buffer_dirn);
 	if (nr_sg == 0)
 		return -EINVAL;
 
@@ -424,7 +427,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
  unmap_exit:
 	if (!next)
 		dmaengine_terminate_all(chan);
-	dma_unmap_sg(device->dev, data->sg, data->sg_len, conf.direction);
+	dma_unmap_sg(device->dev, data->sg, data->sg_len, buffer_dirn);
 	return -ENOMEM;
 }
 
drivers/mmc/host/mxcmmc.c +7 -3
index 14aa213..4115108 100644
@@ -217,6 +217,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 	unsigned int blksz = data->blksz;
 	unsigned int datasize = nob * blksz;
 	struct scatterlist *sg;
+	enum dma_transfer_direction slave_dirn;
 	int i, nents;
 
 	if (data->flags & MMC_DATA_STREAM)
@@ -239,10 +240,13 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 		}
 	}
 
-	if (data->flags & MMC_DATA_READ)
+	if (data->flags & MMC_DATA_READ) {
 		host->dma_dir = DMA_FROM_DEVICE;
-	else
+		slave_dirn = DEV_TO_MEM;
+	} else {
 		host->dma_dir = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
+	}
 
 	nents = dma_map_sg(host->dma->device->dev, data->sg,
 				     data->sg_len,  host->dma_dir);
@@ -250,7 +254,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 		return -EINVAL;
 
 	host->desc = host->dma->device->device_prep_slave_sg(host->dma,
-		data->sg, data->sg_len, host->dma_dir,
+		data->sg, data->sg_len, slave_dirn,
 		DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
 	if (!host->desc) {
drivers/mmc/host/mxs-mmc.c +6 -1
index d513d47..c0a3def 100644
@@ -153,6 +153,7 @@ struct mxs_mmc_host {
 	struct dma_chan         	*dmach;
 	struct mxs_dma_data		dma_data;
 	unsigned int			dma_dir;
+	enum dma_transfer_direction	slave_dirn;
 	u32				ssp_pio_words[SSP_PIO_NUM];
 
 	unsigned int			version;
@@ -323,7 +324,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma(
 	}
 
 	desc = host->dmach->device->device_prep_slave_sg(host->dmach,
-				sgl, sg_len, host->dma_dir, append);
+				sgl, sg_len, host->slave_dirn, append);
 	if (desc) {
 		desc->callback = mxs_mmc_dma_irq_callback;
 		desc->callback_param = host;
@@ -432,6 +433,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
 	int i;
 
 	unsigned short dma_data_dir, timeout;
+	enum dma_transfer_direction slave_dirn;
 	unsigned int data_size = 0, log2_blksz;
 	unsigned int blocks = data->blocks;
 
@@ -447,9 +449,11 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
 
 	if (data->flags & MMC_DATA_WRITE) {
 		dma_data_dir = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
 		read = 0;
 	} else {
 		dma_data_dir = DMA_FROM_DEVICE;
+		slave_dirn = DEV_TO_MEM;
 		read = BM_SSP_CTRL0_READ;
 	}
 
@@ -517,6 +521,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
 	WARN_ON(host->data != NULL);
 	host->data = data;
 	host->dma_dir = dma_data_dir;
+	host->slave_dirn = slave_dirn;
 	desc = mxs_mmc_prep_dma(host, 1);
 	if (!desc)
 		goto out;
drivers/mmc/host/sh_mmcif.c +2 -2
index 557886b..7a374c9 100644
@@ -230,7 +230,7 @@ static void sh_mmcif_start_dma_rx(struct sh_mmcif_host *host)
 	if (ret > 0) {
 		host->dma_active = true;
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+			DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	}
 
 	if (desc) {
@@ -278,7 +278,7 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host)
 	if (ret > 0) {
 		host->dma_active = true;
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+			MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	}
 
 	if (desc) {
drivers/mmc/host/tmio_mmc_dma.c +2 -2
index 86f259c..663624c 100644
@@ -77,7 +77,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);
 	if (ret > 0)
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_FROM_DEVICE, DMA_CTRL_ACK);
+			DEV_TO_MEM, DMA_CTRL_ACK);
 
 	if (desc) {
 		cookie = dmaengine_submit(desc);
@@ -158,7 +158,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);
 	if (ret > 0)
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_TO_DEVICE, DMA_CTRL_ACK);
+			MEM_TO_DEV, DMA_CTRL_ACK);
 
 	if (desc) {
 		cookie = dmaengine_submit(desc);
Signature · 1 line
1.7.0.4
Acked-by on v1 6/10
#25 lore raw

Re: [PATCH 06/10] mmc-host: move to dma_transfer_direction

On 10/14/2011 07:38 AM, Vinod Koul :

Quoted 8 lines

From: Vinod Koul <[email protected]>

Cc Nicolas Ferre <[email protected]>
Cc Chris Ball <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
---
 drivers/mmc/host/atmel-mci.c    |    9 ++++++---

[..]

drivers/mmc/host/atmel-mci.c atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) · line 686

Quoted 11 lines
drivers/mmc/host/atmel-mci.c +2 -2
@@ -681,16 +681,19 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 	if (atmci_is_mci2())
 		mci_writel(host, DMA, MCI_DMA_CHKSIZE(3) | MCI_DMAEN);
 
-	if (data->flags & MMC_DATA_READ)
+	if (data->flags & MMC_DATA_READ) {
 		direction = DMA_FROM_DEVICE;
-	else
+		slave_dirn = DEV_TO_MEM;

It seems that the slave_dirn declaration is missing...

Quoted 4 lines
drivers/mmc/host/atmel-mci.c +3 -0
+	} else {
 		direction = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
+	}

drivers/mmc/host/atmel-mci.c atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) · line 699

Quoted 10 lines
drivers/mmc/host/atmel-mci.c +1 -1
 
 	sglen = dma_map_sg(chan->device->dev, data->sg,
 			   data->sg_len, direction);
 
 	desc = chan->device->device_prep_slave_sg(chan,
-			data->sg, sglen, direction,
+			data->sg, sglen, slave_dirn,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc)
 		goto unmap_exit;

When fixed:

Best regards,

Signature · 1 line
Nicolas Ferre
Acked-by on v1 6/10
#26 lore raw

Re: [PATCH 06/10] mmc-host: move to dma_transfer_direction

In reply to Vinod Koul
Quoted 6 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Nicolas Ferre <[email protected]>
Cc Chris Ball <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>

For sh_mmcifsh_mmcif and tmio_mmc_dma:

(of course, the macro naming comment still holds)

Thanks
Guennadi

Quoted 214 lines
---
 drivers/mmc/host/atmel-mci.c    |    9 ++++++---
 drivers/mmc/host/mmci.c         |   11 +++++++----
 drivers/mmc/host/mxcmmc.c       |   10 +++++++---
 drivers/mmc/host/mxs-mmc.c      |    7 ++++++-
 drivers/mmc/host/sh_mmcif.c     |    4 ++--
 drivers/mmc/host/tmio_mmc_dma.c |    4 ++--
 6 files changed, 30 insertions(+), 15 deletions(-)
drivers/mmc/host/atmel-mci.c +6 -3
index fa8cae1..7c9d28a 100644
@@ -681,16 +681,19 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
 	if (atmci_is_mci2())
 		mci_writel(host, DMA, MCI_DMA_CHKSIZE(3) | MCI_DMAEN);
 
-	if (data->flags & MMC_DATA_READ)
+	if (data->flags & MMC_DATA_READ) {
 		direction = DMA_FROM_DEVICE;
-	else
+		slave_dirn = DEV_TO_MEM;
+	} else {
 		direction = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
+	}
 
 	sglen = dma_map_sg(chan->device->dev, data->sg,
 			   data->sg_len, direction);
 
 	desc = chan->device->device_prep_slave_sg(chan,
-			data->sg, sglen, direction,
+			data->sg, sglen, slave_dirn,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc)
 		goto unmap_exit;
drivers/mmc/host/mmci.c +7 -4
index 56e9a41..efbc743 100644
@@ -372,6 +372,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
 	struct dma_chan *chan;
 	struct dma_device *device;
 	struct dma_async_tx_descriptor *desc;
+	enum dma_data_direction buffer_dirn;
 	int nr_sg;
 
 	/* Check if next job is already prepared */
@@ -385,10 +386,12 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
 	}
 
 	if (data->flags & MMC_DATA_READ) {
-		conf.direction = DMA_FROM_DEVICE;
+		conf.direction = DEV_TO_MEM;
+		buffer_dirn = DMA_FROM_DEVICE;
 		chan = host->dma_rx_channel;
 	} else {
-		conf.direction = DMA_TO_DEVICE;
+		conf.direction = MEM_TO_DEV;
+		buffer_dirn = DMA_TO_DEVICE;
 		chan = host->dma_tx_channel;
 	}
 
@@ -401,7 +404,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
 		return -EINVAL;
 
 	device = chan->device;
-	nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, conf.direction);
+	nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, buffer_dirn);
 	if (nr_sg == 0)
 		return -EINVAL;
 
@@ -424,7 +427,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
  unmap_exit:
 	if (!next)
 		dmaengine_terminate_all(chan);
-	dma_unmap_sg(device->dev, data->sg, data->sg_len, conf.direction);
+	dma_unmap_sg(device->dev, data->sg, data->sg_len, buffer_dirn);
 	return -ENOMEM;
 }
 
drivers/mmc/host/mxcmmc.c +7 -3
index 14aa213..4115108 100644
@@ -217,6 +217,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 	unsigned int blksz = data->blksz;
 	unsigned int datasize = nob * blksz;
 	struct scatterlist *sg;
+	enum dma_transfer_direction slave_dirn;
 	int i, nents;
 
 	if (data->flags & MMC_DATA_STREAM)
@@ -239,10 +240,13 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 		}
 	}
 
-	if (data->flags & MMC_DATA_READ)
+	if (data->flags & MMC_DATA_READ) {
 		host->dma_dir = DMA_FROM_DEVICE;
-	else
+		slave_dirn = DEV_TO_MEM;
+	} else {
 		host->dma_dir = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
+	}
 
 	nents = dma_map_sg(host->dma->device->dev, data->sg,
 				     data->sg_len,  host->dma_dir);
@@ -250,7 +254,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 		return -EINVAL;
 
 	host->desc = host->dma->device->device_prep_slave_sg(host->dma,
-		data->sg, data->sg_len, host->dma_dir,
+		data->sg, data->sg_len, slave_dirn,
 		DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
 	if (!host->desc) {
drivers/mmc/host/mxs-mmc.c +6 -1
index d513d47..c0a3def 100644
@@ -153,6 +153,7 @@ struct mxs_mmc_host {
 	struct dma_chan         	*dmach;
 	struct mxs_dma_data		dma_data;
 	unsigned int			dma_dir;
+	enum dma_transfer_direction	slave_dirn;
 	u32				ssp_pio_words[SSP_PIO_NUM];
 
 	unsigned int			version;
@@ -323,7 +324,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma(
 	}
 
 	desc = host->dmach->device->device_prep_slave_sg(host->dmach,
-				sgl, sg_len, host->dma_dir, append);
+				sgl, sg_len, host->slave_dirn, append);
 	if (desc) {
 		desc->callback = mxs_mmc_dma_irq_callback;
 		desc->callback_param = host;
@@ -432,6 +433,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
 	int i;
 
 	unsigned short dma_data_dir, timeout;
+	enum dma_transfer_direction slave_dirn;
 	unsigned int data_size = 0, log2_blksz;
 	unsigned int blocks = data->blocks;
 
@@ -447,9 +449,11 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
 
 	if (data->flags & MMC_DATA_WRITE) {
 		dma_data_dir = DMA_TO_DEVICE;
+		slave_dirn = MEM_TO_DEV;
 		read = 0;
 	} else {
 		dma_data_dir = DMA_FROM_DEVICE;
+		slave_dirn = DEV_TO_MEM;
 		read = BM_SSP_CTRL0_READ;
 	}
 
@@ -517,6 +521,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
 	WARN_ON(host->data != NULL);
 	host->data = data;
 	host->dma_dir = dma_data_dir;
+	host->slave_dirn = slave_dirn;
 	desc = mxs_mmc_prep_dma(host, 1);
 	if (!desc)
 		goto out;
drivers/mmc/host/sh_mmcif.c +2 -2
index 557886b..7a374c9 100644
@@ -230,7 +230,7 @@ static void sh_mmcif_start_dma_rx(struct sh_mmcif_host *host)
 	if (ret > 0) {
 		host->dma_active = true;
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+			DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	}
 
 	if (desc) {
@@ -278,7 +278,7 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host)
 	if (ret > 0) {
 		host->dma_active = true;
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+			MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	}
 
 	if (desc) {
drivers/mmc/host/tmio_mmc_dma.c +2 -2
index 86f259c..663624c 100644
@@ -77,7 +77,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);
 	if (ret > 0)
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_FROM_DEVICE, DMA_CTRL_ACK);
+			DEV_TO_MEM, DMA_CTRL_ACK);
 
 	if (desc) {
 		cookie = dmaengine_submit(desc);
@@ -158,7 +158,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);
 	if (ret > 0)
 		desc = chan->device->device_prep_slave_sg(chan, sg, ret,
-			DMA_TO_DEVICE, DMA_CTRL_ACK);
+			MEM_TO_DEV, DMA_CTRL_ACK);
 
 	if (desc) {
 		cookie = dmaengine_submit(desc);
Signature · 1 line
1.7.0.4

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

author
#27 lore raw

PATCH 7/10 spi, serial: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Grant Likely <[email protected]>
Cc Alan Cox <[email protected]>
---
 drivers/spi/spi-dw-mid.c        |    8 ++++----
 drivers/spi/spi-ep93xx.c        |    5 ++++-
 drivers/spi/spi-pl022.c         |    8 ++++----
 drivers/spi/spi-topcliff-pch.c  |    4 ++--
 drivers/tty/serial/amba-pl011.c |    8 ++++----
 drivers/tty/serial/pch_uart.c   |    4 ++--
 drivers/tty/serial/sh-sci.c     |    4 ++--
 7 files changed, 22 insertions(+), 19 deletions(-)
drivers/spi/spi-dw-mid.c +4 -4
index 130e555..0e88d91 100644
@@ -131,7 +131,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 	rxchan = dws->rxchan;
 
 	/* 2. Prepare the TX dma transfer */
-	txconf.direction = DMA_TO_DEVICE;
+	txconf.direction = MEM_TO_DEV;
 	txconf.dst_addr = dws->dma_addr;
 	txconf.dst_maxburst = LNW_DMA_MSIZE_16;
 	txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -147,13 +147,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 	txdesc = txchan->device->device_prep_slave_sg(txchan,
 				&dws->tx_sgl,
 				1,
-				DMA_TO_DEVICE,
+				MEM_TO_DEV,
 				DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
 	txdesc->callback = dw_spi_dma_done;
 	txdesc->callback_param = dws;
 
 	/* 3. Prepare the RX dma transfer */
-	rxconf.direction = DMA_FROM_DEVICE;
+	rxconf.direction = DEV_TO_MEM;
 	rxconf.src_addr = dws->dma_addr;
 	rxconf.src_maxburst = LNW_DMA_MSIZE_16;
 	rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -169,7 +169,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 	rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
 				&dws->rx_sgl,
 				1,
-				DMA_FROM_DEVICE,
+				DEV_TO_MEM,
 				DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
 	rxdesc->callback = dw_spi_dma_done;
 	rxdesc->callback_param = dws;
drivers/spi/spi-ep93xx.c +4 -1
index 1cf6454..8754a39 100644
@@ -550,6 +550,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 	struct dma_async_tx_descriptor *txd;
 	enum dma_slave_buswidth buswidth;
 	struct dma_slave_config conf;
+	enum dma_transfer_direction slave_dirn;
 	struct scatterlist *sg;
 	struct sg_table *sgt;
 	struct dma_chan *chan;
@@ -572,6 +573,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.src_addr = espi->sspdr_phys;
 		conf.src_addr_width = buswidth;
+		slave_dirn = DEV_TO_MEM;
 	} else {
 		chan = espi->dma_tx;
 		buf = t->tx_buf;
@@ -579,6 +581,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.dst_addr = espi->sspdr_phys;
 		conf.dst_addr_width = buswidth;
+		slave_dirn = MEM_TO_DEV;
 	}
 
 	ret = dmaengine_slave_config(chan, &conf);
@@ -630,7 +633,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 		return ERR_PTR(-ENOMEM);
 
 	txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents,
-						 dir, DMA_CTRL_ACK);
+						 slave_dirn, DMA_CTRL_ACK);
 	if (!txd) {
 		dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
 		return ERR_PTR(-ENOMEM);
drivers/spi/spi-pl022.c +4 -4
index 730b4a3..33bcca6 100644
@@ -910,11 +910,11 @@ static int configure_dma(struct pl022 *pl022)
 {
 	struct dma_slave_config rx_conf = {
 		.src_addr = SSP_DR(pl022->phybase),
-		.direction = DMA_FROM_DEVICE,
+		.direction = DEV_TO_MEM,
 	};
 	struct dma_slave_config tx_conf = {
 		.dst_addr = SSP_DR(pl022->phybase),
-		.direction = DMA_TO_DEVICE,
+		.direction = MEM_TO_DEV,
 	};
 	unsigned int pages;
 	int ret;
@@ -1051,7 +1051,7 @@ static int configure_dma(struct pl022 *pl022)
 	rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
 				      pl022->sgt_rx.sgl,
 				      rx_sglen,
-				      DMA_FROM_DEVICE,
+				      DEV_TO_MEM,
 				      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!rxdesc)
 		goto err_rxdesc;
@@ -1059,7 +1059,7 @@ static int configure_dma(struct pl022 *pl022)
 	txdesc = txchan->device->device_prep_slave_sg(txchan,
 				      pl022->sgt_tx.sgl,
 				      tx_sglen,
-				      DMA_TO_DEVICE,
+				      MEM_TO_DEV,
 				      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!txdesc)
 		goto err_txdesc;
drivers/spi/spi-topcliff-pch.c +2 -2
index 1d23f38..11232a0 100644
@@ -1051,7 +1051,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	}
 	sg = dma->sg_rx_p;
 	desc_rx = dma->chan_rx->device->device_prep_slave_sg(dma->chan_rx, sg,
-					num, DMA_FROM_DEVICE,
+					num, DEV_TO_MEM,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc_rx) {
 		dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n",
@@ -1086,7 +1086,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	}
 	sg = dma->sg_tx_p;
 	desc_tx = dma->chan_tx->device->device_prep_slave_sg(dma->chan_tx,
-					sg, num, DMA_TO_DEVICE,
+					sg, num, MEM_TO_DEV,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc_tx) {
 		dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n",
drivers/tty/serial/amba-pl011.c +4 -4
index f5f6831..d5305af 100644
@@ -268,7 +268,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
 	struct dma_slave_config tx_conf = {
 		.dst_addr = uap->port.mapbase + UART01x_DR,
 		.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
-		.direction = DMA_TO_DEVICE,
+		.direction = MEM_TO_DEV,
 		.dst_maxburst = uap->fifosize >> 1,
 	};
 	struct dma_chan *chan;
@@ -301,7 +301,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
 		struct dma_slave_config rx_conf = {
 			.src_addr = uap->port.mapbase + UART01x_DR,
 			.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
-			.direction = DMA_FROM_DEVICE,
+			.direction = DEV_TO_MEM,
 			.src_maxburst = uap->fifosize >> 1,
 		};
 
@@ -480,7 +480,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
 		return -EBUSY;
 	}
 
-	desc = dma_dev->device_prep_slave_sg(chan, &dmatx->sg, 1, DMA_TO_DEVICE,
+	desc = dma_dev->device_prep_slave_sg(chan, &dmatx->sg, 1, MEM_TO_DEV,
 					     DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE);
@@ -676,7 +676,7 @@ static int pl011_dma_rx_trigger_dma(struct uart_amba_port *uap)
 		&uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a;
 	dma_dev = rxchan->device;
 	desc = rxchan->device->device_prep_slave_sg(rxchan, &sgbuf->sg, 1,
-					DMA_FROM_DEVICE,
+					DEV_TO_MEM,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	/*
 	 * If the DMA engine is busy and cannot prepare a
drivers/tty/serial/pch_uart.c +2 -2
index b46218d..162189e 100644
@@ -747,7 +747,7 @@ static int dma_handle_rx(struct eg20t_port *priv)
 	sg_dma_address(sg) = priv->rx_buf_dma;
 
 	desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx,
-			sg, 1, DMA_FROM_DEVICE,
+			sg, 1, DEV_TO_MEM,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
 	if (!desc)
@@ -906,7 +906,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
 	}
 
 	desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx,
-					priv->sg_tx_p, nent, DMA_TO_DEVICE,
+					priv->sg_tx_p, nent, MEM_TO_DEV,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n",
drivers/tty/serial/sh-sci.c +2 -2
index dbd32a1..e147e65 100644
@@ -1207,7 +1207,7 @@ static void sci_submit_rx(struct sci_port *s)
 		struct dma_async_tx_descriptor *desc;
 
 		desc = chan->device->device_prep_slave_sg(chan,
-			sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT);
+			sg, 1, DEV_TO_MEM, DMA_PREP_INTERRUPT);
 
 		if (desc) {
 			s->desc_rx[i] = desc;
@@ -1322,7 +1322,7 @@ static void work_fn_tx(struct work_struct *work)
 	BUG_ON(!sg_dma_len(sg));
 
 	desc = chan->device->device_prep_slave_sg(chan,
-			sg, s->sg_len_tx, DMA_TO_DEVICE,
+			sg, s->sg_len_tx, MEM_TO_DEV,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		/* switch to PIO */
Signature · 1 line
1.7.0.4
Acked-by on v1 7/10
#28 lore raw

Re: [PATCH 07/10] spi, serial: move to dma_transfer_direction

Quoted 29 lines · Vinod Koul
drivers/spi/spi-ep93xx.c +3 -0
index 1cf6454..8754a39 100644
@@ -550,6 +550,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 	struct dma_async_tx_descriptor *txd;
 	enum dma_slave_buswidth buswidth;
 	struct dma_slave_config conf;
+	enum dma_transfer_direction slave_dirn;
 	struct scatterlist *sg;
 	struct sg_table *sgt;
 	struct dma_chan *chan;
@@ -572,6 +573,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.src_addr = espi->sspdr_phys;
 		conf.src_addr_width = buswidth;
+		slave_dirn = DEV_TO_MEM;
 	} else {
 		chan = espi->dma_tx;
 		buf = t->tx_buf;
@@ -579,6 +581,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.dst_addr = espi->sspdr_phys;
 		conf.dst_addr_width = buswidth;
+		slave_dirn = MEM_TO_DEV;
 	}
 
 	ret = dmaengine_slave_config(chan, &conf);

drivers/spi/spi-ep93xx.c ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) · line 639

Quoted 8 lines
drivers/spi/spi-ep93xx.c +1 -1
@@ -630,7 +633,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 		return ERR_PTR(-ENOMEM);
 
 	txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents,
-						 dir, DMA_CTRL_ACK);
+						 slave_dirn, DMA_CTRL_ACK);
 	if (!txd) {
 		dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
 		return ERR_PTR(-ENOMEM);

Can you also change the ep93xx_spi_setup_dma() function to use these new values? Like the patch below.

Otherwise,

drivers/spi/spi-ep93xx.c +2 -2
index 66c3d9b..d97583f 100644
@@ -982,7 +982,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
 	dma_cap_set(DMA_SLAVE, mask);
 
 	espi->dma_rx_data.port = EP93XX_DMA_SSP;
-	espi->dma_rx_data.direction = DMA_FROM_DEVICE;
+	espi->dma_rx_data.direction = DEV_TO_MEM;
 	espi->dma_rx_data.name = "ep93xx-spi-rx";
 
 	espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter,
@@ -993,7 +993,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
 	}
 
 	espi->dma_tx_data.port = EP93XX_DMA_SSP;
-	espi->dma_tx_data.direction = DMA_TO_DEVICE;
+	espi->dma_tx_data.direction = MEM_TO_DEV;
 	espi->dma_tx_data.name = "ep93xx-spi-tx";
 
 	espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter,
#29 lore raw

Re: [PATCH 07/10] spi, serial: move to dma_transfer_direction

Quoted 43 lines · Mika Westerberg
Quoted 29 lines · Vinod Koul
drivers/spi/spi-ep93xx.c +3 -0
index 1cf6454..8754a39 100644
@@ -550,6 +550,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 	struct dma_async_tx_descriptor *txd;
 	enum dma_slave_buswidth buswidth;
 	struct dma_slave_config conf;
+	enum dma_transfer_direction slave_dirn;
 	struct scatterlist *sg;
 	struct sg_table *sgt;
 	struct dma_chan *chan;
@@ -572,6 +573,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.src_addr = espi->sspdr_phys;
 		conf.src_addr_width = buswidth;
+		slave_dirn = DEV_TO_MEM;
 	} else {
 		chan = espi->dma_tx;
 		buf = t->tx_buf;
@@ -579,6 +581,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.dst_addr = espi->sspdr_phys;
 		conf.dst_addr_width = buswidth;
+		slave_dirn = MEM_TO_DEV;
 	}
 
 	ret = dmaengine_slave_config(chan, &conf);

drivers/spi/spi-ep93xx.c ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) · line 639

Quoted 8 lines
drivers/spi/spi-ep93xx.c +1 -1
@@ -630,7 +633,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 		return ERR_PTR(-ENOMEM);
 
 	txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents,
-						 dir, DMA_CTRL_ACK);
+						 slave_dirn, DMA_CTRL_ACK);
 	if (!txd) {
 		dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
 		return ERR_PTR(-ENOMEM);

Can you also change the ep93xx_spi_setup_dma() function to use these new values? Like the patch below.

Quoted 3 lines

Otherwise,

Thanks, I will add the below patche as well.

Quoted 23 lines
drivers/spi/spi-ep93xx.c +2 -2
index 66c3d9b..d97583f 100644
@@ -982,7 +982,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
 	dma_cap_set(DMA_SLAVE, mask);
 
 	espi->dma_rx_data.port = EP93XX_DMA_SSP;
-	espi->dma_rx_data.direction = DMA_FROM_DEVICE;
+	espi->dma_rx_data.direction = DEV_TO_MEM;
 	espi->dma_rx_data.name = "ep93xx-spi-rx";
 
 	espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter,
@@ -993,7 +993,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
 	}
 
 	espi->dma_tx_data.port = EP93XX_DMA_SSP;
-	espi->dma_tx_data.direction = DMA_TO_DEVICE;
+	espi->dma_tx_data.direction = MEM_TO_DEV;
 	espi->dma_tx_data.name = "ep93xx-spi-tx";
 
 	espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter,
Signature · 1 line
~Vinod
#30 lore raw

Re: [PATCH 07/10] spi, serial: move to dma_transfer_direction

In reply to Vinod Koul
Quoted 5 lines · Vinod Koul

From: Vinod Koul <[email protected]>

Cc Grant Likely <[email protected]>
Cc Alan Cox <[email protected]>

This looks okay to me. What tree does it need to be merged through?

g.

Quoted 230 lines
---
 drivers/spi/spi-dw-mid.c        |    8 ++++----
 drivers/spi/spi-ep93xx.c        |    5 ++++-
 drivers/spi/spi-pl022.c         |    8 ++++----
 drivers/spi/spi-topcliff-pch.c  |    4 ++--
 drivers/tty/serial/amba-pl011.c |    8 ++++----
 drivers/tty/serial/pch_uart.c   |    4 ++--
 drivers/tty/serial/sh-sci.c     |    4 ++--
 7 files changed, 22 insertions(+), 19 deletions(-)
drivers/spi/spi-dw-mid.c +4 -4
index 130e555..0e88d91 100644
@@ -131,7 +131,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 	rxchan = dws->rxchan;
 
 	/* 2. Prepare the TX dma transfer */
-	txconf.direction = DMA_TO_DEVICE;
+	txconf.direction = MEM_TO_DEV;
 	txconf.dst_addr = dws->dma_addr;
 	txconf.dst_maxburst = LNW_DMA_MSIZE_16;
 	txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -147,13 +147,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 	txdesc = txchan->device->device_prep_slave_sg(txchan,
 				&dws->tx_sgl,
 				1,
-				DMA_TO_DEVICE,
+				MEM_TO_DEV,
 				DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
 	txdesc->callback = dw_spi_dma_done;
 	txdesc->callback_param = dws;
 
 	/* 3. Prepare the RX dma transfer */
-	rxconf.direction = DMA_FROM_DEVICE;
+	rxconf.direction = DEV_TO_MEM;
 	rxconf.src_addr = dws->dma_addr;
 	rxconf.src_maxburst = LNW_DMA_MSIZE_16;
 	rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -169,7 +169,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 	rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
 				&dws->rx_sgl,
 				1,
-				DMA_FROM_DEVICE,
+				DEV_TO_MEM,
 				DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
 	rxdesc->callback = dw_spi_dma_done;
 	rxdesc->callback_param = dws;
drivers/spi/spi-ep93xx.c +4 -1
index 1cf6454..8754a39 100644
@@ -550,6 +550,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 	struct dma_async_tx_descriptor *txd;
 	enum dma_slave_buswidth buswidth;
 	struct dma_slave_config conf;
+	enum dma_transfer_direction slave_dirn;
 	struct scatterlist *sg;
 	struct sg_table *sgt;
 	struct dma_chan *chan;
@@ -572,6 +573,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.src_addr = espi->sspdr_phys;
 		conf.src_addr_width = buswidth;
+		slave_dirn = DEV_TO_MEM;
 	} else {
 		chan = espi->dma_tx;
 		buf = t->tx_buf;
@@ -579,6 +581,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 
 		conf.dst_addr = espi->sspdr_phys;
 		conf.dst_addr_width = buswidth;
+		slave_dirn = MEM_TO_DEV;
 	}
 
 	ret = dmaengine_slave_config(chan, &conf);
@@ -630,7 +633,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
 		return ERR_PTR(-ENOMEM);
 
 	txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents,
-						 dir, DMA_CTRL_ACK);
+						 slave_dirn, DMA_CTRL_ACK);
 	if (!txd) {
 		dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
 		return ERR_PTR(-ENOMEM);
drivers/spi/spi-pl022.c +4 -4
index 730b4a3..33bcca6 100644
@@ -910,11 +910,11 @@ static int configure_dma(struct pl022 *pl022)
 {
 	struct dma_slave_config rx_conf = {
 		.src_addr = SSP_DR(pl022->phybase),
-		.direction = DMA_FROM_DEVICE,
+		.direction = DEV_TO_MEM,
 	};
 	struct dma_slave_config tx_conf = {
 		.dst_addr = SSP_DR(pl022->phybase),
-		.direction = DMA_TO_DEVICE,
+		.direction = MEM_TO_DEV,
 	};
 	unsigned int pages;
 	int ret;
@@ -1051,7 +1051,7 @@ static int configure_dma(struct pl022 *pl022)
 	rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
 				      pl022->sgt_rx.sgl,
 				      rx_sglen,
-				      DMA_FROM_DEVICE,
+				      DEV_TO_MEM,
 				      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!rxdesc)
 		goto err_rxdesc;
@@ -1059,7 +1059,7 @@ static int configure_dma(struct pl022 *pl022)
 	txdesc = txchan->device->device_prep_slave_sg(txchan,
 				      pl022->sgt_tx.sgl,
 				      tx_sglen,
-				      DMA_TO_DEVICE,
+				      MEM_TO_DEV,
 				      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!txdesc)
 		goto err_txdesc;
drivers/spi/spi-topcliff-pch.c +2 -2
index 1d23f38..11232a0 100644
@@ -1051,7 +1051,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	}
 	sg = dma->sg_rx_p;
 	desc_rx = dma->chan_rx->device->device_prep_slave_sg(dma->chan_rx, sg,
-					num, DMA_FROM_DEVICE,
+					num, DEV_TO_MEM,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc_rx) {
 		dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n",
@@ -1086,7 +1086,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 	}
 	sg = dma->sg_tx_p;
 	desc_tx = dma->chan_tx->device->device_prep_slave_sg(dma->chan_tx,
-					sg, num, DMA_TO_DEVICE,
+					sg, num, MEM_TO_DEV,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc_tx) {
 		dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n",
drivers/tty/serial/amba-pl011.c +4 -4
index f5f6831..d5305af 100644
@@ -268,7 +268,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
 	struct dma_slave_config tx_conf = {
 		.dst_addr = uap->port.mapbase + UART01x_DR,
 		.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
-		.direction = DMA_TO_DEVICE,
+		.direction = MEM_TO_DEV,
 		.dst_maxburst = uap->fifosize >> 1,
 	};
 	struct dma_chan *chan;
@@ -301,7 +301,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
 		struct dma_slave_config rx_conf = {
 			.src_addr = uap->port.mapbase + UART01x_DR,
 			.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
-			.direction = DMA_FROM_DEVICE,
+			.direction = DEV_TO_MEM,
 			.src_maxburst = uap->fifosize >> 1,
 		};
 
@@ -480,7 +480,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
 		return -EBUSY;
 	}
 
-	desc = dma_dev->device_prep_slave_sg(chan, &dmatx->sg, 1, DMA_TO_DEVICE,
+	desc = dma_dev->device_prep_slave_sg(chan, &dmatx->sg, 1, MEM_TO_DEV,
 					     DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE);
@@ -676,7 +676,7 @@ static int pl011_dma_rx_trigger_dma(struct uart_amba_port *uap)
 		&uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a;
 	dma_dev = rxchan->device;
 	desc = rxchan->device->device_prep_slave_sg(rxchan, &sgbuf->sg, 1,
-					DMA_FROM_DEVICE,
+					DEV_TO_MEM,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	/*
 	 * If the DMA engine is busy and cannot prepare a
drivers/tty/serial/pch_uart.c +2 -2
index b46218d..162189e 100644
@@ -747,7 +747,7 @@ static int dma_handle_rx(struct eg20t_port *priv)
 	sg_dma_address(sg) = priv->rx_buf_dma;
 
 	desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx,
-			sg, 1, DMA_FROM_DEVICE,
+			sg, 1, DEV_TO_MEM,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
 	if (!desc)
@@ -906,7 +906,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
 	}
 
 	desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx,
-					priv->sg_tx_p, nent, DMA_TO_DEVICE,
+					priv->sg_tx_p, nent, MEM_TO_DEV,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n",
drivers/tty/serial/sh-sci.c +2 -2
index dbd32a1..e147e65 100644
@@ -1207,7 +1207,7 @@ static void sci_submit_rx(struct sci_port *s)
 		struct dma_async_tx_descriptor *desc;
 
 		desc = chan->device->device_prep_slave_sg(chan,
-			sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT);
+			sg, 1, DEV_TO_MEM, DMA_PREP_INTERRUPT);
 
 		if (desc) {
 			s->desc_rx[i] = desc;
@@ -1322,7 +1322,7 @@ static void work_fn_tx(struct work_struct *work)
 	BUG_ON(!sg_dma_len(sg));
 
 	desc = chan->device->device_prep_slave_sg(chan,
-			sg, s->sg_len_tx, DMA_TO_DEVICE,
+			sg, s->sg_len_tx, MEM_TO_DEV,
 			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		/* switch to PIO */
Signature · 1 line
1.7.0.4
author
#32 lore raw

PATCH 8/10 sound-soc: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 sound/atmel/abdac.c             |    2 +-
 sound/atmel/ac97c.c             |   10 +++++-----
 sound/soc/ep93xx/ep93xx-pcm.c   |    4 ++--
 sound/soc/imx/imx-pcm-dma-mx2.c |    6 +++---
 sound/soc/samsung/dma.c         |    4 ++--
 sound/soc/sh/siu_pcm.c          |    4 ++--
 sound/soc/txx9/txx9aclc.c       |    2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)
sound/atmel/abdac.c +1 -1
index 6fd9391..4c2d9ae 100644
@@ -133,7 +133,7 @@ static int atmel_abdac_prepare_dma(struct atmel_abdac *dac,
 	period_len = frames_to_bytes(runtime, runtime->period_size);
 
 	cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len,
-			period_len, DMA_TO_DEVICE);
+			period_len, MEM_TO_DEV);
 	if (IS_ERR(cdesc)) {
 		dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n");
 		return PTR_ERR(cdesc);
sound/atmel/ac97c.c +5 -5
index 6e5adde..d03663e 100644
@@ -102,7 +102,7 @@ static void atmel_ac97c_dma_capture_period_done(void *arg)
 
 static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
 		struct snd_pcm_substream *substream,
-		enum dma_data_direction direction)
+		enum dma_transfer_direction direction)
 {
 	struct dma_chan			*chan;
 	struct dw_cyclic_desc		*cdesc;
@@ -118,7 +118,7 @@ static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
 		return -EINVAL;
 	}
 
-	if (direction == DMA_TO_DEVICE)
+	if (direction == MEM_TO_DEV)
 		chan = chip->dma.tx_chan;
 	else
 		chan = chip->dma.rx_chan;
@@ -133,7 +133,7 @@ static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
 		return PTR_ERR(cdesc);
 	}
 
-	if (direction == DMA_TO_DEVICE) {
+	if (direction == MEM_TO_DEV) {
 		cdesc->period_callback = atmel_ac97c_dma_playback_period_done;
 		set_bit(DMA_TX_READY, &chip->flags);
 	} else {
@@ -393,7 +393,7 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream)
 	if (cpu_is_at32ap7000()) {
 		if (!test_bit(DMA_TX_READY, &chip->flags))
 			retval = atmel_ac97c_prepare_dma(chip, substream,
-					DMA_TO_DEVICE);
+					MEM_TO_DEV);
 	} else {
 		/* Initialize and start the PDC */
 		writel(runtime->dma_addr, chip->regs + ATMEL_PDC_TPR);
@@ -484,7 +484,7 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
 	if (cpu_is_at32ap7000()) {
 		if (!test_bit(DMA_RX_READY, &chip->flags))
 			retval = atmel_ac97c_prepare_dma(chip, substream,
-					DMA_FROM_DEVICE);
+					DEV_TO_MEM);
 	} else {
 		/* Initialize and start the PDC */
 		writel(runtime->dma_addr, chip->regs + ATMEL_PDC_RPR);
sound/soc/ep93xx/ep93xx-pcm.c +2 -2
index 8dfd3ad..0f9dd1f 100644
@@ -113,9 +113,9 @@ static int ep93xx_pcm_open(struct snd_pcm_substream *substream)
 	rtd->dma_data.name = dma_params->name;
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		rtd->dma_data.direction = DMA_TO_DEVICE;
+		rtd->dma_data.direction = MEM_TO_DEV;
 	else
-		rtd->dma_data.direction = DMA_FROM_DEVICE;
+		rtd->dma_data.direction = DEV_TO_MEM;
 
 	rtd->dma_chan = dma_request_channel(mask, ep93xx_pcm_dma_filter,
 					    &rtd->dma_data);
sound/soc/imx/imx-pcm-dma-mx2.c +3 -3
index 43fdc24..b5eeaa7 100644
@@ -107,12 +107,12 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
 	}
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		slave_config.direction = DMA_TO_DEVICE;
+		slave_config.direction = MEM_TO_DEV;
 		slave_config.dst_addr = dma_params->dma_addr;
 		slave_config.dst_addr_width = buswidth;
 		slave_config.dst_maxburst = dma_params->burstsize;
 	} else {
-		slave_config.direction = DMA_FROM_DEVICE;
+		slave_config.direction = DEV_TO_MEM;
 		slave_config.src_addr = dma_params->dma_addr;
 		slave_config.src_addr_width = buswidth;
 		slave_config.src_maxburst = dma_params->burstsize;
@@ -159,7 +159,7 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
 			iprtd->period_bytes * iprtd->periods,
 			iprtd->period_bytes,
 			substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
-			DMA_TO_DEVICE : DMA_FROM_DEVICE);
+			MEM_TO_DEV : DEV_TO_MEM);
 	if (!iprtd->desc) {
 		dev_err(&chan->dev->device, "cannot prepare slave dma\n");
 		return -EINVAL;
sound/soc/samsung/dma.c +2 -2
index 851346f..47a4093 100644
@@ -85,7 +85,7 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
 	dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
 	dma_info.direction =
 		(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
-		? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+		? MEM_TO_DEV : DEV_TO_MEM);
 	dma_info.fp = audio_buffdone;
 	dma_info.fp_param = substream;
 	dma_info.period = prtd->dma_period;
@@ -170,7 +170,7 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
 		dma_info.client = prtd->params->client;
 		dma_info.direction =
 			(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
-			? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+			? MEM_TO_DEV : DEV_TO_MEM);
 		dma_info.width = prtd->params->dma_size;
 		dma_info.fifo = prtd->params->dma_addr;
 		prtd->params->ch = prtd->params->ops->request(
sound/soc/sh/siu_pcm.c +2 -2
index f8f6816..0b9b323 100644
@@ -131,7 +131,7 @@ static int siu_pcm_wr_set(struct siu_port *port_info,
 	sg_dma_address(&sg) = buff;
 
 	desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
-		&sg, 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+		&sg, 1, MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dev_err(dev, "Failed to allocate a dma descriptor\n");
 		return -ENOMEM;
@@ -181,7 +181,7 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
 	sg_dma_address(&sg) = buff;
 
 	desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
-		&sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+		&sg, 1, DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dev_err(dev, "Failed to allocate dma descriptor\n");
 		return -ENOMEM;
sound/soc/txx9/txx9aclc.c +1 -1
index 3de99af..c3c890a 100644
@@ -134,7 +134,7 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)
 	sg_dma_address(&sg) = buf_dma_addr;
 	desc = chan->device->device_prep_slave_sg(chan, &sg, 1,
 		dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE,
+		MEM_TO_DEV : DEV_TO_MEM,
 		DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
 		dev_err(&chan->dev->device, "cannot prepare slave dma\n");
Signature · 1 line
1.7.0.4
author
#34 lore raw

PATCH 9/10 USB: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/usb/musb/ux500_dma.c     |    4 ++--
 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/usb/musb/ux500_dma.c +2 -2
index ef4333f..9587bdd 100644
@@ -112,7 +112,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
 	struct dma_chan *dma_chan = ux500_channel->dma_chan;
 	struct dma_async_tx_descriptor *dma_desc;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	struct scatterlist sg;
 	struct dma_slave_config slave_conf;
 	enum dma_slave_buswidth addr_width;
@@ -132,7 +132,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	sg_dma_address(&sg) = dma_addr;
 	sg_dma_len(&sg) = len;
 
-	direction = ux500_channel->is_tx ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	slave_dirn = ux500_channel->is_tx ? MEM_TO_DEV : DEV_TO_MEM;
 	addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
 					DMA_SLAVE_BUSWIDTH_4_BYTES;
 
drivers/usb/renesas_usbhs/fifo.c +2 -2
index a34430f..f5bc370 100644
@@ -591,10 +591,10 @@ static void usbhsf_dma_prepare_tasklet(unsigned long data)
 	struct dma_async_tx_descriptor *desc;
 	struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
 	struct device *dev = usbhs_priv_to_dev(priv);
-	enum dma_data_direction dir;
+	enum dma_transfer_direction dir;
 	dma_cookie_t cookie;
 
-	dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+	dir = usbhs_pipe_is_dir_in(pipe) ? DEV_TO_MEM : MEM_TO_DEV;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, virt_to_page(pkt->dma),
Signature · 1 line
1.7.0.4
#35 lore raw

Re: [PATCH 09/10] USB: move to dma_transfer_direction

Hi,

Quoted 1 line · Vinod Koul

From: Vinod Koul <[email protected]>

please add a description here.

Quoted 7 lines
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/usb/musb/ux500_dma.c     |    4 ++--
 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

can you split this patch into two parts ? One for musb and one renesas ?

Signature · 1 line
balbi
#36 lore raw

Re: [PATCH 09/10] USB: move to dma_transfer_direction

Quoted 15 lines · Felipe Balbi

Hi,

Quoted 1 line · Vinod Koul

From: Vinod Koul <[email protected]>

please add a description here.

Quoted 7 lines
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/usb/musb/ux500_dma.c     |    4 ++--
 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Quoted 1 line

can you split this patch into two parts ? One for musb and one renesas ?

Well it was easier to do small change per subsystem rather than per driver

Can split if you insist

Signature · 1 line
~Vinod
#37 lore raw

Re: [PATCH 09/10] USB: move to dma_transfer_direction

In reply to Vinod Koul
Quoted 20 lines · Vinod Koul
drivers/usb/musb/ux500_dma.c +2 -2
index ef4333f..9587bdd 100644
@@ -112,7 +112,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
        struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
        struct dma_chan *dma_chan = ux500_channel->dma_chan;
        struct dma_async_tx_descriptor *dma_desc;
-       enum dma_data_direction direction;
+       enum dma_transfer_direction direction;
        struct scatterlist sg;
        struct dma_slave_config slave_conf;
        enum dma_slave_buswidth addr_width;
@@ -132,7 +132,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
        sg_dma_address(&sg) = dma_addr;
        sg_dma_len(&sg) = len;
 
-       direction = ux500_channel->is_tx ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+       slave_dirn = ux500_channel->is_tx ? MEM_TO_DEV : DEV_TO_MEM;
Quoted 3 lines

       addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
                                       DMA_SLAVE_BUSWIDTH_4_BYTES;

s/slave_dirn/direction ?

#38 lore raw

Re: [PATCH 09/10] USB: move to dma_transfer_direction

Quoted 19 lines · Jassi Brar
Quoted 18 lines · Vinod Koul
drivers/usb/musb/ux500_dma.c +1 -1
index ef4333f..9587bdd 100644
@@ -112,7 +112,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
       struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
       struct dma_chan *dma_chan = ux500_channel->dma_chan;
       struct dma_async_tx_descriptor *dma_desc;
-       enum dma_data_direction direction;
+       enum dma_transfer_direction direction;
       struct scatterlist sg;
       struct dma_slave_config slave_conf;
       enum dma_slave_buswidth addr_width;
@@ -132,7 +132,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
       sg_dma_address(&sg) = dma_addr;
       sg_dma_len(&sg) = len;
 
Quoted 6 lines

drivers/usb/musb/ux500_dma.c static bool ux500_configure_channel(struct dma_channel *channel, · line 138

Quoted 5 lines
drivers/usb/musb/ux500_dma.c +1 -1
-       direction = ux500_channel->is_tx ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+       slave_dirn = ux500_channel->is_tx ? MEM_TO_DEV : DEV_TO_MEM;
       addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
                                       DMA_SLAVE_BUSWIDTH_4_BYTES;
 

s/slave_dirn/direction ?

Oops, some how much scripts seems to have failed to build usb, hence didnt find. Thanks for pointing out.

I will revise this and split into two as requested by Filipe

Signature · 1 line
~Vinod
author
#39 lore raw

PATCH 10/10 net-ks8842: move to dma_transfer_direction

In reply to Vinod Koul

From: Vinod Koul <[email protected]>

Cc David S. Miller <[email protected]>
Cc Samuel Ortiz <[email protected]>
---
 drivers/net/ks8842.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ks8842.c +2 -2
index 4a6ae05..7ca0640 100644
@@ -459,7 +459,7 @@ static int ks8842_tx_frame_dma(struct sk_buff *skb, struct net_device *netdev)
 		sg_dma_len(&ctl->sg) += 4 - sg_dma_len(&ctl->sg) % 4;
 
 	ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan,
-		&ctl->sg, 1, DMA_TO_DEVICE,
+		&ctl->sg, 1, MEM_TO_DEV,
 		DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
 	if (!ctl->adesc)
 		return NETDEV_TX_BUSY;
@@ -571,7 +571,7 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev)
 		sg_dma_len(sg) = DMA_BUFFER_SIZE;
 
 		ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan,
-			sg, 1, DMA_FROM_DEVICE,
+			sg, 1, DEV_TO_MEM,
 			DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
 
 		if (!ctl->adesc)
Signature · 1 line
1.7.0.4
#40 lore raw

PATCH v2 1/2 USB-musb: move to dma_transfer_direction

In reply to Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/musb driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---
v2: split the usb patch into two patches
fix the error of direction variable

 drivers/usb/musb/ux500_dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/ux500_dma.c +2 -2
index ef4333f..d5b5262 100644
@@ -112,7 +112,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
 	struct dma_chan *dma_chan = ux500_channel->dma_chan;
 	struct dma_async_tx_descriptor *dma_desc;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	struct scatterlist sg;
 	struct dma_slave_config slave_conf;
 	enum dma_slave_buswidth addr_width;
@@ -132,7 +132,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	sg_dma_address(&sg) = dma_addr;
 	sg_dma_len(&sg) = len;
 
-	direction = ux500_channel->is_tx ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	direction = ux500_channel->is_tx ? MEM_TO_DEV : DEV_TO_MEM;
 	addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
 					DMA_SLAVE_BUSWIDTH_4_BYTES;
 
Signature · 1 line
1.7.0.4
#42 lore raw

Re: [PATCH v2 1/2] USB-musb: move to dma_transfer_direction

Quoted 9 lines · Felipe Balbi
Quoted 6 lines · Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/musb driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

applied, thanks

I replied too early, this breaks compilation. Please review both patches, compile test them at least, and resend Ccing linux-usb and the maintainers of musb (myself) and Renesas... to make it easier, run scripts/get_maintainer.pl on both patches.

Signature · 1 line
balbi
#43 lore raw

Re: [PATCH v2 1/2] USB-musb: move to dma_transfer_direction

Quoted 9 lines · Felipe Balbi
Quoted 8 lines · Felipe Balbi
Quoted 6 lines · Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/musb driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 6 lines
Quoted 1 line

applied, thanks

I replied too early, this breaks compilation. Please review both patches, compile test them at least, and resend Ccing linux-usb and the maintainers of musb (myself) and Renesas... to make it easier, run scripts/get_maintainer.pl on both patches.

These cant be applied individually as they depends on 1/10 of v1 I had sent across, that explains your compilation failure.

If you are fine with this, please ACK it and I can carry these thru slave-dmaengine tree

Signature · 1 line
~Vinod
Acked-by on v2 1/2
#44 lore raw

Re: [PATCH v2 1/2] USB-musb: move to dma_transfer_direction

In reply to Vinod Koul
Quoted 6 lines · Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/musb driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

This looks ok to me:

Mian, if you agree with this patch, please reply with your Acked-by

Quoted 32 lines

---
v2: split the usb patch into two patches
fix the error of direction variable

 drivers/usb/musb/ux500_dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/ux500_dma.c +2 -2
index ef4333f..d5b5262 100644
@@ -112,7 +112,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
 	struct dma_chan *dma_chan = ux500_channel->dma_chan;
 	struct dma_async_tx_descriptor *dma_desc;
-	enum dma_data_direction direction;
+	enum dma_transfer_direction direction;
 	struct scatterlist sg;
 	struct dma_slave_config slave_conf;
 	enum dma_slave_buswidth addr_width;
@@ -132,7 +132,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
 	sg_dma_address(&sg) = dma_addr;
 	sg_dma_len(&sg) = len;
 
-	direction = ux500_channel->is_tx ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	direction = ux500_channel->is_tx ? MEM_TO_DEV : DEV_TO_MEM;
 	addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
 					DMA_SLAVE_BUSWIDTH_4_BYTES;
 
Signature · 1 line
1.7.0.4
Signature · 1 line
balbi
#45 lore raw

Re: [PATCH v2 1/2] USB-musb: move to dma_transfer_direction

Quoted 4 lines · Felipe Balbi
Quoted 3 lines · Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/musb driver to use new enum

Quoted 8 lines
Quoted 3 lines
Cc Felipe Balbi<[email protected]>
Cc Greg Kroah-Hartman<[email protected]>

This looks ok to me:

Mian, if you agree with this patch, please reply with your Acked-by

Looks ok to me as well:

Thanks,

Signature · 1 line
Mian Yousaf Kaukab
#46 lore raw

PATCH 2/2 USB-renesas: move to dma_transfer_direction

In reply to Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/renesas driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---
v2: split the usb patch into two patches

 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/fifo.c +2 -2
index a34430f..f5bc370 100644
@@ -591,10 +591,10 @@ static void usbhsf_dma_prepare_tasklet(unsigned long data)
 	struct dma_async_tx_descriptor *desc;
 	struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
 	struct device *dev = usbhs_priv_to_dev(priv);
-	enum dma_data_direction dir;
+	enum dma_transfer_direction dir;
 	dma_cookie_t cookie;
 
-	dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+	dir = usbhs_pipe_is_dir_in(pipe) ? DEV_TO_MEM : MEM_TO_DEV;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, virt_to_page(pkt->dma),
Signature · 1 line
1.7.0.4
Acked-by on v1 2/2
#48 lore raw

Re: [PATCH 2/2] USB-renesas: move to dma_transfer_direction

In reply to Vinod Koul

Hi,

Quoted 6 lines · Vinod Koul

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/renesas driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

This looks ok too:

Kuninori-san, please have a look and reply with your Acked-by if you think it's ok.

Quoted 26 lines

---
v2: split the usb patch into two patches

 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/fifo.c +2 -2
index a34430f..f5bc370 100644
@@ -591,10 +591,10 @@ static void usbhsf_dma_prepare_tasklet(unsigned long data)
 	struct dma_async_tx_descriptor *desc;
 	struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
 	struct device *dev = usbhs_priv_to_dev(priv);
-	enum dma_data_direction dir;
+	enum dma_transfer_direction dir;
 	dma_cookie_t cookie;
 
-	dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+	dir = usbhs_pipe_is_dir_in(pipe) ? DEV_TO_MEM : MEM_TO_DEV;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, virt_to_page(pkt->dma),
Signature · 1 line
1.7.0.4
Signature · 1 line
balbi
#49 lore raw

Re: [PATCH 2/2] USB-renesas: move to dma_transfer_direction

Hi

Quoted 8 lines · Vinod Koul
Quoted 6 lines

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/renesas driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 6 lines

This looks ok too:

Kuninori-san, please have a look and reply with your Acked-by if you think it's ok.

Quoted 18 lines
Quoted 18 lines

---
v2: split the usb patch into two patches

 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/fifo.c +1 -1
index a34430f..f5bc370 100644
@@ -591,10 +591,10 @@ static void usbhsf_dma_prepare_tasklet(unsigned long data)
 	struct dma_async_tx_descriptor *desc;
 	struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
 	struct device *dev = usbhs_priv_to_dev(priv);
-	enum dma_data_direction dir;
+	enum dma_transfer_direction dir;
 	dma_cookie_t cookie;
 
Quoted 11 lines
Quoted 8 lines
drivers/usb/renesas_usbhs/fifo.c +1 -1
-	dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+	dir = usbhs_pipe_is_dir_in(pipe) ? DEV_TO_MEM : MEM_TO_DEV;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, virt_to_page(pkt->dma),
Signature · 1 line
1.7.0.4
Signature · 1 line
balbi

Best regards
--
Kuninori Morimoto

#50 lore raw

Re: [PATCH 2/2] USB-renesas: move to dma_transfer_direction

In reply to Felipe Balbi

Hi

Quoted 8 lines · Vinod Koul
Quoted 6 lines

fixup usage of dma direction by introducing dma_transfer_direction, this patch moves usb/renesas driver to use new enum

Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 6 lines

This looks ok too:

Kuninori-san, please have a look and reply with your Acked-by if you think it's ok.

Quoted 18 lines
Quoted 18 lines

---
v2: split the usb patch into two patches

 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/fifo.c +1 -1
index a34430f..f5bc370 100644
@@ -591,10 +591,10 @@ static void usbhsf_dma_prepare_tasklet(unsigned long data)
 	struct dma_async_tx_descriptor *desc;
 	struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
 	struct device *dev = usbhs_priv_to_dev(priv);
-	enum dma_data_direction dir;
+	enum dma_transfer_direction dir;
 	dma_cookie_t cookie;
 
Quoted 11 lines
Quoted 8 lines
drivers/usb/renesas_usbhs/fifo.c +1 -1
-	dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+	dir = usbhs_pipe_is_dir_in(pipe) ? DEV_TO_MEM : MEM_TO_DEV;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, virt_to_page(pkt->dma),
Signature · 1 line
1.7.0.4
Signature · 1 line
balbi

Best regards
--
Kuninori Morimoto

#51 lore raw
In reply to Vinod Koul
Quoted 7 lines · Vinod Koul

From: Vinod Koul <[email protected]>

As discussed recently on new interleaved dma patchset, the direction in dmaengine needs improvement and as suggested by Jassi, this patchset move dmaengine and dmacs, clients to use new enum dma_transfer_direction to indicate the dma direction and mode

Quoted 12 lines

Vinod Koul (10):
dmaengine: add new enum dma_transfer_direction
dmaengine: move drivers to dma_transfer_direction
plat-samsung: move to dma_transfer_direction
media-video: move to dma_transfer_direction
carma: move to dma_transfer_direction
mmc-host: move to dma_transfer_direction spi, serial: move to dma_transfer_direction
sound-soc: move to dma_transfer_direction
USB: move to dma_transfer_direction
net-ks8842: move to dma_transfer_direction

the version 2 of this patchset is available now
in the git repository at:

git://git.infradead.org/users/vkoul/slave-dma.git dma_slave_direction

The change being the addition of DMA_xxx to the dma_slave_direction values as suggesting during last review. I have also added the acks received from various folks.

Please note I plan to merge this tomorrow which would be followed by merge of the 2d-xfer patches. If you have any objection on either series please let me know.

Vinod Koul (11):
dmaengine: add new enum dma_transfer_direction
dmaengine: move drivers to dma_transfer_direction
plat-samsung: move to dma_transfer_direction media, video: move to dma_transfer_direction
carma: move to dma_transfer_direction
mmc-host: move to dma_transfer_direction spi, serial: move to dma_transfer_direction
sound-soc: move to dma_transfer_direction
net-ks8842: move to dma_transfer_direction
USB-musb: move to dma_transfer_direction
USB-renesas: move to dma_transfer_direction

 arch/arm/mach-ep93xx/include/mach/dma.h        |    6 ++--
 arch/arm/plat-nomadik/include/plat/ste_dma40.h |    4 +-
 arch/arm/plat-samsung/dma-ops.c                |    4 +-
 arch/arm/plat-samsung/include/plat/dma-ops.h   |    4 +-
 drivers/dma/amba-pl08x.c                       |   24 +++++++++++-----------
 drivers/dma/at_hdmac.c                         |   22 ++++++++++----------
 drivers/dma/coh901318.c                        |   12 +++++-----
 drivers/dma/coh901318_lli.c                    |   23 ++++++++++-----------
 drivers/dma/coh901318_lli.h                    |    4 +-
 drivers/dma/dw_dmac.c                          |   14 ++++++------
 drivers/dma/ep93xx_dma.c                       |   22 ++++++++++----------
 drivers/dma/fsldma.c                           |    4 +-
 drivers/dma/imx-dma.c                          |   10 ++++----
 drivers/dma/imx-sdma.c                         |   10 ++++----
 drivers/dma/intel_mid_dma.c                    |   14 ++++++------
 drivers/dma/intel_mid_dma_regs.h               |    2 +-
 drivers/dma/ipu/ipu_idmac.c                    |    4 +-
 drivers/dma/mxs-dma.c                          |    8 +++---
 drivers/dma/pch_dma.c                          |   12 +++++-----
 drivers/dma/pl330.c                            |   18 ++++++++--------
 drivers/dma/shdma.c                            |   25 +++++++++++------------
 drivers/dma/ste_dma40.c                        |   26 ++++++++++++------------
 drivers/dma/timb_dma.c                         |   18 ++++++++--------
 drivers/dma/txx9dmac.c                         |   12 +++++-----
 drivers/media/video/mx3_camera.c               |    2 +-
 drivers/media/video/timblogiw.c                |    2 +-
 drivers/misc/carma/carma-fpga-program.c        |    2 +-
 drivers/mmc/host/atmel-mci.c                   |   10 ++++++--
 drivers/mmc/host/mmci.c                        |   11 ++++++---
 drivers/mmc/host/mxcmmc.c                      |   10 ++++++--
 drivers/mmc/host/mxs-mmc.c                     |    7 +++++-
 drivers/mmc/host/sh_mmcif.c                    |    4 +-
 drivers/mmc/host/tmio_mmc_dma.c                |    4 +-
 drivers/net/ks8842.c                           |    4 +-
 drivers/spi/spi-dw-mid.c                       |    8 +++---
 drivers/spi/spi-ep93xx.c                       |    9 +++++--
 drivers/spi/spi-pl022.c                        |    8 +++---
 drivers/spi/spi-topcliff-pch.c                 |    4 +-
 drivers/tty/serial/amba-pl011.c                |    8 +++---
 drivers/tty/serial/pch_uart.c                  |    4 +-
 drivers/tty/serial/sh-sci.c                    |    4 +-
 drivers/usb/musb/ux500_dma.c                   |    4 +-
 drivers/usb/renesas_usbhs/fifo.c               |    4 +-
 drivers/video/mx3fb.c                          |    4 +-
 include/linux/amba/pl08x.h                     |    4 +-
 include/linux/dmaengine.h                      |   22 +++++++++++++++----
 include/linux/dw_dmac.h                        |    2 +-
 include/linux/sh_dma.h                         |    2 +-
 sound/atmel/abdac.c                            |    2 +-
 sound/atmel/ac97c.c                            |   10 ++++----
 sound/soc/ep93xx/ep93xx-pcm.c                  |    4 +-
 sound/soc/imx/imx-pcm-dma-mx2.c                |    6 ++--
 sound/soc/samsung/dma.c                        |    4 +-
 sound/soc/sh/siu_pcm.c                         |    4 +-
 sound/soc/txx9/txx9aclc.c                      |    2 +-
 55 files changed, 253 insertions(+), 224 deletions(-)
Signature · 1 line
~Vinod