Merge branch 'dma_slave_direction' into next_test_dirn

resolved conflicts:
	drivers/media/video/mx3_camera.c
This commit is contained in:
Vinod Koul 2011-11-17 14:54:38 +05:30
commit e0d23ef29e
55 changed files with 253 additions and 224 deletions

View File

@ -37,7 +37,7 @@
*/ */
struct ep93xx_dma_data { struct ep93xx_dma_data {
int port; int port;
enum dma_data_direction direction; enum dma_transfer_direction direction;
const char *name; 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 * channel supports given DMA direction. Only M2P channels have such
* limitation, for M2M channels the direction is configurable. * 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) ep93xx_dma_chan_direction(struct dma_chan *chan)
{ {
if (!ep93xx_dma_chan_is_m2p(chan)) if (!ep93xx_dma_chan_is_m2p(chan))
return DMA_NONE; return DMA_NONE;
/* even channels are for TX, odd for RX */ /* 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) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
} }
#endif /* __ASM_ARCH_DMA_H */ #endif /* __ASM_ARCH_DMA_H */

View File

@ -187,7 +187,7 @@ static inline struct
dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan, dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
dma_addr_t addr, dma_addr_t addr,
unsigned int size, unsigned int size,
enum dma_data_direction direction, enum dma_transfer_direction direction,
unsigned long flags) unsigned long flags)
{ {
struct scatterlist sg; struct scatterlist sg;
@ -209,7 +209,7 @@ static inline struct
dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan, dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
dma_addr_t addr, dma_addr_t addr,
unsigned int size, unsigned int size,
enum dma_data_direction direction, enum dma_transfer_direction direction,
unsigned long flags) unsigned long flags)
{ {
return NULL; return NULL;

View File

@ -36,14 +36,14 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
chan = dma_request_channel(mask, pl330_filter, (void *)dma_ch); chan = dma_request_channel(mask, pl330_filter, (void *)dma_ch);
if (info->direction == DMA_FROM_DEVICE) { if (info->direction == DMA_DEV_TO_MEM) {
memset(&slave_config, 0, sizeof(struct dma_slave_config)); memset(&slave_config, 0, sizeof(struct dma_slave_config));
slave_config.direction = info->direction; slave_config.direction = info->direction;
slave_config.src_addr = info->fifo; slave_config.src_addr = info->fifo;
slave_config.src_addr_width = info->width; slave_config.src_addr_width = info->width;
slave_config.src_maxburst = 1; slave_config.src_maxburst = 1;
dmaengine_slave_config(chan, &slave_config); dmaengine_slave_config(chan, &slave_config);
} else if (info->direction == DMA_TO_DEVICE) { } else if (info->direction == DMA_MEM_TO_DEV) {
memset(&slave_config, 0, sizeof(struct dma_slave_config)); memset(&slave_config, 0, sizeof(struct dma_slave_config));
slave_config.direction = info->direction; slave_config.direction = info->direction;
slave_config.dst_addr = info->fifo; slave_config.dst_addr = info->fifo;

View File

@ -17,7 +17,7 @@
struct samsung_dma_prep_info { struct samsung_dma_prep_info {
enum dma_transaction_type cap; enum dma_transaction_type cap;
enum dma_data_direction direction; enum dma_transfer_direction direction;
dma_addr_t buf; dma_addr_t buf;
unsigned long period; unsigned long period;
unsigned long len; unsigned long len;
@ -27,7 +27,7 @@ struct samsung_dma_prep_info {
struct samsung_dma_info { struct samsung_dma_info {
enum dma_transaction_type cap; enum dma_transaction_type cap;
enum dma_data_direction direction; enum dma_transfer_direction direction;
enum dma_slave_buswidth width; enum dma_slave_buswidth width;
dma_addr_t fifo; dma_addr_t fifo;
struct s3c2410_dma_client *client; struct s3c2410_dma_client *client;

View File

@ -882,9 +882,9 @@ static int prep_phy_channel(struct pl08x_dma_chan *plchan,
ch->signal = ret; ch->signal = ret;
/* Assign the flow control signal to this channel */ /* Assign the flow control signal to this channel */
if (txd->direction == DMA_TO_DEVICE) if (txd->direction == DMA_MEM_TO_DEV)
txd->ccfg |= ch->signal << PL080_CONFIG_DST_SEL_SHIFT; txd->ccfg |= ch->signal << PL080_CONFIG_DST_SEL_SHIFT;
else if (txd->direction == DMA_FROM_DEVICE) else if (txd->direction == DMA_DEV_TO_MEM)
txd->ccfg |= ch->signal << PL080_CONFIG_SRC_SEL_SHIFT; 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 */ /* Transfer direction */
plchan->runtime_direction = config->direction; plchan->runtime_direction = config->direction;
if (config->direction == DMA_TO_DEVICE) { if (config->direction == DMA_MEM_TO_DEV) {
addr_width = config->dst_addr_width; addr_width = config->dst_addr_width;
maxburst = config->dst_maxburst; maxburst = config->dst_maxburst;
} else if (config->direction == DMA_FROM_DEVICE) { } else if (config->direction == DMA_DEV_TO_MEM) {
addr_width = config->src_addr_width; addr_width = config->src_addr_width;
maxburst = config->src_maxburst; maxburst = config->src_maxburst;
} else { } 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_SB_SIZE_SHIFT;
cctl |= burst << PL080_CONTROL_DB_SIZE_SHIFT; cctl |= burst << PL080_CONTROL_DB_SIZE_SHIFT;
if (plchan->runtime_direction == DMA_FROM_DEVICE) { if (plchan->runtime_direction == DMA_DEV_TO_MEM) {
plchan->src_addr = config->src_addr; plchan->src_addr = config->src_addr;
plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR | plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR |
pl08x_select_bus(plchan->cd->periph_buses, 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, " "configured channel %s (%s) for %s, data width %d, "
"maxburst %d words, LE, CCTL=0x%08x\n", "maxburst %d words, LE, CCTL=0x%08x\n",
dma_chan_name(chan), plchan->name, dma_chan_name(chan), plchan->name,
(config->direction == DMA_FROM_DEVICE) ? "RX" : "TX", (config->direction == DMA_DEV_TO_MEM) ? "RX" : "TX",
addr_width, addr_width,
maxburst, maxburst,
cctl); 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( static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); 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; txd->direction = direction;
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
txd->cctl = plchan->dst_cctl; txd->cctl = plchan->dst_cctl;
slave_addr = plchan->dst_addr; slave_addr = plchan->dst_addr;
} else if (direction == DMA_FROM_DEVICE) { } else if (direction == DMA_DEV_TO_MEM) {
txd->cctl = plchan->src_cctl; txd->cctl = plchan->src_cctl;
slave_addr = plchan->src_addr; slave_addr = plchan->src_addr;
} else { } else {
@ -1368,10 +1368,10 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
} }
if (plchan->cd->device_fc) if (plchan->cd->device_fc)
tmp = (direction == DMA_TO_DEVICE) ? PL080_FLOW_MEM2PER_PER : tmp = (direction == DMA_MEM_TO_DEV) ? PL080_FLOW_MEM2PER_PER :
PL080_FLOW_PER2MEM_PER; PL080_FLOW_PER2MEM_PER;
else else
tmp = (direction == DMA_TO_DEVICE) ? PL080_FLOW_MEM2PER : tmp = (direction == DMA_MEM_TO_DEV) ? PL080_FLOW_MEM2PER :
PL080_FLOW_PER2MEM; PL080_FLOW_PER2MEM;
txd->ccfg |= tmp << PL080_CONFIG_FLOW_CONTROL_SHIFT; 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); list_add_tail(&dsg->node, &txd->dsg_list);
dsg->len = sg_dma_len(sg); dsg->len = sg_dma_len(sg);
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
dsg->src_addr = sg_phys(sg); dsg->src_addr = sg_phys(sg);
dsg->dst_addr = slave_addr; dsg->dst_addr = slave_addr;
} else { } else {

View File

@ -662,7 +662,7 @@ err_desc_get:
*/ */
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct at_dma_chan *atchan = to_at_dma_chan(chan); struct at_dma_chan *atchan = to_at_dma_chan(chan);
@ -680,7 +680,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
dev_vdbg(chan2dev(chan), "prep_slave_sg (%d): %s f0x%lx\n", dev_vdbg(chan2dev(chan), "prep_slave_sg (%d): %s f0x%lx\n",
sg_len, sg_len,
direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE", direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
flags); flags);
if (unlikely(!atslave || !sg_len)) { if (unlikely(!atslave || !sg_len)) {
@ -694,7 +694,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
ctrlb = ATC_IEN; ctrlb = ATC_IEN;
switch (direction) { switch (direction) {
case DMA_TO_DEVICE: case DMA_MEM_TO_DEV:
ctrla |= ATC_DST_WIDTH(reg_width); ctrla |= ATC_DST_WIDTH(reg_width);
ctrlb |= ATC_DST_ADDR_MODE_FIXED ctrlb |= ATC_DST_ADDR_MODE_FIXED
| ATC_SRC_ADDR_MODE_INCR | ATC_SRC_ADDR_MODE_INCR
@ -727,7 +727,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
total_len += len; total_len += len;
} }
break; break;
case DMA_FROM_DEVICE: case DMA_DEV_TO_MEM:
ctrla |= ATC_SRC_WIDTH(reg_width); ctrla |= ATC_SRC_WIDTH(reg_width);
ctrlb |= ATC_DST_ADDR_MODE_INCR ctrlb |= ATC_DST_ADDR_MODE_INCR
| ATC_SRC_ADDR_MODE_FIXED | ATC_SRC_ADDR_MODE_FIXED
@ -789,7 +789,7 @@ err_desc_get:
*/ */
static int static int
atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr, 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)) if (period_len > (ATC_BTSIZE_MAX << reg_width))
goto err_out; goto err_out;
@ -797,7 +797,7 @@ atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
goto err_out; goto err_out;
if (unlikely(buf_addr & ((1 << reg_width) - 1))) if (unlikely(buf_addr & ((1 << reg_width) - 1)))
goto err_out; goto err_out;
if (unlikely(!(direction & (DMA_TO_DEVICE | DMA_FROM_DEVICE)))) if (unlikely(!(direction & (DMA_DEV_TO_MEM | DMA_MEM_TO_DEV))))
goto err_out; goto err_out;
return 0; return 0;
@ -812,7 +812,7 @@ err_out:
static int static int
atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc, atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
unsigned int period_index, dma_addr_t buf_addr, 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; u32 ctrla;
unsigned int reg_width = atslave->reg_width; unsigned int reg_width = atslave->reg_width;
@ -824,7 +824,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
| period_len >> reg_width; | period_len >> reg_width;
switch (direction) { switch (direction) {
case DMA_TO_DEVICE: case DMA_MEM_TO_DEV:
desc->lli.saddr = buf_addr + (period_len * period_index); desc->lli.saddr = buf_addr + (period_len * period_index);
desc->lli.daddr = atslave->tx_reg; desc->lli.daddr = atslave->tx_reg;
desc->lli.ctrla = ctrla; desc->lli.ctrla = ctrla;
@ -835,7 +835,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
| ATC_DIF(AT_DMA_PER_IF); | ATC_DIF(AT_DMA_PER_IF);
break; break;
case DMA_FROM_DEVICE: case DMA_DEV_TO_MEM:
desc->lli.saddr = atslave->rx_reg; desc->lli.saddr = atslave->rx_reg;
desc->lli.daddr = buf_addr + (period_len * period_index); desc->lli.daddr = buf_addr + (period_len * period_index);
desc->lli.ctrla = ctrla; desc->lli.ctrla = ctrla;
@ -863,7 +863,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
*/ */
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 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_chan *atchan = to_at_dma_chan(chan);
struct at_dma_slave *atslave = chan->private; struct at_dma_slave *atslave = chan->private;
@ -874,7 +874,7 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
unsigned int i; unsigned int i;
dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@0x%08x - %d (%d/%d)\n", dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@0x%08x - %d (%d/%d)\n",
direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE", direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
buf_addr, buf_addr,
periods, buf_len, period_len); periods, buf_len, period_len);

View File

@ -39,7 +39,7 @@ struct coh901318_desc {
struct scatterlist *sg; struct scatterlist *sg;
unsigned int sg_len; unsigned int sg_len;
struct coh901318_lli *lli; struct coh901318_lli *lli;
enum dma_data_direction dir; enum dma_transfer_direction dir;
unsigned long flags; unsigned long flags;
u32 head_config; u32 head_config;
u32 head_ctrl; 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 * static struct dma_async_tx_descriptor *
coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct coh901318_chan *cohc = to_coh901318_chan(chan); 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_last |= cohc->runtime_ctrl;
ctrl |= cohc->runtime_ctrl; ctrl |= cohc->runtime_ctrl;
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE | u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE |
COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE; 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_chained |= tx_flags;
ctrl_last |= tx_flags; ctrl_last |= tx_flags;
ctrl |= tx_flags; ctrl |= tx_flags;
} else if (direction == DMA_FROM_DEVICE) { } else if (direction == DMA_DEV_TO_MEM) {
u32 rx_flags = COH901318_CX_CTRL_PRDD_DEST | u32 rx_flags = COH901318_CX_CTRL_PRDD_DEST |
COH901318_CX_CTRL_DST_ADDR_INC_ENABLE; COH901318_CX_CTRL_DST_ADDR_INC_ENABLE;
@ -1274,11 +1274,11 @@ static void coh901318_dma_set_runtimeconfig(struct dma_chan *chan,
int i = 0; int i = 0;
/* We only support mem to per or per to mem transfers */ /* We only support mem to per or per to mem transfers */
if (config->direction == DMA_FROM_DEVICE) { if (config->direction == DMA_DEV_TO_MEM) {
addr = config->src_addr; addr = config->src_addr;
addr_width = config->src_addr_width; addr_width = config->src_addr_width;
maxburst = config->src_maxburst; maxburst = config->src_maxburst;
} else if (config->direction == DMA_TO_DEVICE) { } else if (config->direction == DMA_MEM_TO_DEV) {
addr = config->dst_addr; addr = config->dst_addr;
addr_width = config->dst_addr_width; addr_width = config->dst_addr_width;
maxburst = config->dst_maxburst; maxburst = config->dst_maxburst;

View File

@ -7,11 +7,10 @@
* Author: Per Friden <per.friden@stericsson.com> * Author: Per Friden <per.friden@stericsson.com>
*/ */
#include <linux/dma-mapping.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/dmapool.h>
#include <linux/memory.h> #include <linux/memory.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/dmapool.h>
#include <mach/coh901318.h> #include <mach/coh901318.h>
#include "coh901318_lli.h" #include "coh901318_lli.h"
@ -177,18 +176,18 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
struct coh901318_lli *lli, struct coh901318_lli *lli,
dma_addr_t buf, unsigned int size, dma_addr_t buf, unsigned int size,
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_eom, dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_eom,
enum dma_data_direction dir) enum dma_transfer_direction dir)
{ {
int s = size; int s = size;
dma_addr_t src; dma_addr_t src;
dma_addr_t dst; dma_addr_t dst;
if (dir == DMA_TO_DEVICE) { if (dir == DMA_MEM_TO_DEV) {
src = buf; src = buf;
dst = dev_addr; dst = dev_addr;
} else if (dir == DMA_FROM_DEVICE) { } else if (dir == DMA_DEV_TO_MEM) {
src = dev_addr; src = dev_addr;
dst = buf; dst = buf;
@ -215,9 +214,9 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
lli = coh901318_lli_next(lli); lli = coh901318_lli_next(lli);
if (dir == DMA_TO_DEVICE) if (dir == DMA_MEM_TO_DEV)
src += block_size; src += block_size;
else if (dir == DMA_FROM_DEVICE) else if (dir == DMA_DEV_TO_MEM)
dst += block_size; dst += block_size;
} }
@ -234,7 +233,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
struct scatterlist *sgl, unsigned int nents, struct scatterlist *sgl, unsigned int nents,
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl, dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl,
u32 ctrl_last, u32 ctrl_last,
enum dma_data_direction dir, u32 ctrl_irq_mask) enum dma_transfer_direction dir, u32 ctrl_irq_mask)
{ {
int i; int i;
struct scatterlist *sg; struct scatterlist *sg;
@ -249,9 +248,9 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
spin_lock(&pool->lock); spin_lock(&pool->lock);
if (dir == DMA_TO_DEVICE) if (dir == DMA_MEM_TO_DEV)
dst = dev_addr; dst = dev_addr;
else if (dir == DMA_FROM_DEVICE) else if (dir == DMA_DEV_TO_MEM)
src = dev_addr; src = dev_addr;
else else
goto err; goto err;
@ -269,7 +268,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
ctrl_sg = ctrl ? ctrl : ctrl_last; ctrl_sg = ctrl ? ctrl : ctrl_last;
if (dir == DMA_TO_DEVICE) if (dir == DMA_MEM_TO_DEV)
/* increment source address */ /* increment source address */
src = sg_phys(sg); src = sg_phys(sg);
else else
@ -293,7 +292,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
lli->src_addr = src; lli->src_addr = src;
lli->dst_addr = dst; lli->dst_addr = dst;
if (dir == DMA_FROM_DEVICE) if (dir == DMA_DEV_TO_MEM)
dst += elem_size; dst += elem_size;
else else
src += elem_size; src += elem_size;

View File

@ -97,7 +97,7 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
struct coh901318_lli *lli, struct coh901318_lli *lli,
dma_addr_t buf, unsigned int size, dma_addr_t buf, unsigned int size,
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_last, 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 * 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, struct scatterlist *sg, unsigned int nents,
dma_addr_t dev_addr, u32 ctrl_chained, dma_addr_t dev_addr, u32 ctrl_chained,
u32 ctrl, u32 ctrl_last, 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 */ #endif /* COH901318_LLI_H */

View File

@ -696,7 +696,7 @@ err_desc_get:
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 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; prev = first = NULL;
switch (direction) { switch (direction) {
case DMA_TO_DEVICE: case DMA_MEM_TO_DEV:
ctllo = (DWC_DEFAULT_CTLLO(chan->private) ctllo = (DWC_DEFAULT_CTLLO(chan->private)
| DWC_CTLL_DST_WIDTH(reg_width) | DWC_CTLL_DST_WIDTH(reg_width)
| DWC_CTLL_DST_FIX | DWC_CTLL_DST_FIX
@ -777,7 +777,7 @@ slave_sg_todev_fill_desc:
goto slave_sg_todev_fill_desc; goto slave_sg_todev_fill_desc;
} }
break; break;
case DMA_FROM_DEVICE: case DMA_DEV_TO_MEM:
ctllo = (DWC_DEFAULT_CTLLO(chan->private) ctllo = (DWC_DEFAULT_CTLLO(chan->private)
| DWC_CTLL_SRC_WIDTH(reg_width) | DWC_CTLL_SRC_WIDTH(reg_width)
| DWC_CTLL_DST_INC | 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, 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, 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_dma_chan *dwc = to_dw_dma_chan(chan);
struct dw_cyclic_desc *cdesc; struct dw_cyclic_desc *cdesc;
@ -1206,7 +1206,7 @@ struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
goto out_err; goto out_err;
if (unlikely(buf_addr & ((1 << reg_width) - 1))) if (unlikely(buf_addr & ((1 << reg_width) - 1)))
goto out_err; goto out_err;
if (unlikely(!(direction & (DMA_TO_DEVICE | DMA_FROM_DEVICE)))) if (unlikely(!(direction & (DMA_MEM_TO_DEV | DMA_DEV_TO_MEM))))
goto out_err; goto out_err;
retval = ERR_PTR(-ENOMEM); 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; goto out_err_desc_get;
switch (direction) { switch (direction) {
case DMA_TO_DEVICE: case DMA_MEM_TO_DEV:
desc->lli.dar = dws->tx_reg; desc->lli.dar = dws->tx_reg;
desc->lli.sar = buf_addr + (period_len * i); desc->lli.sar = buf_addr + (period_len * i);
desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan->private) 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_FC(dws->fc)
| DWC_CTLL_INT_EN); | DWC_CTLL_INT_EN);
break; break;
case DMA_FROM_DEVICE: case DMA_DEV_TO_MEM:
desc->lli.dar = buf_addr + (period_len * i); desc->lli.dar = buf_addr + (period_len * i);
desc->lli.sar = dws->rx_reg; desc->lli.sar = dws->rx_reg;
desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan->private) desc->lli.ctllo = (DWC_DEFAULT_CTLLO(chan->private)

View File

@ -330,7 +330,7 @@ static void m2p_fill_desc(struct ep93xx_dma_chan *edmac)
struct ep93xx_dma_desc *desc = ep93xx_dma_get_active(edmac); struct ep93xx_dma_desc *desc = ep93xx_dma_get_active(edmac);
u32 bus_addr; u32 bus_addr;
if (ep93xx_dma_chan_direction(&edmac->chan) == DMA_TO_DEVICE) if (ep93xx_dma_chan_direction(&edmac->chan) == DMA_MEM_TO_DEV)
bus_addr = desc->src_addr; bus_addr = desc->src_addr;
else else
bus_addr = desc->dst_addr; bus_addr = desc->dst_addr;
@ -443,7 +443,7 @@ static int m2m_hw_setup(struct ep93xx_dma_chan *edmac)
control = (5 << M2M_CONTROL_PWSC_SHIFT); control = (5 << M2M_CONTROL_PWSC_SHIFT);
control |= M2M_CONTROL_NO_HDSK; control |= M2M_CONTROL_NO_HDSK;
if (data->direction == DMA_TO_DEVICE) { if (data->direction == DMA_MEM_TO_DEV) {
control |= M2M_CONTROL_DAH; control |= M2M_CONTROL_DAH;
control |= M2M_CONTROL_TM_TX; control |= M2M_CONTROL_TM_TX;
control |= M2M_CONTROL_RSS_SSPTX; control |= M2M_CONTROL_RSS_SSPTX;
@ -463,7 +463,7 @@ static int m2m_hw_setup(struct ep93xx_dma_chan *edmac)
control |= M2M_CONTROL_RSS_IDE; control |= M2M_CONTROL_RSS_IDE;
control |= M2M_CONTROL_PW_16; control |= M2M_CONTROL_PW_16;
if (data->direction == DMA_TO_DEVICE) { if (data->direction == DMA_MEM_TO_DEV) {
/* Worst case from the UG */ /* Worst case from the UG */
control = (3 << M2M_CONTROL_PWSC_SHIFT); control = (3 << M2M_CONTROL_PWSC_SHIFT);
control |= M2M_CONTROL_DAH; control |= M2M_CONTROL_DAH;
@ -803,8 +803,8 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
switch (data->port) { switch (data->port) {
case EP93XX_DMA_SSP: case EP93XX_DMA_SSP:
case EP93XX_DMA_IDE: case EP93XX_DMA_IDE:
if (data->direction != DMA_TO_DEVICE && if (data->direction != DMA_MEM_TO_DEV &&
data->direction != DMA_FROM_DEVICE) data->direction != DMA_DEV_TO_MEM)
return -EINVAL; return -EINVAL;
break; break;
default: default:
@ -952,7 +952,7 @@ fail:
*/ */
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan); struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
@ -988,7 +988,7 @@ ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
goto fail; goto fail;
} }
if (dir == DMA_TO_DEVICE) { if (dir == DMA_MEM_TO_DEV) {
desc->src_addr = sg_dma_address(sg); desc->src_addr = sg_dma_address(sg);
desc->dst_addr = edmac->runtime_addr; desc->dst_addr = edmac->runtime_addr;
} else { } else {
@ -1032,7 +1032,7 @@ fail:
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr, ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
size_t buf_len, size_t period_len, 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_chan *edmac = to_ep93xx_dma_chan(chan);
struct ep93xx_dma_desc *desc, *first; struct ep93xx_dma_desc *desc, *first;
@ -1065,7 +1065,7 @@ ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
goto fail; goto fail;
} }
if (dir == DMA_TO_DEVICE) { if (dir == DMA_MEM_TO_DEV) {
desc->src_addr = dma_addr + offset; desc->src_addr = dma_addr + offset;
desc->dst_addr = edmac->runtime_addr; desc->dst_addr = edmac->runtime_addr;
} else { } else {
@ -1133,12 +1133,12 @@ static int ep93xx_dma_slave_config(struct ep93xx_dma_chan *edmac,
return -EINVAL; return -EINVAL;
switch (config->direction) { switch (config->direction) {
case DMA_FROM_DEVICE: case DMA_DEV_TO_MEM:
width = config->src_addr_width; width = config->src_addr_width;
addr = config->src_addr; addr = config->src_addr;
break; break;
case DMA_TO_DEVICE: case DMA_MEM_TO_DEV:
width = config->dst_addr_width; width = config->dst_addr_width;
addr = config->dst_addr; addr = config->dst_addr;
break; break;

View File

@ -772,7 +772,7 @@ fail:
*/ */
static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg( static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len, 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 * 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; return -ENXIO;
/* we set the controller burst size depending on direction */ /* we set the controller burst size depending on direction */
if (config->direction == DMA_TO_DEVICE) if (config->direction == DMA_MEM_TO_DEV)
size = config->dst_addr_width * config->dst_maxburst; size = config->dst_addr_width * config->dst_maxburst;
else else
size = config->src_addr_width * config->src_maxburst; size = config->src_addr_width * config->src_maxburst;

View File

@ -107,7 +107,7 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
imx_dma_disable(imxdmac->imxdma_channel); imx_dma_disable(imxdmac->imxdma_channel);
return 0; return 0;
case DMA_SLAVE_CONFIG: case DMA_SLAVE_CONFIG:
if (dmaengine_cfg->direction == DMA_FROM_DEVICE) { if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) {
imxdmac->per_address = dmaengine_cfg->src_addr; imxdmac->per_address = dmaengine_cfg->src_addr;
imxdmac->watermark_level = dmaengine_cfg->src_maxburst; imxdmac->watermark_level = dmaengine_cfg->src_maxburst;
imxdmac->word_size = dmaengine_cfg->src_addr_width; imxdmac->word_size = dmaengine_cfg->src_addr_width;
@ -224,7 +224,7 @@ static void imxdma_free_chan_resources(struct dma_chan *chan)
static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct imxdma_channel *imxdmac = to_imxdma_chan(chan); struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
@ -241,7 +241,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
dma_length += sg->length; dma_length += sg->length;
} }
if (direction == DMA_FROM_DEVICE) if (direction == DMA_DEV_TO_MEM)
dmamode = DMA_MODE_READ; dmamode = DMA_MODE_READ;
else else
dmamode = DMA_MODE_WRITE; dmamode = DMA_MODE_WRITE;
@ -271,7 +271,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic( static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, 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_channel *imxdmac = to_imxdma_chan(chan);
struct imxdma_engine *imxdma = imxdmac->imxdma; struct imxdma_engine *imxdma = imxdmac->imxdma;
@ -317,7 +317,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
imxdmac->sg_list[periods].page_link = imxdmac->sg_list[periods].page_link =
((unsigned long)imxdmac->sg_list | 0x01) & ~0x02; ((unsigned long)imxdmac->sg_list | 0x01) & ~0x02;
if (direction == DMA_FROM_DEVICE) if (direction == DMA_DEV_TO_MEM)
dmamode = DMA_MODE_READ; dmamode = DMA_MODE_READ;
else else
dmamode = DMA_MODE_WRITE; dmamode = DMA_MODE_WRITE;

View File

@ -247,7 +247,7 @@ struct sdma_engine;
struct sdma_channel { struct sdma_channel {
struct sdma_engine *sdma; struct sdma_engine *sdma;
unsigned int channel; unsigned int channel;
enum dma_data_direction direction; enum dma_transfer_direction direction;
enum sdma_peripheral_type peripheral_type; enum sdma_peripheral_type peripheral_type;
unsigned int event_id0; unsigned int event_id0;
unsigned int event_id1; unsigned int event_id1;
@ -650,7 +650,7 @@ static int sdma_load_context(struct sdma_channel *sdmac)
struct sdma_buffer_descriptor *bd0 = sdma->channel[0].bd; struct sdma_buffer_descriptor *bd0 = sdma->channel[0].bd;
int ret; int ret;
if (sdmac->direction == DMA_FROM_DEVICE) { if (sdmac->direction == DMA_DEV_TO_MEM) {
load_address = sdmac->pc_from_device; load_address = sdmac->pc_from_device;
} else { } else {
load_address = sdmac->pc_to_device; load_address = sdmac->pc_to_device;
@ -911,7 +911,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
static struct dma_async_tx_descriptor *sdma_prep_slave_sg( static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct sdma_channel *sdmac = to_sdma_chan(chan); struct sdma_channel *sdmac = to_sdma_chan(chan);
@ -1008,7 +1008,7 @@ err_out:
static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, 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_channel *sdmac = to_sdma_chan(chan);
struct sdma_engine *sdma = sdmac->sdma; struct sdma_engine *sdma = sdmac->sdma;
@ -1093,7 +1093,7 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
sdma_disable_channel(sdmac); sdma_disable_channel(sdmac);
return 0; return 0;
case DMA_SLAVE_CONFIG: case DMA_SLAVE_CONFIG:
if (dmaengine_cfg->direction == DMA_FROM_DEVICE) { if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) {
sdmac->per_address = dmaengine_cfg->src_addr; sdmac->per_address = dmaengine_cfg->src_addr;
sdmac->watermark_level = dmaengine_cfg->src_maxburst; sdmac->watermark_level = dmaengine_cfg->src_maxburst;
sdmac->word_size = dmaengine_cfg->src_addr_width; sdmac->word_size = dmaengine_cfg->src_addr_width;

View File

@ -395,10 +395,10 @@ static int midc_lli_fill_sg(struct intel_mid_dma_chan *midc,
midc->dma->block_size); midc->dma->block_size);
/*Populate SAR and DAR values*/ /*Populate SAR and DAR values*/
sg_phy_addr = sg_phys(sg); sg_phy_addr = sg_phys(sg);
if (desc->dirn == DMA_TO_DEVICE) { if (desc->dirn == DMA_MEM_TO_DEV) {
lli_bloc_desc->sar = sg_phy_addr; lli_bloc_desc->sar = sg_phy_addr;
lli_bloc_desc->dar = mids->dma_slave.dst_addr; lli_bloc_desc->dar = mids->dma_slave.dst_addr;
} else if (desc->dirn == DMA_FROM_DEVICE) { } else if (desc->dirn == DMA_DEV_TO_MEM) {
lli_bloc_desc->sar = mids->dma_slave.src_addr; lli_bloc_desc->sar = mids->dma_slave.src_addr;
lli_bloc_desc->dar = sg_phy_addr; lli_bloc_desc->dar = sg_phy_addr;
} }
@ -632,13 +632,13 @@ static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
if (midc->dma->pimr_mask) { if (midc->dma->pimr_mask) {
cfg_hi.cfgx.protctl = 0x0; /*default value*/ cfg_hi.cfgx.protctl = 0x0; /*default value*/
cfg_hi.cfgx.fifo_mode = 1; cfg_hi.cfgx.fifo_mode = 1;
if (mids->dma_slave.direction == DMA_TO_DEVICE) { if (mids->dma_slave.direction == DMA_MEM_TO_DEV) {
cfg_hi.cfgx.src_per = 0; cfg_hi.cfgx.src_per = 0;
if (mids->device_instance == 0) if (mids->device_instance == 0)
cfg_hi.cfgx.dst_per = 3; cfg_hi.cfgx.dst_per = 3;
if (mids->device_instance == 1) if (mids->device_instance == 1)
cfg_hi.cfgx.dst_per = 1; cfg_hi.cfgx.dst_per = 1;
} else if (mids->dma_slave.direction == DMA_FROM_DEVICE) { } else if (mids->dma_slave.direction == DMA_DEV_TO_MEM) {
if (mids->device_instance == 0) if (mids->device_instance == 0)
cfg_hi.cfgx.src_per = 2; cfg_hi.cfgx.src_per = 2;
if (mids->device_instance == 1) if (mids->device_instance == 1)
@ -682,11 +682,11 @@ static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
ctl_lo.ctlx.sinc = 0; ctl_lo.ctlx.sinc = 0;
ctl_lo.ctlx.dinc = 0; ctl_lo.ctlx.dinc = 0;
} else { } else {
if (mids->dma_slave.direction == DMA_TO_DEVICE) { if (mids->dma_slave.direction == DMA_MEM_TO_DEV) {
ctl_lo.ctlx.sinc = 0; ctl_lo.ctlx.sinc = 0;
ctl_lo.ctlx.dinc = 2; ctl_lo.ctlx.dinc = 2;
ctl_lo.ctlx.tt_fc = 1; ctl_lo.ctlx.tt_fc = 1;
} else if (mids->dma_slave.direction == DMA_FROM_DEVICE) { } else if (mids->dma_slave.direction == DMA_DEV_TO_MEM) {
ctl_lo.ctlx.sinc = 2; ctl_lo.ctlx.sinc = 2;
ctl_lo.ctlx.dinc = 0; ctl_lo.ctlx.dinc = 0;
ctl_lo.ctlx.tt_fc = 2; ctl_lo.ctlx.tt_fc = 2;
@ -732,7 +732,7 @@ err_desc_get:
*/ */
static struct dma_async_tx_descriptor *intel_mid_dma_prep_slave_sg( static struct dma_async_tx_descriptor *intel_mid_dma_prep_slave_sg(
struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct intel_mid_dma_chan *midc = NULL; struct intel_mid_dma_chan *midc = NULL;

View File

@ -262,7 +262,7 @@ struct intel_mid_dma_desc {
unsigned int lli_length; unsigned int lli_length;
unsigned int current_lli; unsigned int current_lli;
dma_addr_t next; dma_addr_t next;
enum dma_data_direction dirn; enum dma_transfer_direction dirn;
enum dma_status status; enum dma_status status;
enum dma_slave_buswidth width; /*width of DMA txn*/ enum dma_slave_buswidth width; /*width of DMA txn*/
enum intel_mid_dma_mode cfg_mode; /*mode configuration*/ enum intel_mid_dma_mode cfg_mode; /*mode configuration*/

View File

@ -1364,7 +1364,7 @@ static void ipu_gc_tasklet(unsigned long arg)
/* Allocate and initialise a transfer descriptor. */ /* Allocate and initialise a transfer descriptor. */
static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan, static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan,
struct scatterlist *sgl, unsigned int sg_len, 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_channel *ichan = to_idmac_chan(chan);
struct idmac_tx_desc *desc = NULL; struct idmac_tx_desc *desc = NULL;
@ -1376,7 +1376,7 @@ static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan
chan->chan_id != IDMAC_IC_7) chan->chan_id != IDMAC_IC_7)
return NULL; return NULL;
if (direction != DMA_FROM_DEVICE && direction != DMA_TO_DEVICE) { if (direction != DMA_DEV_TO_MEM && direction != DMA_MEM_TO_DEV) {
dev_err(chan->device->dev, "Invalid DMA direction %d!\n", direction); dev_err(chan->device->dev, "Invalid DMA direction %d!\n", direction);
return NULL; return NULL;
} }

View File

@ -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( static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long append)
{ {
struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); 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_CHAIN;
ccw->bits |= CCW_HALT_ON_TERM; ccw->bits |= CCW_HALT_ON_TERM;
ccw->bits |= CCW_TERM_FLUSH; ccw->bits |= CCW_TERM_FLUSH;
ccw->bits |= BF_CCW(direction == DMA_FROM_DEVICE ? ccw->bits |= BF_CCW(direction == DMA_DEV_TO_MEM ?
MXS_DMA_CMD_WRITE : MXS_DMA_CMD_READ, MXS_DMA_CMD_WRITE : MXS_DMA_CMD_READ,
COMMAND); COMMAND);
@ -472,7 +472,7 @@ err_out:
static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic( static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, 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_chan *mxs_chan = to_mxs_dma_chan(chan);
struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; 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_IRQ;
ccw->bits |= CCW_HALT_ON_TERM; ccw->bits |= CCW_HALT_ON_TERM;
ccw->bits |= CCW_TERM_FLUSH; ccw->bits |= CCW_TERM_FLUSH;
ccw->bits |= BF_CCW(direction == DMA_FROM_DEVICE ? ccw->bits |= BF_CCW(direction == DMA_DEV_TO_MEM ?
MXS_DMA_CMD_WRITE : MXS_DMA_CMD_READ, COMMAND); MXS_DMA_CMD_WRITE : MXS_DMA_CMD_READ, COMMAND);
dma_addr += period_len; dma_addr += period_len;

View File

@ -99,7 +99,7 @@ struct pch_dma_desc {
struct pch_dma_chan { struct pch_dma_chan {
struct dma_chan chan; struct dma_chan chan;
void __iomem *membase; void __iomem *membase;
enum dma_data_direction dir; enum dma_transfer_direction dir;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
unsigned long err_status; 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 << mask_ctl = DMA_MASK_CTL0_MODE & ~(DMA_CTL0_MODE_MASK_BITS <<
(DMA_CTL0_BITS_PER_CH * chan->chan_id)); (DMA_CTL0_BITS_PER_CH * chan->chan_id));
val &= mask_mode; val &= mask_mode;
if (pd_chan->dir == DMA_TO_DEVICE) if (pd_chan->dir == DMA_MEM_TO_DEV)
val |= 0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id + val |= 0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id +
DMA_CTL0_DIR_SHIFT_BITS); DMA_CTL0_DIR_SHIFT_BITS);
else 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 << mask_ctl = DMA_MASK_CTL2_MODE & ~(DMA_CTL0_MODE_MASK_BITS <<
(DMA_CTL0_BITS_PER_CH * ch)); (DMA_CTL0_BITS_PER_CH * ch));
val &= mask_mode; val &= mask_mode;
if (pd_chan->dir == DMA_TO_DEVICE) if (pd_chan->dir == DMA_MEM_TO_DEV)
val |= 0x1 << (DMA_CTL0_BITS_PER_CH * ch + val |= 0x1 << (DMA_CTL0_BITS_PER_CH * ch +
DMA_CTL0_DIR_SHIFT_BITS); DMA_CTL0_DIR_SHIFT_BITS);
else 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, static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
struct scatterlist *sgl, unsigned int sg_len, 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_chan *pd_chan = to_pd_chan(chan);
struct pch_dma_slave *pd_slave = chan->private; 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; return NULL;
} }
if (direction == DMA_FROM_DEVICE) if (direction == DMA_DEV_TO_MEM)
reg = pd_slave->rx_reg; reg = pd_slave->rx_reg;
else if (direction == DMA_TO_DEVICE) else if (direction == DMA_MEM_TO_DEV)
reg = pd_slave->tx_reg; reg = pd_slave->tx_reg;
else else
return NULL; return NULL;

View File

@ -320,14 +320,14 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
case DMA_SLAVE_CONFIG: case DMA_SLAVE_CONFIG:
slave_config = (struct dma_slave_config *)arg; slave_config = (struct dma_slave_config *)arg;
if (slave_config->direction == DMA_TO_DEVICE) { if (slave_config->direction == DMA_MEM_TO_DEV) {
if (slave_config->dst_addr) if (slave_config->dst_addr)
pch->fifo_addr = slave_config->dst_addr; pch->fifo_addr = slave_config->dst_addr;
if (slave_config->dst_addr_width) if (slave_config->dst_addr_width)
pch->burst_sz = __ffs(slave_config->dst_addr_width); pch->burst_sz = __ffs(slave_config->dst_addr_width);
if (slave_config->dst_maxburst) if (slave_config->dst_maxburst)
pch->burst_len = slave_config->dst_maxburst; pch->burst_len = slave_config->dst_maxburst;
} else if (slave_config->direction == DMA_FROM_DEVICE) { } else if (slave_config->direction == DMA_DEV_TO_MEM) {
if (slave_config->src_addr) if (slave_config->src_addr)
pch->fifo_addr = slave_config->src_addr; pch->fifo_addr = slave_config->src_addr;
if (slave_config->src_addr_width) 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( static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
struct dma_chan *chan, dma_addr_t dma_addr, size_t len, 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_desc *desc;
struct dma_pl330_chan *pch = to_pchan(chan); struct dma_pl330_chan *pch = to_pchan(chan);
@ -612,13 +612,13 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
} }
switch (direction) { switch (direction) {
case DMA_TO_DEVICE: case DMA_MEM_TO_DEV:
desc->rqcfg.src_inc = 1; desc->rqcfg.src_inc = 1;
desc->rqcfg.dst_inc = 0; desc->rqcfg.dst_inc = 0;
src = dma_addr; src = dma_addr;
dst = pch->fifo_addr; dst = pch->fifo_addr;
break; break;
case DMA_FROM_DEVICE: case DMA_DEV_TO_MEM:
desc->rqcfg.src_inc = 0; desc->rqcfg.src_inc = 0;
desc->rqcfg.dst_inc = 1; desc->rqcfg.dst_inc = 1;
src = pch->fifo_addr; 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 * static struct dma_async_tx_descriptor *
pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flg)
{ {
struct dma_pl330_desc *first, *desc = NULL; struct dma_pl330_desc *first, *desc = NULL;
@ -702,9 +702,9 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
return NULL; return NULL;
/* Make sure the direction is consistent */ /* Make sure the direction is consistent */
if ((direction == DMA_TO_DEVICE && if ((direction == DMA_MEM_TO_DEV &&
peri->rqtype != MEMTODEV) || peri->rqtype != MEMTODEV) ||
(direction == DMA_FROM_DEVICE && (direction == DMA_DEV_TO_MEM &&
peri->rqtype != DEVTOMEM)) { peri->rqtype != DEVTOMEM)) {
dev_err(pch->dmac->pif.dev, "%s:%d Invalid Direction\n", dev_err(pch->dmac->pif.dev, "%s:%d Invalid Direction\n",
__func__, __LINE__); __func__, __LINE__);
@ -747,7 +747,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
else else
list_add_tail(&desc->node, &first->node); list_add_tail(&desc->node, &first->node);
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
desc->rqcfg.src_inc = 1; desc->rqcfg.src_inc = 1;
desc->rqcfg.dst_inc = 0; desc->rqcfg.dst_inc = 0;
fill_px(&desc->px, fill_px(&desc->px,

View File

@ -23,7 +23,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/sh_dma.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 * @sh_chan: DMA channel
* @flags: DMA transfer flags * @flags: DMA transfer flags
* @dest: destination DMA address, incremented when direction equals * @dest: destination DMA address, incremented when direction equals
* DMA_FROM_DEVICE or DMA_BIDIRECTIONAL * DMA_DEV_TO_MEM
* @src: source DMA address, incremented when direction equals * @src: source DMA address, incremented when direction equals
* DMA_TO_DEVICE or DMA_BIDIRECTIONAL * DMA_MEM_TO_DEV
* @len: DMA transfer length * @len: DMA transfer length
* @first: if NULL, set to the current descriptor and cookie set to -EBUSY * @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, * @direction: needed for slave DMA to decide which address to keep constant,
* equals DMA_BIDIRECTIONAL for MEMCPY * equals DMA_MEM_TO_MEM for MEMCPY
* Returns 0 or an error * Returns 0 or an error
* Locks: called with desc_lock held * Locks: called with desc_lock held
*/ */
static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan, 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, 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; struct sh_desc *new;
size_t copy_size; 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; new->direction = direction;
*len -= copy_size; *len -= copy_size;
if (direction == DMA_BIDIRECTIONAL || direction == DMA_TO_DEVICE) if (direction == DMA_MEM_TO_MEM || direction == DMA_MEM_TO_DEV)
*src += copy_size; *src += copy_size;
if (direction == DMA_BIDIRECTIONAL || direction == DMA_FROM_DEVICE) if (direction == DMA_MEM_TO_MEM || direction == DMA_DEV_TO_MEM)
*dest += copy_size; *dest += copy_size;
return new; 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 * converted to scatter-gather to guarantee consistent locking and a correct
* list manipulation. For slave DMA direction carries the usual meaning, and, * list manipulation. For slave DMA direction carries the usual meaning, and,
* logically, the SG list is RAM and the addr variable contains slave address, * 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 DMA_MEM_TO_MEM
* and the SG list contains only one element and points at the source buffer. * 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, 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, 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 scatterlist *sg;
struct sh_desc *first = NULL, *new = NULL /* compiler... */; 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", dev_dbg(sh_chan->dev, "Add SG #%d@%p[%d], dma %llx\n",
i, sg, len, (unsigned long long)sg_addr); i, sg, len, (unsigned long long)sg_addr);
if (direction == DMA_FROM_DEVICE) if (direction == DMA_DEV_TO_MEM)
new = sh_dmae_add_desc(sh_chan, flags, new = sh_dmae_add_desc(sh_chan, flags,
&sg_addr, addr, &len, &first, &sg_addr, addr, &len, &first,
direction); direction);
@ -646,13 +645,13 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
sg_dma_address(&sg) = dma_src; sg_dma_address(&sg) = dma_src;
sg_dma_len(&sg) = len; 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, DMA_MEM_TO_MEM,
flags); flags);
} }
static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, 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_slave *param;
struct sh_dmae_chan *sh_chan; 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); spin_lock_irq(&sh_chan->desc_lock);
list_for_each_entry(desc, &sh_chan->ld_queue, node) { list_for_each_entry(desc, &sh_chan->ld_queue, node) {
if (desc->mark == DESC_SUBMITTED && if (desc->mark == DESC_SUBMITTED &&
((desc->direction == DMA_FROM_DEVICE && ((desc->direction == DMA_DEV_TO_MEM &&
(desc->hw.dar + desc->hw.tcr) == dar_buf) || (desc->hw.dar + desc->hw.tcr) == dar_buf) ||
(desc->hw.sar + desc->hw.tcr) == sar_buf)) { (desc->hw.sar + desc->hw.tcr) == sar_buf)) {
dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n", dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n",

View File

@ -217,7 +217,7 @@ struct d40_chan {
struct d40_log_lli_full *lcpa; struct d40_log_lli_full *lcpa;
/* Runtime reconfiguration */ /* Runtime reconfiguration */
dma_addr_t runtime_addr; dma_addr_t runtime_addr;
enum dma_data_direction runtime_direction; enum dma_transfer_direction runtime_direction;
}; };
/** /**
@ -1855,7 +1855,7 @@ err:
} }
static dma_addr_t 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_platform_data *plat = chan->base->plat_data;
struct stedma40_chan_cfg *cfg = &chan->dma_cfg; struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
@ -1864,9 +1864,9 @@ d40_get_dev_addr(struct d40_chan *chan, enum dma_data_direction direction)
if (chan->runtime_addr) if (chan->runtime_addr)
return chan->runtime_addr; return chan->runtime_addr;
if (direction == DMA_FROM_DEVICE) if (direction == DMA_DEV_TO_MEM)
addr = plat->dev_rx[cfg->src_dev_type]; addr = plat->dev_rx[cfg->src_dev_type];
else if (direction == DMA_TO_DEVICE) else if (direction == DMA_MEM_TO_DEV)
addr = plat->dev_tx[cfg->dst_dev_type]; addr = plat->dev_tx[cfg->dst_dev_type];
return addr; return addr;
@ -1875,7 +1875,7 @@ d40_get_dev_addr(struct d40_chan *chan, enum dma_data_direction direction)
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
struct scatterlist *sg_dst, unsigned int sg_len, 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); struct d40_chan *chan = container_of(dchan, struct d40_chan, chan);
dma_addr_t src_dev_addr = 0; dma_addr_t src_dev_addr = 0;
@ -1902,9 +1902,9 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
if (direction != DMA_NONE) { if (direction != DMA_NONE) {
dma_addr_t dev_addr = d40_get_dev_addr(chan, direction); dma_addr_t dev_addr = d40_get_dev_addr(chan, direction);
if (direction == DMA_FROM_DEVICE) if (direction == DMA_DEV_TO_MEM)
src_dev_addr = dev_addr; src_dev_addr = dev_addr;
else if (direction == DMA_TO_DEVICE) else if (direction == DMA_MEM_TO_DEV)
dst_dev_addr = dev_addr; dst_dev_addr = dev_addr;
} }
@ -2108,10 +2108,10 @@ d40_prep_memcpy_sg(struct dma_chan *chan,
static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan, static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
struct scatterlist *sgl, struct scatterlist *sgl,
unsigned int sg_len, unsigned int sg_len,
enum dma_data_direction direction, enum dma_transfer_direction direction,
unsigned long dma_flags) unsigned long dma_flags)
{ {
if (direction != DMA_FROM_DEVICE && direction != DMA_TO_DEVICE) if (direction != DMA_DEV_TO_MEM && direction != DMA_MEM_TO_DEV)
return NULL; return NULL;
return d40_prep_sg(chan, sgl, sgl, sg_len, direction, dma_flags); return d40_prep_sg(chan, sgl, sgl, sg_len, direction, dma_flags);
@ -2120,7 +2120,7 @@ static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr, dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
size_t buf_len, size_t period_len, 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; unsigned int periods = buf_len / period_len;
struct dma_async_tx_descriptor *txd; struct dma_async_tx_descriptor *txd;
@ -2269,7 +2269,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
dst_addr_width = config->dst_addr_width; dst_addr_width = config->dst_addr_width;
dst_maxburst = config->dst_maxburst; dst_maxburst = config->dst_maxburst;
if (config->direction == DMA_FROM_DEVICE) { if (config->direction == DMA_DEV_TO_MEM) {
dma_addr_t dev_addr_rx = dma_addr_t dev_addr_rx =
d40c->base->plat_data->dev_rx[cfg->src_dev_type]; d40c->base->plat_data->dev_rx[cfg->src_dev_type];
@ -2292,7 +2292,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
if (dst_maxburst == 0) if (dst_maxburst == 0)
dst_maxburst = src_maxburst; dst_maxburst = src_maxburst;
} else if (config->direction == DMA_TO_DEVICE) { } else if (config->direction == DMA_MEM_TO_DEV) {
dma_addr_t dev_addr_tx = dma_addr_t dev_addr_tx =
d40c->base->plat_data->dev_tx[cfg->dst_dev_type]; d40c->base->plat_data->dev_tx[cfg->dst_dev_type];
@ -2357,7 +2357,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
"configured channel %s for %s, data width %d/%d, " "configured channel %s for %s, data width %d/%d, "
"maxburst %d/%d elements, LE, no flow control\n", "maxburst %d/%d elements, LE, no flow control\n",
dma_chan_name(chan), dma_chan_name(chan),
(config->direction == DMA_FROM_DEVICE) ? "RX" : "TX", (config->direction == DMA_DEV_TO_MEM) ? "RX" : "TX",
src_addr_width, dst_addr_width, src_addr_width, dst_addr_width,
src_maxburst, dst_maxburst); src_maxburst, dst_maxburst);

View File

@ -90,7 +90,7 @@ struct timb_dma_chan {
struct list_head queue; struct list_head queue;
struct list_head free_list; struct list_head free_list;
unsigned int bytes_per_line; unsigned int bytes_per_line;
enum dma_data_direction direction; enum dma_transfer_direction direction;
unsigned int descs; /* Descriptors to allocate */ unsigned int descs; /* Descriptors to allocate */
unsigned int desc_elems; /* number of elems per descriptor */ 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: %p, chan: %d, membase: %p\n",
td_chan, td_chan->chan.chan_id, td_chan->membase); td_chan, td_chan->chan.chan_id, td_chan->membase);
if (td_chan->direction == DMA_FROM_DEVICE) { if (td_chan->direction == DMA_DEV_TO_MEM) {
/* descriptor address */ /* descriptor address */
iowrite32(0, td_chan->membase + TIMBDMA_OFFS_RX_DHAR); 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); txd->cookie);
/* make sure to stop the transfer */ /* make sure to stop the transfer */
if (td_chan->direction == DMA_FROM_DEVICE) if (td_chan->direction == DMA_DEV_TO_MEM)
iowrite32(0, td_chan->membase + TIMBDMA_OFFS_RX_ER); iowrite32(0, td_chan->membase + TIMBDMA_OFFS_RX_ER);
/* Currently no support for stopping DMA transfers /* Currently no support for stopping DMA transfers
else 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.flags = DMA_CTRL_ACK;
td_desc->txd.phys = dma_map_single(chan2dmadev(chan), 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, DMA_MEM_TO_DEV);
err = dma_mapping_error(chan2dmadev(chan), td_desc->txd.phys); err = dma_mapping_error(chan2dmadev(chan), td_desc->txd.phys);
if (err) { 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); 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, 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, DMA_MEM_TO_DEV);
kfree(td_desc->desc_list); kfree(td_desc->desc_list);
kfree(td_desc); 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, static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
struct scatterlist *sgl, unsigned int sg_len, 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 = struct timb_dma_chan *td_chan =
container_of(chan, struct timb_dma_chan, 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, dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys,
td_desc->desc_list_len, DMA_TO_DEVICE); td_desc->desc_list_len, DMA_MEM_TO_DEV);
return &td_desc->txd; return &td_desc->txd;
} }
@ -775,8 +775,8 @@ static int __devinit td_probe(struct platform_device *pdev)
td_chan->descs = pchan->descriptors; td_chan->descs = pchan->descriptors;
td_chan->desc_elems = pchan->descriptor_elements; td_chan->desc_elems = pchan->descriptor_elements;
td_chan->bytes_per_line = pchan->bytes_per_line; td_chan->bytes_per_line = pchan->bytes_per_line;
td_chan->direction = pchan->rx ? DMA_FROM_DEVICE : td_chan->direction = pchan->rx ? DMA_DEV_TO_MEM :
DMA_TO_DEVICE; DMA_MEM_TO_DEV;
td_chan->membase = td->membase + td_chan->membase = td->membase +
(i / 2) * TIMBDMA_INSTANCE_OFFSET + (i / 2) * TIMBDMA_INSTANCE_OFFSET +

View File

@ -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 * static struct dma_async_tx_descriptor *
txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, 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) unsigned long flags)
{ {
struct txx9dmac_chan *dc = to_txx9dmac_chan(chan); 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); BUG_ON(!ds || !ds->reg_width);
if (ds->tx_reg) if (ds->tx_reg)
BUG_ON(direction != DMA_TO_DEVICE); BUG_ON(direction != DMA_MEM_TO_DEV);
else else
BUG_ON(direction != DMA_FROM_DEVICE); BUG_ON(direction != DMA_DEV_TO_MEM);
if (unlikely(!sg_len)) if (unlikely(!sg_len))
return NULL; return NULL;
@ -882,7 +882,7 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
mem = sg_dma_address(sg); mem = sg_dma_address(sg);
if (__is_dmac64(ddev)) { if (__is_dmac64(ddev)) {
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
desc->hwdesc.SAR = mem; desc->hwdesc.SAR = mem;
desc->hwdesc.DAR = ds->tx_reg; desc->hwdesc.DAR = ds->tx_reg;
} else { } else {
@ -891,7 +891,7 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
} }
desc->hwdesc.CNTR = sg_dma_len(sg); desc->hwdesc.CNTR = sg_dma_len(sg);
} else { } else {
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
desc->hwdesc32.SAR = mem; desc->hwdesc32.SAR = mem;
desc->hwdesc32.DAR = ds->tx_reg; desc->hwdesc32.DAR = ds->tx_reg;
} else { } else {
@ -900,7 +900,7 @@ txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
} }
desc->hwdesc32.CNTR = sg_dma_len(sg); desc->hwdesc32.CNTR = sg_dma_len(sg);
} }
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
sai = ds->reg_width; sai = ds->reg_width;
dai = 0; dai = 0;
} else { } else {

View File

@ -287,7 +287,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
sg_dma_len(sg) = new_size; sg_dma_len(sg) = new_size;
txd = ichan->dma_chan.device->device_prep_slave_sg( txd = ichan->dma_chan.device->device_prep_slave_sg(
&ichan->dma_chan, sg, 1, DMA_FROM_DEVICE, &ichan->dma_chan, sg, 1, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT); DMA_PREP_INTERRUPT);
if (!txd) if (!txd)
goto error; goto error;

View File

@ -565,7 +565,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
spin_unlock_irq(&fh->queue_lock); spin_unlock_irq(&fh->queue_lock);
desc = fh->chan->device->device_prep_slave_sg(fh->chan, desc = fh->chan->device->device_prep_slave_sg(fh->chan,
buf->sg, sg_elems, DMA_FROM_DEVICE, buf->sg, sg_elems, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP); DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
if (!desc) { if (!desc) {
spin_lock_irq(&fh->queue_lock); spin_lock_irq(&fh->queue_lock);

View File

@ -513,7 +513,7 @@ static noinline int fpga_program_dma(struct fpga_dev *priv)
* transaction, and then put it under external control * transaction, and then put it under external control
*/ */
memset(&config, 0, sizeof(config)); memset(&config, 0, sizeof(config));
config.direction = DMA_TO_DEVICE; config.direction = DMA_MEM_TO_DEV;
config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
config.dst_maxburst = fpga_fifo_size(priv->regs) / 2 / 4; config.dst_maxburst = fpga_fifo_size(priv->regs) / 2 / 4;
ret = chan->device->device_control(chan, DMA_SLAVE_CONFIG, ret = chan->device->device_control(chan, DMA_SLAVE_CONFIG,

View File

@ -823,6 +823,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
struct scatterlist *sg; struct scatterlist *sg;
unsigned int i; unsigned int i;
enum dma_data_direction direction; enum dma_data_direction direction;
enum dma_transfer_direction slave_dirn;
unsigned int sglen; unsigned int sglen;
u32 iflags; u32 iflags;
@ -860,16 +861,19 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
if (host->caps.has_dma) if (host->caps.has_dma)
atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN); atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN);
if (data->flags & MMC_DATA_READ) if (data->flags & MMC_DATA_READ) {
direction = DMA_FROM_DEVICE; direction = DMA_FROM_DEVICE;
else slave_dirn = DMA_DEV_TO_MEM;
} else {
direction = DMA_TO_DEVICE; direction = DMA_TO_DEVICE;
slave_dirn = DMA_MEM_TO_DEV;
}
sglen = dma_map_sg(chan->device->dev, data->sg, sglen = dma_map_sg(chan->device->dev, data->sg,
data->sg_len, direction); data->sg_len, direction);
desc = chan->device->device_prep_slave_sg(chan, desc = chan->device->device_prep_slave_sg(chan,
data->sg, sglen, direction, data->sg, sglen, slave_dirn,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) if (!desc)
goto unmap_exit; goto unmap_exit;

View File

@ -374,6 +374,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
struct dma_chan *chan; struct dma_chan *chan;
struct dma_device *device; struct dma_device *device;
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
enum dma_data_direction buffer_dirn;
int nr_sg; int nr_sg;
/* Check if next job is already prepared */ /* Check if next job is already prepared */
@ -387,10 +388,12 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
} }
if (data->flags & MMC_DATA_READ) { if (data->flags & MMC_DATA_READ) {
conf.direction = DMA_FROM_DEVICE; conf.direction = DMA_DEV_TO_MEM;
buffer_dirn = DMA_FROM_DEVICE;
chan = host->dma_rx_channel; chan = host->dma_rx_channel;
} else { } else {
conf.direction = DMA_TO_DEVICE; conf.direction = DMA_MEM_TO_DEV;
buffer_dirn = DMA_TO_DEVICE;
chan = host->dma_tx_channel; chan = host->dma_tx_channel;
} }
@ -403,7 +406,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
return -EINVAL; return -EINVAL;
device = chan->device; 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) if (nr_sg == 0)
return -EINVAL; return -EINVAL;
@ -426,7 +429,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
unmap_exit: unmap_exit:
if (!next) if (!next)
dmaengine_terminate_all(chan); 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; return -ENOMEM;
} }

View File

@ -218,6 +218,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
unsigned int blksz = data->blksz; unsigned int blksz = data->blksz;
unsigned int datasize = nob * blksz; unsigned int datasize = nob * blksz;
struct scatterlist *sg; struct scatterlist *sg;
enum dma_transfer_direction slave_dirn;
int i, nents; int i, nents;
if (data->flags & MMC_DATA_STREAM) if (data->flags & MMC_DATA_STREAM)
@ -240,10 +241,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; host->dma_dir = DMA_FROM_DEVICE;
else slave_dirn = DMA_DEV_TO_MEM;
} else {
host->dma_dir = DMA_TO_DEVICE; host->dma_dir = DMA_TO_DEVICE;
slave_dirn = DMA_MEM_TO_DEV;
}
nents = dma_map_sg(host->dma->device->dev, data->sg, nents = dma_map_sg(host->dma->device->dev, data->sg,
data->sg_len, host->dma_dir); data->sg_len, host->dma_dir);
@ -251,7 +255,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
return -EINVAL; return -EINVAL;
host->desc = host->dma->device->device_prep_slave_sg(host->dma, 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); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!host->desc) { if (!host->desc) {

View File

@ -154,6 +154,7 @@ struct mxs_mmc_host {
struct dma_chan *dmach; struct dma_chan *dmach;
struct mxs_dma_data dma_data; struct mxs_dma_data dma_data;
unsigned int dma_dir; unsigned int dma_dir;
enum dma_transfer_direction slave_dirn;
u32 ssp_pio_words[SSP_PIO_NUM]; u32 ssp_pio_words[SSP_PIO_NUM];
unsigned int version; unsigned int version;
@ -324,7 +325,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma(
} }
desc = host->dmach->device->device_prep_slave_sg(host->dmach, 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) { if (desc) {
desc->callback = mxs_mmc_dma_irq_callback; desc->callback = mxs_mmc_dma_irq_callback;
desc->callback_param = host; desc->callback_param = host;
@ -433,6 +434,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
int i; int i;
unsigned short dma_data_dir, timeout; unsigned short dma_data_dir, timeout;
enum dma_transfer_direction slave_dirn;
unsigned int data_size = 0, log2_blksz; unsigned int data_size = 0, log2_blksz;
unsigned int blocks = data->blocks; unsigned int blocks = data->blocks;
@ -448,9 +450,11 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
if (data->flags & MMC_DATA_WRITE) { if (data->flags & MMC_DATA_WRITE) {
dma_data_dir = DMA_TO_DEVICE; dma_data_dir = DMA_TO_DEVICE;
slave_dirn = DMA_MEM_TO_DEV;
read = 0; read = 0;
} else { } else {
dma_data_dir = DMA_FROM_DEVICE; dma_data_dir = DMA_FROM_DEVICE;
slave_dirn = DMA_DEV_TO_MEM;
read = BM_SSP_CTRL0_READ; read = BM_SSP_CTRL0_READ;
} }
@ -518,6 +522,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
WARN_ON(host->data != NULL); WARN_ON(host->data != NULL);
host->data = data; host->data = data;
host->dma_dir = dma_data_dir; host->dma_dir = dma_data_dir;
host->slave_dirn = slave_dirn;
desc = mxs_mmc_prep_dma(host, 1); desc = mxs_mmc_prep_dma(host, 1);
if (!desc) if (!desc)
goto out; goto out;

View File

@ -233,7 +233,7 @@ static void sh_mmcif_start_dma_rx(struct sh_mmcif_host *host)
if (ret > 0) { if (ret > 0) {
host->dma_active = true; host->dma_active = true;
desc = chan->device->device_prep_slave_sg(chan, sg, ret, desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
} }
if (desc) { if (desc) {
@ -281,7 +281,7 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host)
if (ret > 0) { if (ret > 0) {
host->dma_active = true; host->dma_active = true;
desc = chan->device->device_prep_slave_sg(chan, sg, ret, desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
} }
if (desc) { if (desc) {

View File

@ -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); ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);
if (ret > 0) if (ret > 0)
desc = chan->device->device_prep_slave_sg(chan, sg, ret, desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_FROM_DEVICE, DMA_CTRL_ACK); DMA_DEV_TO_MEM, DMA_CTRL_ACK);
if (desc) { if (desc) {
cookie = dmaengine_submit(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); ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);
if (ret > 0) if (ret > 0)
desc = chan->device->device_prep_slave_sg(chan, sg, ret, desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_TO_DEVICE, DMA_CTRL_ACK); DMA_MEM_TO_DEV, DMA_CTRL_ACK);
if (desc) { if (desc) {
cookie = dmaengine_submit(desc); cookie = dmaengine_submit(desc);

View File

@ -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; sg_dma_len(&ctl->sg) += 4 - sg_dma_len(&ctl->sg) % 4;
ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan, ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan,
&ctl->sg, 1, DMA_TO_DEVICE, &ctl->sg, 1, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP); DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
if (!ctl->adesc) if (!ctl->adesc)
return NETDEV_TX_BUSY; 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; sg_dma_len(sg) = DMA_BUFFER_SIZE;
ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan, ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan,
sg, 1, DMA_FROM_DEVICE, sg, 1, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP); DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
if (!ctl->adesc) if (!ctl->adesc)

View File

@ -131,7 +131,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
rxchan = dws->rxchan; rxchan = dws->rxchan;
/* 2. Prepare the TX dma transfer */ /* 2. Prepare the TX dma transfer */
txconf.direction = DMA_TO_DEVICE; txconf.direction = DMA_MEM_TO_DEV;
txconf.dst_addr = dws->dma_addr; txconf.dst_addr = dws->dma_addr;
txconf.dst_maxburst = LNW_DMA_MSIZE_16; txconf.dst_maxburst = LNW_DMA_MSIZE_16;
txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 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, txdesc = txchan->device->device_prep_slave_sg(txchan,
&dws->tx_sgl, &dws->tx_sgl,
1, 1,
DMA_TO_DEVICE, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
txdesc->callback = dw_spi_dma_done; txdesc->callback = dw_spi_dma_done;
txdesc->callback_param = dws; txdesc->callback_param = dws;
/* 3. Prepare the RX dma transfer */ /* 3. Prepare the RX dma transfer */
rxconf.direction = DMA_FROM_DEVICE; rxconf.direction = DMA_DEV_TO_MEM;
rxconf.src_addr = dws->dma_addr; rxconf.src_addr = dws->dma_addr;
rxconf.src_maxburst = LNW_DMA_MSIZE_16; rxconf.src_maxburst = LNW_DMA_MSIZE_16;
rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 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, rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
&dws->rx_sgl, &dws->rx_sgl,
1, 1,
DMA_FROM_DEVICE, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP);
rxdesc->callback = dw_spi_dma_done; rxdesc->callback = dw_spi_dma_done;
rxdesc->callback_param = dws; rxdesc->callback_param = dws;

View File

@ -551,6 +551,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
struct dma_async_tx_descriptor *txd; struct dma_async_tx_descriptor *txd;
enum dma_slave_buswidth buswidth; enum dma_slave_buswidth buswidth;
struct dma_slave_config conf; struct dma_slave_config conf;
enum dma_transfer_direction slave_dirn;
struct scatterlist *sg; struct scatterlist *sg;
struct sg_table *sgt; struct sg_table *sgt;
struct dma_chan *chan; struct dma_chan *chan;
@ -573,6 +574,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
conf.src_addr = espi->sspdr_phys; conf.src_addr = espi->sspdr_phys;
conf.src_addr_width = buswidth; conf.src_addr_width = buswidth;
slave_dirn = DMA_DEV_TO_MEM;
} else { } else {
chan = espi->dma_tx; chan = espi->dma_tx;
buf = t->tx_buf; buf = t->tx_buf;
@ -580,6 +582,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
conf.dst_addr = espi->sspdr_phys; conf.dst_addr = espi->sspdr_phys;
conf.dst_addr_width = buswidth; conf.dst_addr_width = buswidth;
slave_dirn = DMA_MEM_TO_DEV;
} }
ret = dmaengine_slave_config(chan, &conf); ret = dmaengine_slave_config(chan, &conf);
@ -631,7 +634,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents, txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents,
dir, DMA_CTRL_ACK); slave_dirn, DMA_CTRL_ACK);
if (!txd) { if (!txd) {
dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
@ -979,7 +982,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
dma_cap_set(DMA_SLAVE, mask); dma_cap_set(DMA_SLAVE, mask);
espi->dma_rx_data.port = EP93XX_DMA_SSP; espi->dma_rx_data.port = EP93XX_DMA_SSP;
espi->dma_rx_data.direction = DMA_FROM_DEVICE; espi->dma_rx_data.direction = DMA_DEV_TO_MEM;
espi->dma_rx_data.name = "ep93xx-spi-rx"; espi->dma_rx_data.name = "ep93xx-spi-rx";
espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter, espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter,
@ -990,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.port = EP93XX_DMA_SSP;
espi->dma_tx_data.direction = DMA_TO_DEVICE; espi->dma_tx_data.direction = DMA_MEM_TO_DEV;
espi->dma_tx_data.name = "ep93xx-spi-tx"; espi->dma_tx_data.name = "ep93xx-spi-tx";
espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter, espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter,

View File

@ -904,11 +904,11 @@ static int configure_dma(struct pl022 *pl022)
{ {
struct dma_slave_config rx_conf = { struct dma_slave_config rx_conf = {
.src_addr = SSP_DR(pl022->phybase), .src_addr = SSP_DR(pl022->phybase),
.direction = DMA_FROM_DEVICE, .direction = DMA_DEV_TO_MEM,
}; };
struct dma_slave_config tx_conf = { struct dma_slave_config tx_conf = {
.dst_addr = SSP_DR(pl022->phybase), .dst_addr = SSP_DR(pl022->phybase),
.direction = DMA_TO_DEVICE, .direction = DMA_MEM_TO_DEV,
}; };
unsigned int pages; unsigned int pages;
int ret; int ret;
@ -1045,7 +1045,7 @@ static int configure_dma(struct pl022 *pl022)
rxdesc = rxchan->device->device_prep_slave_sg(rxchan, rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
pl022->sgt_rx.sgl, pl022->sgt_rx.sgl,
rx_sglen, rx_sglen,
DMA_FROM_DEVICE, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!rxdesc) if (!rxdesc)
goto err_rxdesc; goto err_rxdesc;
@ -1053,7 +1053,7 @@ static int configure_dma(struct pl022 *pl022)
txdesc = txchan->device->device_prep_slave_sg(txchan, txdesc = txchan->device->device_prep_slave_sg(txchan,
pl022->sgt_tx.sgl, pl022->sgt_tx.sgl,
tx_sglen, tx_sglen,
DMA_TO_DEVICE, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!txdesc) if (!txdesc)
goto err_txdesc; goto err_txdesc;

View File

@ -1076,7 +1076,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
} }
sg = dma->sg_rx_p; sg = dma->sg_rx_p;
desc_rx = dma->chan_rx->device->device_prep_slave_sg(dma->chan_rx, sg, desc_rx = dma->chan_rx->device->device_prep_slave_sg(dma->chan_rx, sg,
num, DMA_FROM_DEVICE, num, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc_rx) { if (!desc_rx) {
dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n", dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n",
@ -1121,7 +1121,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
} }
sg = dma->sg_tx_p; sg = dma->sg_tx_p;
desc_tx = dma->chan_tx->device->device_prep_slave_sg(dma->chan_tx, desc_tx = dma->chan_tx->device->device_prep_slave_sg(dma->chan_tx,
sg, num, DMA_TO_DEVICE, sg, num, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc_tx) { if (!desc_tx) {
dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n", dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n",

View File

@ -268,7 +268,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
struct dma_slave_config tx_conf = { struct dma_slave_config tx_conf = {
.dst_addr = uap->port.mapbase + UART01x_DR, .dst_addr = uap->port.mapbase + UART01x_DR,
.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, .dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
.direction = DMA_TO_DEVICE, .direction = DMA_MEM_TO_DEV,
.dst_maxburst = uap->fifosize >> 1, .dst_maxburst = uap->fifosize >> 1,
}; };
struct dma_chan *chan; 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 = { struct dma_slave_config rx_conf = {
.src_addr = uap->port.mapbase + UART01x_DR, .src_addr = uap->port.mapbase + UART01x_DR,
.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
.direction = DMA_FROM_DEVICE, .direction = DMA_DEV_TO_MEM,
.src_maxburst = uap->fifosize >> 1, .src_maxburst = uap->fifosize >> 1,
}; };
@ -480,7 +480,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
return -EBUSY; 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, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE); 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; &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a;
dma_dev = rxchan->device; dma_dev = rxchan->device;
desc = rxchan->device->device_prep_slave_sg(rxchan, &sgbuf->sg, 1, desc = rxchan->device->device_prep_slave_sg(rxchan, &sgbuf->sg, 1,
DMA_FROM_DEVICE, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
/* /*
* If the DMA engine is busy and cannot prepare a * If the DMA engine is busy and cannot prepare a

View File

@ -749,7 +749,7 @@ static int dma_handle_rx(struct eg20t_port *priv)
sg_dma_address(sg) = priv->rx_buf_dma; sg_dma_address(sg) = priv->rx_buf_dma;
desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx, desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx,
sg, 1, DMA_FROM_DEVICE, sg, 1, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) if (!desc)
@ -908,7 +908,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
} }
desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx, 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, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n", dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n",

View File

@ -1214,7 +1214,7 @@ static void sci_submit_rx(struct sci_port *s)
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
desc = chan->device->device_prep_slave_sg(chan, desc = chan->device->device_prep_slave_sg(chan,
sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT); sg, 1, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT);
if (desc) { if (desc) {
s->desc_rx[i] = desc; s->desc_rx[i] = desc;
@ -1329,7 +1329,7 @@ static void work_fn_tx(struct work_struct *work)
BUG_ON(!sg_dma_len(sg)); BUG_ON(!sg_dma_len(sg));
desc = chan->device->device_prep_slave_sg(chan, desc = chan->device->device_prep_slave_sg(chan,
sg, s->sg_len_tx, DMA_TO_DEVICE, sg, s->sg_len_tx, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
/* switch to PIO */ /* switch to PIO */

View File

@ -112,7 +112,7 @@ static bool ux500_configure_channel(struct dma_channel *channel,
struct musb_hw_ep *hw_ep = ux500_channel->hw_ep; struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
struct dma_chan *dma_chan = ux500_channel->dma_chan; struct dma_chan *dma_chan = ux500_channel->dma_chan;
struct dma_async_tx_descriptor *dma_desc; struct dma_async_tx_descriptor *dma_desc;
enum dma_data_direction direction; enum dma_transfer_direction direction;
struct scatterlist sg; struct scatterlist sg;
struct dma_slave_config slave_conf; struct dma_slave_config slave_conf;
enum dma_slave_buswidth addr_width; 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_address(&sg) = dma_addr;
sg_dma_len(&sg) = len; sg_dma_len(&sg) = len;
direction = ux500_channel->is_tx ? DMA_TO_DEVICE : DMA_FROM_DEVICE; direction = ux500_channel->is_tx ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE : addr_width = (len & 0x3) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
DMA_SLAVE_BUSWIDTH_4_BYTES; DMA_SLAVE_BUSWIDTH_4_BYTES;

View File

@ -765,10 +765,10 @@ static void usbhsf_dma_prepare_tasklet(unsigned long data)
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt); struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
struct device *dev = usbhs_priv_to_dev(priv); struct device *dev = usbhs_priv_to_dev(priv);
enum dma_data_direction dir; enum dma_transfer_direction dir;
dma_cookie_t cookie; dma_cookie_t cookie;
dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; dir = usbhs_pipe_is_dir_in(pipe) ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV;
sg_init_table(&sg, 1); sg_init_table(&sg, 1);
sg_set_page(&sg, virt_to_page(pkt->dma), sg_set_page(&sg, virt_to_page(pkt->dma),

View File

@ -334,7 +334,7 @@ static void sdc_enable_channel(struct mx3fb_info *mx3_fbi)
/* This enables the channel */ /* This enables the channel */
if (mx3_fbi->cookie < 0) { if (mx3_fbi->cookie < 0) {
mx3_fbi->txd = dma_chan->device->device_prep_slave_sg(dma_chan, 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, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT);
if (!mx3_fbi->txd) { if (!mx3_fbi->txd) {
dev_err(mx3fb->dev, "Cannot allocate descriptor on %d\n", dev_err(mx3fb->dev, "Cannot allocate descriptor on %d\n",
dma_chan->chan_id); dma_chan->chan_id);
@ -1117,7 +1117,7 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
async_tx_ack(mx3_fbi->txd); async_tx_ack(mx3_fbi->txd);
txd = dma_chan->device->device_prep_slave_sg(dma_chan, sg + 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, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT);
if (!txd) { if (!txd) {
dev_err(fbi->device, dev_err(fbi->device,
"Error preparing a DMA transaction descriptor.\n"); "Error preparing a DMA transaction descriptor.\n");

View File

@ -134,7 +134,7 @@ struct pl08x_txd {
struct dma_async_tx_descriptor tx; struct dma_async_tx_descriptor tx;
struct list_head node; struct list_head node;
struct list_head dsg_list; struct list_head dsg_list;
enum dma_data_direction direction; enum dma_transfer_direction direction;
dma_addr_t llis_bus; dma_addr_t llis_bus;
struct pl08x_lli *llis_va; struct pl08x_lli *llis_va;
/* Default cctl value for LLIs */ /* Default cctl value for LLIs */
@ -197,7 +197,7 @@ struct pl08x_dma_chan {
dma_addr_t dst_addr; dma_addr_t dst_addr;
u32 src_cctl; u32 src_cctl;
u32 dst_cctl; u32 dst_cctl;
enum dma_data_direction runtime_direction; enum dma_transfer_direction runtime_direction;
dma_cookie_t lc; dma_cookie_t lc;
struct list_head pend_list; struct list_head pend_list;
struct pl08x_txd *at; struct pl08x_txd *at;

View File

@ -23,7 +23,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/dma-direction.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <asm/page.h> #include <asm/page.h>
@ -77,6 +76,19 @@ enum dma_transaction_type {
/* last transaction type for creation of the capabilities mask */ /* last transaction type for creation of the capabilities mask */
#define DMA_TX_TYPE_END (DMA_CYCLIC + 1) #define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
/**
* enum dma_transfer_direction - dma transfer mode and direction indicator
* @DMA_MEM_TO_MEM: Async/Memcpy mode
* @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
* @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
* @DMA_DEV_TO_DEV: Slave mode & From Device to Device
*/
enum dma_transfer_direction {
DMA_MEM_TO_MEM,
DMA_MEM_TO_DEV,
DMA_DEV_TO_MEM,
DMA_DEV_TO_DEV,
};
/** /**
* enum dma_ctrl_flags - DMA flags to augment operation preparation, * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@ -269,7 +281,7 @@ enum dma_slave_buswidth {
* struct, if applicable. * struct, if applicable.
*/ */
struct dma_slave_config { struct dma_slave_config {
enum dma_data_direction direction; enum dma_transfer_direction direction;
dma_addr_t src_addr; dma_addr_t src_addr;
dma_addr_t dst_addr; dma_addr_t dst_addr;
enum dma_slave_buswidth src_addr_width; enum dma_slave_buswidth src_addr_width;
@ -492,11 +504,11 @@ struct dma_device {
struct dma_async_tx_descriptor *(*device_prep_slave_sg)( struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
struct dma_chan *chan, struct scatterlist *sgl, 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); unsigned long flags);
struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 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, int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
unsigned long arg); unsigned long arg);
@ -522,7 +534,7 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
struct dma_chan *chan, void *buf, size_t len, 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; struct scatterlist sg;
sg_init_one(&sg, buf, len); sg_init_one(&sg, buf, len);

View File

@ -127,7 +127,7 @@ struct dw_cyclic_desc {
struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan, 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, 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); void dw_dma_cyclic_free(struct dma_chan *chan);
int dw_dma_cyclic_start(struct dma_chan *chan); int dw_dma_cyclic_start(struct dma_chan *chan);
void dw_dma_cyclic_stop(struct dma_chan *chan); void dw_dma_cyclic_stop(struct dma_chan *chan);

View File

@ -30,7 +30,7 @@ struct sh_desc {
struct sh_dmae_regs hw; struct sh_dmae_regs hw;
struct list_head node; struct list_head node;
struct dma_async_tx_descriptor async_tx; struct dma_async_tx_descriptor async_tx;
enum dma_data_direction direction; enum dma_transfer_direction direction;
dma_cookie_t cookie; dma_cookie_t cookie;
size_t partial; size_t partial;
int chunks; int chunks;

View File

@ -133,7 +133,7 @@ static int atmel_abdac_prepare_dma(struct atmel_abdac *dac,
period_len = frames_to_bytes(runtime, runtime->period_size); period_len = frames_to_bytes(runtime, runtime->period_size);
cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len, cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len,
period_len, DMA_TO_DEVICE); period_len, DMA_MEM_TO_DEV);
if (IS_ERR(cdesc)) { if (IS_ERR(cdesc)) {
dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n"); dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n");
return PTR_ERR(cdesc); return PTR_ERR(cdesc);

View File

@ -102,7 +102,7 @@ static void atmel_ac97c_dma_capture_period_done(void *arg)
static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip, static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
struct snd_pcm_substream *substream, struct snd_pcm_substream *substream,
enum dma_data_direction direction) enum dma_transfer_direction direction)
{ {
struct dma_chan *chan; struct dma_chan *chan;
struct dw_cyclic_desc *cdesc; struct dw_cyclic_desc *cdesc;
@ -118,7 +118,7 @@ static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
return -EINVAL; return -EINVAL;
} }
if (direction == DMA_TO_DEVICE) if (direction == DMA_MEM_TO_DEV)
chan = chip->dma.tx_chan; chan = chip->dma.tx_chan;
else else
chan = chip->dma.rx_chan; chan = chip->dma.rx_chan;
@ -133,7 +133,7 @@ static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
return PTR_ERR(cdesc); return PTR_ERR(cdesc);
} }
if (direction == DMA_TO_DEVICE) { if (direction == DMA_MEM_TO_DEV) {
cdesc->period_callback = atmel_ac97c_dma_playback_period_done; cdesc->period_callback = atmel_ac97c_dma_playback_period_done;
set_bit(DMA_TX_READY, &chip->flags); set_bit(DMA_TX_READY, &chip->flags);
} else { } else {
@ -393,7 +393,7 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream)
if (cpu_is_at32ap7000()) { if (cpu_is_at32ap7000()) {
if (!test_bit(DMA_TX_READY, &chip->flags)) if (!test_bit(DMA_TX_READY, &chip->flags))
retval = atmel_ac97c_prepare_dma(chip, substream, retval = atmel_ac97c_prepare_dma(chip, substream,
DMA_TO_DEVICE); DMA_MEM_TO_DEV);
} else { } else {
/* Initialize and start the PDC */ /* Initialize and start the PDC */
writel(runtime->dma_addr, chip->regs + ATMEL_PDC_TPR); 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 (cpu_is_at32ap7000()) {
if (!test_bit(DMA_RX_READY, &chip->flags)) if (!test_bit(DMA_RX_READY, &chip->flags))
retval = atmel_ac97c_prepare_dma(chip, substream, retval = atmel_ac97c_prepare_dma(chip, substream,
DMA_FROM_DEVICE); DMA_DEV_TO_MEM);
} else { } else {
/* Initialize and start the PDC */ /* Initialize and start the PDC */
writel(runtime->dma_addr, chip->regs + ATMEL_PDC_RPR); writel(runtime->dma_addr, chip->regs + ATMEL_PDC_RPR);

View File

@ -113,9 +113,9 @@ static int ep93xx_pcm_open(struct snd_pcm_substream *substream)
rtd->dma_data.name = dma_params->name; rtd->dma_data.name = dma_params->name;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
rtd->dma_data.direction = DMA_TO_DEVICE; rtd->dma_data.direction = DMA_MEM_TO_DEV;
else else
rtd->dma_data.direction = DMA_FROM_DEVICE; rtd->dma_data.direction = DMA_DEV_TO_MEM;
rtd->dma_chan = dma_request_channel(mask, ep93xx_pcm_dma_filter, rtd->dma_chan = dma_request_channel(mask, ep93xx_pcm_dma_filter,
&rtd->dma_data); &rtd->dma_data);

View File

@ -107,12 +107,12 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
} }
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
slave_config.direction = DMA_TO_DEVICE; slave_config.direction = DMA_MEM_TO_DEV;
slave_config.dst_addr = dma_params->dma_addr; slave_config.dst_addr = dma_params->dma_addr;
slave_config.dst_addr_width = buswidth; slave_config.dst_addr_width = buswidth;
slave_config.dst_maxburst = dma_params->burstsize; slave_config.dst_maxburst = dma_params->burstsize;
} else { } else {
slave_config.direction = DMA_FROM_DEVICE; slave_config.direction = DMA_DEV_TO_MEM;
slave_config.src_addr = dma_params->dma_addr; slave_config.src_addr = dma_params->dma_addr;
slave_config.src_addr_width = buswidth; slave_config.src_addr_width = buswidth;
slave_config.src_maxburst = dma_params->burstsize; 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 * iprtd->periods,
iprtd->period_bytes, iprtd->period_bytes,
substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
DMA_TO_DEVICE : DMA_FROM_DEVICE); DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
if (!iprtd->desc) { if (!iprtd->desc) {
dev_err(&chan->dev->device, "cannot prepare slave dma\n"); dev_err(&chan->dev->device, "cannot prepare slave dma\n");
return -EINVAL; return -EINVAL;

View File

@ -86,7 +86,7 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE); dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
dma_info.direction = dma_info.direction =
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
? DMA_TO_DEVICE : DMA_FROM_DEVICE); ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
dma_info.fp = audio_buffdone; dma_info.fp = audio_buffdone;
dma_info.fp_param = substream; dma_info.fp_param = substream;
dma_info.period = prtd->dma_period; dma_info.period = prtd->dma_period;
@ -171,7 +171,7 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
dma_info.client = prtd->params->client; dma_info.client = prtd->params->client;
dma_info.direction = dma_info.direction =
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
? DMA_TO_DEVICE : DMA_FROM_DEVICE); ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
dma_info.width = prtd->params->dma_size; dma_info.width = prtd->params->dma_size;
dma_info.fifo = prtd->params->dma_addr; dma_info.fifo = prtd->params->dma_addr;
prtd->params->ch = prtd->params->ops->request( prtd->params->ch = prtd->params->ops->request(

View File

@ -131,7 +131,7 @@ static int siu_pcm_wr_set(struct siu_port *port_info,
sg_dma_address(&sg) = buff; sg_dma_address(&sg) = buff;
desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan, 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, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
dev_err(dev, "Failed to allocate a dma descriptor\n"); dev_err(dev, "Failed to allocate a dma descriptor\n");
return -ENOMEM; return -ENOMEM;
@ -181,7 +181,7 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
sg_dma_address(&sg) = buff; sg_dma_address(&sg) = buff;
desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan, 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, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
dev_err(dev, "Failed to allocate dma descriptor\n"); dev_err(dev, "Failed to allocate dma descriptor\n");
return -ENOMEM; return -ENOMEM;

View File

@ -134,7 +134,7 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)
sg_dma_address(&sg) = buf_dma_addr; sg_dma_address(&sg) = buf_dma_addr;
desc = chan->device->device_prep_slave_sg(chan, &sg, 1, desc = chan->device->device_prep_slave_sg(chan, &sg, 1,
dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
DMA_TO_DEVICE : DMA_FROM_DEVICE, DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK); DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) { if (!desc) {
dev_err(&chan->dev->device, "cannot prepare slave dma\n"); dev_err(&chan->dev->device, "cannot prepare slave dma\n");