Skip to content

Commit db8196d

Browse files
author
Vinod Koul
committed
dmaengine: move drivers to dma_transfer_direction
fixup usage of dma direction by introducing dma_transfer_direction, this patch moves dma/drivers/* to use new enum Cc: Jassi Brar <jaswinder.singh@linaro.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Viresh Kumar <viresh.kumar@st.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Mika Westerberg <mika.westerberg@iki.fi> Cc: H Hartley Sweeten <hartleys@visionengravers.com> Cc: Li Yang <leoli@freescale.com> Cc: Zhang Wei <zw@zh-kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Shawn Guo <shawn.guo@freescale.com> Cc: Yong Wang <yong.y.wang@intel.com> Cc: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com> Cc: Boojin Kim <boojin.kim@samsung.com> Cc: Barry Song <Baohua.Song@csr.com> Acked-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
1 parent 49920bc commit db8196d

25 files changed

Lines changed: 150 additions & 152 deletions

‎arch/arm/mach-ep93xx/include/mach/dma.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
struct ep93xx_dma_data {
3939
int port;
40-
enum dma_data_direction direction;
40+
enum dma_transfer_direction direction;
4141
const char *name;
4242
};
4343

@@ -80,14 +80,14 @@ static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan)
8080
* channel supports given DMA direction. Only M2P channels have such
8181
* limitation, for M2M channels the direction is configurable.
8282
*/
83-
static inline enum dma_data_direction
83+
static inline enum dma_transfer_direction
8484
ep93xx_dma_chan_direction(struct dma_chan *chan)
8585
{
8686
if (!ep93xx_dma_chan_is_m2p(chan))
8787
return DMA_NONE;
8888

8989
/* even channels are for TX, odd for RX */
90-
return (chan->chan_id % 2 == 0) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
90+
return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
9191
}
9292

9393
#endif /* __ASM_ARCH_DMA_H */

‎arch/arm/plat-nomadik/include/plat/ste_dma40.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static inline struct
187187
dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
188188
dma_addr_t addr,
189189
unsigned int size,
190-
enum dma_data_direction direction,
190+
enum dma_transfer_direction direction,
191191
unsigned long flags)
192192
{
193193
struct scatterlist sg;
@@ -209,7 +209,7 @@ static inline struct
209209
dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
210210
dma_addr_t addr,
211211
unsigned int size,
212-
enum dma_data_direction direction,
212+
enum dma_transfer_direction direction,
213213
unsigned long flags)
214214
{
215215
return NULL;

‎drivers/dma/amba-pl08x.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -882,9 +882,9 @@ static int prep_phy_channel(struct pl08x_dma_chan *plchan,
882882
ch->signal = ret;
883883

884884
/* Assign the flow control signal to this channel */
885-
if (txd->direction == DMA_TO_DEVICE)
885+
if (txd->direction == DMA_MEM_TO_DEV)
886886
txd->ccfg |= ch->signal << PL080_CONFIG_DST_SEL_SHIFT;
887-
else if (txd->direction == DMA_FROM_DEVICE)
887+
else if (txd->direction == DMA_DEV_TO_MEM)
888888
txd->ccfg |= ch->signal << PL080_CONFIG_SRC_SEL_SHIFT;
889889
}
890890

@@ -1102,10 +1102,10 @@ static int dma_set_runtime_config(struct dma_chan *chan,
11021102

11031103
/* Transfer direction */
11041104
plchan->runtime_direction = config->direction;
1105-
if (config->direction == DMA_TO_DEVICE) {
1105+
if (config->direction == DMA_MEM_TO_DEV) {
11061106
addr_width = config->dst_addr_width;
11071107
maxburst = config->dst_maxburst;
1108-
} else if (config->direction == DMA_FROM_DEVICE) {
1108+
} else if (config->direction == DMA_DEV_TO_MEM) {
11091109
addr_width = config->src_addr_width;
11101110
maxburst = config->src_maxburst;
11111111
} else {
@@ -1136,7 +1136,7 @@ static int dma_set_runtime_config(struct dma_chan *chan,
11361136
cctl |= burst << PL080_CONTROL_SB_SIZE_SHIFT;
11371137
cctl |= burst << PL080_CONTROL_DB_SIZE_SHIFT;
11381138

1139-
if (plchan->runtime_direction == DMA_FROM_DEVICE) {
1139+
if (plchan->runtime_direction == DMA_DEV_TO_MEM) {
11401140
plchan->src_addr = config->src_addr;
11411141
plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR |
11421142
pl08x_select_bus(plchan->cd->periph_buses,
@@ -1152,7 +1152,7 @@ static int dma_set_runtime_config(struct dma_chan *chan,
11521152
"configured channel %s (%s) for %s, data width %d, "
11531153
"maxburst %d words, LE, CCTL=0x%08x\n",
11541154
dma_chan_name(chan), plchan->name,
1155-
(config->direction == DMA_FROM_DEVICE) ? "RX" : "TX",
1155+
(config->direction == DMA_DEV_TO_MEM) ? "RX" : "TX",
11561156
addr_width,
11571157
maxburst,
11581158
cctl);
@@ -1322,7 +1322,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
13221322

13231323
static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
13241324
struct dma_chan *chan, struct scatterlist *sgl,
1325-
unsigned int sg_len, enum dma_data_direction direction,
1325+
unsigned int sg_len, enum dma_transfer_direction direction,
13261326
unsigned long flags)
13271327
{
13281328
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
@@ -1354,10 +1354,10 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
13541354
*/
13551355
txd->direction = direction;
13561356

1357-
if (direction == DMA_TO_DEVICE) {
1357+
if (direction == DMA_MEM_TO_DEV) {
13581358
txd->cctl = plchan->dst_cctl;
13591359
slave_addr = plchan->dst_addr;
1360-
} else if (direction == DMA_FROM_DEVICE) {
1360+
} else if (direction == DMA_DEV_TO_MEM) {
13611361
txd->cctl = plchan->src_cctl;
13621362
slave_addr = plchan->src_addr;
13631363
} else {
@@ -1368,10 +1368,10 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
13681368
}
13691369

13701370
if (plchan->cd->device_fc)
1371-
tmp = (direction == DMA_TO_DEVICE) ? PL080_FLOW_MEM2PER_PER :
1371+
tmp = (direction == DMA_MEM_TO_DEV) ? PL080_FLOW_MEM2PER_PER :
13721372
PL080_FLOW_PER2MEM_PER;
13731373
else
1374-
tmp = (direction == DMA_TO_DEVICE) ? PL080_FLOW_MEM2PER :
1374+
tmp = (direction == DMA_MEM_TO_DEV) ? PL080_FLOW_MEM2PER :
13751375
PL080_FLOW_PER2MEM;
13761376

13771377
txd->ccfg |= tmp << PL080_CONFIG_FLOW_CONTROL_SHIFT;
@@ -1387,7 +1387,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
13871387
list_add_tail(&dsg->node, &txd->dsg_list);
13881388

13891389
dsg->len = sg_dma_len(sg);
1390-
if (direction == DMA_TO_DEVICE) {
1390+
if (direction == DMA_MEM_TO_DEV) {
13911391
dsg->src_addr = sg_phys(sg);
13921392
dsg->dst_addr = slave_addr;
13931393
} else {

‎drivers/dma/at_hdmac.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
660660
*/
661661
static struct dma_async_tx_descriptor *
662662
atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
663-
unsigned int sg_len, enum dma_data_direction direction,
663+
unsigned int sg_len, enum dma_transfer_direction direction,
664664
unsigned long flags)
665665
{
666666
struct at_dma_chan *atchan = to_at_dma_chan(chan);
@@ -678,7 +678,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
678678

679679
dev_vdbg(chan2dev(chan), "prep_slave_sg (%d): %s f0x%lx\n",
680680
sg_len,
681-
direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE",
681+
direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
682682
flags);
683683

684684
if (unlikely(!atslave || !sg_len)) {
@@ -692,7 +692,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
692692
ctrlb = ATC_IEN;
693693

694694
switch (direction) {
695-
case DMA_TO_DEVICE:
695+
case DMA_MEM_TO_DEV:
696696
ctrla |= ATC_DST_WIDTH(reg_width);
697697
ctrlb |= ATC_DST_ADDR_MODE_FIXED
698698
| ATC_SRC_ADDR_MODE_INCR
@@ -725,7 +725,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
725725
total_len += len;
726726
}
727727
break;
728-
case DMA_FROM_DEVICE:
728+
case DMA_DEV_TO_MEM:
729729
ctrla |= ATC_SRC_WIDTH(reg_width);
730730
ctrlb |= ATC_DST_ADDR_MODE_INCR
731731
| ATC_SRC_ADDR_MODE_FIXED
@@ -787,15 +787,15 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
787787
*/
788788
static int
789789
atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
790-
size_t period_len, enum dma_data_direction direction)
790+
size_t period_len, enum dma_transfer_direction direction)
791791
{
792792
if (period_len > (ATC_BTSIZE_MAX << reg_width))
793793
goto err_out;
794794
if (unlikely(period_len & ((1 << reg_width) - 1)))
795795
goto err_out;
796796
if (unlikely(buf_addr & ((1 << reg_width) - 1)))
797797
goto err_out;
798-
if (unlikely(!(direction & (DMA_TO_DEVICE | DMA_FROM_DEVICE))))
798+
if (unlikely(!(direction & (DMA_DEV_TO_MEM | DMA_MEM_TO_DEV))))
799799
goto err_out;
800800

801801
return 0;
@@ -810,7 +810,7 @@ atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr,
810810
static int
811811
atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
812812
unsigned int period_index, dma_addr_t buf_addr,
813-
size_t period_len, enum dma_data_direction direction)
813+
size_t period_len, enum dma_transfer_direction direction)
814814
{
815815
u32 ctrla;
816816
unsigned int reg_width = atslave->reg_width;
@@ -822,7 +822,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
822822
| period_len >> reg_width;
823823

824824
switch (direction) {
825-
case DMA_TO_DEVICE:
825+
case DMA_MEM_TO_DEV:
826826
desc->lli.saddr = buf_addr + (period_len * period_index);
827827
desc->lli.daddr = atslave->tx_reg;
828828
desc->lli.ctrla = ctrla;
@@ -833,7 +833,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
833833
| ATC_DIF(AT_DMA_PER_IF);
834834
break;
835835

836-
case DMA_FROM_DEVICE:
836+
case DMA_DEV_TO_MEM:
837837
desc->lli.saddr = atslave->rx_reg;
838838
desc->lli.daddr = buf_addr + (period_len * period_index);
839839
desc->lli.ctrla = ctrla;
@@ -861,7 +861,7 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
861861
*/
862862
static struct dma_async_tx_descriptor *
863863
atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
864-
size_t period_len, enum dma_data_direction direction)
864+
size_t period_len, enum dma_transfer_direction direction)
865865
{
866866
struct at_dma_chan *atchan = to_at_dma_chan(chan);
867867
struct at_dma_slave *atslave = chan->private;
@@ -872,7 +872,7 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
872872
unsigned int i;
873873

874874
dev_vdbg(chan2dev(chan), "prep_dma_cyclic: %s buf@0x%08x - %d (%d/%d)\n",
875-
direction == DMA_TO_DEVICE ? "TO DEVICE" : "FROM DEVICE",
875+
direction == DMA_MEM_TO_DEV ? "TO DEVICE" : "FROM DEVICE",
876876
buf_addr,
877877
periods, buf_len, period_len);
878878

‎drivers/dma/coh901318.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct coh901318_desc {
3939
struct scatterlist *sg;
4040
unsigned int sg_len;
4141
struct coh901318_lli *lli;
42-
enum dma_data_direction dir;
42+
enum dma_transfer_direction dir;
4343
unsigned long flags;
4444
u32 head_config;
4545
u32 head_ctrl;
@@ -1034,7 +1034,7 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
10341034

10351035
static struct dma_async_tx_descriptor *
10361036
coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
1037-
unsigned int sg_len, enum dma_data_direction direction,
1037+
unsigned int sg_len, enum dma_transfer_direction direction,
10381038
unsigned long flags)
10391039
{
10401040
struct coh901318_chan *cohc = to_coh901318_chan(chan);
@@ -1077,15 +1077,15 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
10771077
ctrl_last |= cohc->runtime_ctrl;
10781078
ctrl |= cohc->runtime_ctrl;
10791079

1080-
if (direction == DMA_TO_DEVICE) {
1080+
if (direction == DMA_MEM_TO_DEV) {
10811081
u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE |
10821082
COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE;
10831083

10841084
config |= COH901318_CX_CFG_RM_MEMORY_TO_PRIMARY;
10851085
ctrl_chained |= tx_flags;
10861086
ctrl_last |= tx_flags;
10871087
ctrl |= tx_flags;
1088-
} else if (direction == DMA_FROM_DEVICE) {
1088+
} else if (direction == DMA_DEV_TO_MEM) {
10891089
u32 rx_flags = COH901318_CX_CTRL_PRDD_DEST |
10901090
COH901318_CX_CTRL_DST_ADDR_INC_ENABLE;
10911091

@@ -1274,11 +1274,11 @@ static void coh901318_dma_set_runtimeconfig(struct dma_chan *chan,
12741274
int i = 0;
12751275

12761276
/* We only support mem to per or per to mem transfers */
1277-
if (config->direction == DMA_FROM_DEVICE) {
1277+
if (config->direction == DMA_DEV_TO_MEM) {
12781278
addr = config->src_addr;
12791279
addr_width = config->src_addr_width;
12801280
maxburst = config->src_maxburst;
1281-
} else if (config->direction == DMA_TO_DEVICE) {
1281+
} else if (config->direction == DMA_MEM_TO_DEV) {
12821282
addr = config->dst_addr;
12831283
addr_width = config->dst_addr_width;
12841284
maxburst = config->dst_maxburst;

‎drivers/dma/coh901318_lli.c‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
* Author: Per Friden <per.friden@stericsson.com>
88
*/
99

10-
#include <linux/dma-mapping.h>
1110
#include <linux/spinlock.h>
12-
#include <linux/dmapool.h>
1311
#include <linux/memory.h>
1412
#include <linux/gfp.h>
13+
#include <linux/dmapool.h>
1514
#include <mach/coh901318.h>
1615

1716
#include "coh901318_lli.h"
@@ -177,18 +176,18 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
177176
struct coh901318_lli *lli,
178177
dma_addr_t buf, unsigned int size,
179178
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_eom,
180-
enum dma_data_direction dir)
179+
enum dma_transfer_direction dir)
181180
{
182181
int s = size;
183182
dma_addr_t src;
184183
dma_addr_t dst;
185184

186185

187-
if (dir == DMA_TO_DEVICE) {
186+
if (dir == DMA_MEM_TO_DEV) {
188187
src = buf;
189188
dst = dev_addr;
190189

191-
} else if (dir == DMA_FROM_DEVICE) {
190+
} else if (dir == DMA_DEV_TO_MEM) {
192191

193192
src = dev_addr;
194193
dst = buf;
@@ -215,9 +214,9 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
215214

216215
lli = coh901318_lli_next(lli);
217216

218-
if (dir == DMA_TO_DEVICE)
217+
if (dir == DMA_MEM_TO_DEV)
219218
src += block_size;
220-
else if (dir == DMA_FROM_DEVICE)
219+
else if (dir == DMA_DEV_TO_MEM)
221220
dst += block_size;
222221
}
223222

@@ -234,7 +233,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
234233
struct scatterlist *sgl, unsigned int nents,
235234
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl,
236235
u32 ctrl_last,
237-
enum dma_data_direction dir, u32 ctrl_irq_mask)
236+
enum dma_transfer_direction dir, u32 ctrl_irq_mask)
238237
{
239238
int i;
240239
struct scatterlist *sg;
@@ -249,9 +248,9 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
249248

250249
spin_lock(&pool->lock);
251250

252-
if (dir == DMA_TO_DEVICE)
251+
if (dir == DMA_MEM_TO_DEV)
253252
dst = dev_addr;
254-
else if (dir == DMA_FROM_DEVICE)
253+
else if (dir == DMA_DEV_TO_MEM)
255254
src = dev_addr;
256255
else
257256
goto err;
@@ -269,7 +268,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
269268
ctrl_sg = ctrl ? ctrl : ctrl_last;
270269

271270

272-
if (dir == DMA_TO_DEVICE)
271+
if (dir == DMA_MEM_TO_DEV)
273272
/* increment source address */
274273
src = sg_phys(sg);
275274
else
@@ -293,7 +292,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
293292
lli->src_addr = src;
294293
lli->dst_addr = dst;
295294

296-
if (dir == DMA_FROM_DEVICE)
295+
if (dir == DMA_DEV_TO_MEM)
297296
dst += elem_size;
298297
else
299298
src += elem_size;

‎drivers/dma/coh901318_lli.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
9797
struct coh901318_lli *lli,
9898
dma_addr_t buf, unsigned int size,
9999
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_last,
100-
enum dma_data_direction dir);
100+
enum dma_transfer_direction dir);
101101

102102
/**
103103
* 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,
119119
struct scatterlist *sg, unsigned int nents,
120120
dma_addr_t dev_addr, u32 ctrl_chained,
121121
u32 ctrl, u32 ctrl_last,
122-
enum dma_data_direction dir, u32 ctrl_irq_mask);
122+
enum dma_transfer_direction dir, u32 ctrl_irq_mask);
123123

124124
#endif /* COH901318_LLI_H */

0 commit comments

Comments
 (0)