Skip to content

Commit 49c0369

Browse files
Vinod KoulRohan Somvanshi
authored andcommitted
dmaengine: add new enum dma_transfer_direction
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 Suggested-by: Jassi Brar <[email protected]> Reviewed-by: Barry Song <[email protected]> Signed-off-by: Vinod Koul <[email protected]> Cherry-picked from mainline 49920bc Change-Id: Ia554f0635e46d98aac4899d369533b8b4f7dd294 Signed-off-by: Laxman Dewangan <[email protected]> Reviewed-on: http://git-master/r/94462 Reviewed-by: Automatic_Commit_Validation_User
1 parent 2ed508c commit 49c0369

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

include/linux/dmaengine.h

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
#include <linux/device.h>
2525
#include <linux/uio.h>
26-
#include <linux/dma-direction.h>
27-
28-
struct scatterlist;
26+
#include <linux/scatterlist.h>
2927

3028
/**
3129
* typedef dma_cookie_t - an opaque DMA cookie
@@ -76,6 +74,19 @@ enum dma_transaction_type {
7674
/* last transaction type for creation of the capabilities mask */
7775
#define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
7876

77+
/**
78+
* enum dma_transfer_direction - dma transfer mode and direction indicator
79+
* @DMA_MEM_TO_MEM: Async/Memcpy mode
80+
* @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
81+
* @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
82+
* @DMA_DEV_TO_DEV: Slave mode & From Device to Device
83+
*/
84+
enum dma_transfer_direction {
85+
DMA_MEM_TO_MEM,
86+
DMA_MEM_TO_DEV,
87+
DMA_DEV_TO_MEM,
88+
DMA_DEV_TO_DEV,
89+
};
7990

8091
/**
8192
* enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -270,7 +281,7 @@ enum dma_slave_buswidth {
270281
* struct, if applicable.
271282
*/
272283
struct dma_slave_config {
273-
enum dma_data_direction direction;
284+
enum dma_transfer_direction direction;
274285
dma_addr_t src_addr;
275286
dma_addr_t dst_addr;
276287
enum dma_slave_buswidth src_addr_width;
@@ -493,11 +504,11 @@ struct dma_device {
493504

494505
struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
495506
struct dma_chan *chan, struct scatterlist *sgl,
496-
unsigned int sg_len, enum dma_data_direction direction,
507+
unsigned int sg_len, enum dma_transfer_direction direction,
497508
unsigned long flags);
498509
struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
499510
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
500-
size_t period_len, enum dma_data_direction direction);
511+
size_t period_len, enum dma_transfer_direction direction);
501512
int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
502513
unsigned long arg);
503514

@@ -521,6 +532,16 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
521532
(unsigned long)config);
522533
}
523534

535+
static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
536+
struct dma_chan *chan, void *buf, size_t len,
537+
enum dma_transfer_direction dir, unsigned long flags)
538+
{
539+
struct scatterlist sg;
540+
sg_init_one(&sg, buf, len);
541+
542+
return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags);
543+
}
544+
524545
static inline int dmaengine_terminate_all(struct dma_chan *chan)
525546
{
526547
return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);

0 commit comments

Comments
 (0)