diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-05-16 06:02:40 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-07-01 09:15:42 -0400 |
commit | ed91c13d29d1542fddbb053015d62781faca93e1 (patch) | |
tree | 366b3ed2b91ac1a791221818a8878231e8fd3f02 | |
parent | 550ec36f507177470a394c4dfffcaf986ca25818 (diff) |
dmaengine: PL08x: get src/dst addr direct from dma_slave_config struct
Add a dma_slave_config struct to struct pl08x_dma_chan, and move the
src_addr/dst_addr arguments into this struct. This is a step away
from using the dma_slave_config's direction member.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/dma/amba-pl08x.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 775efef0349c..31447dbe23a6 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -239,8 +239,7 @@ struct pl08x_dma_chan { | |||
239 | struct tasklet_struct tasklet; | 239 | struct tasklet_struct tasklet; |
240 | const char *name; | 240 | const char *name; |
241 | const struct pl08x_channel_data *cd; | 241 | const struct pl08x_channel_data *cd; |
242 | dma_addr_t src_addr; | 242 | struct dma_slave_config cfg; |
243 | dma_addr_t dst_addr; | ||
244 | u32 src_cctl; | 243 | u32 src_cctl; |
245 | u32 dst_cctl; | 244 | u32 dst_cctl; |
246 | enum dma_transfer_direction runtime_direction; | 245 | enum dma_transfer_direction runtime_direction; |
@@ -1245,6 +1244,8 @@ static int dma_set_runtime_config(struct dma_chan *chan, | |||
1245 | return -EINVAL; | 1244 | return -EINVAL; |
1246 | } | 1245 | } |
1247 | 1246 | ||
1247 | plchan->cfg = *config; | ||
1248 | |||
1248 | cctl |= width << PL080_CONTROL_SWIDTH_SHIFT; | 1249 | cctl |= width << PL080_CONTROL_SWIDTH_SHIFT; |
1249 | cctl |= width << PL080_CONTROL_DWIDTH_SHIFT; | 1250 | cctl |= width << PL080_CONTROL_DWIDTH_SHIFT; |
1250 | 1251 | ||
@@ -1263,12 +1264,10 @@ static int dma_set_runtime_config(struct dma_chan *chan, | |||
1263 | plchan->device_fc = config->device_fc; | 1264 | plchan->device_fc = config->device_fc; |
1264 | 1265 | ||
1265 | if (plchan->runtime_direction == DMA_DEV_TO_MEM) { | 1266 | if (plchan->runtime_direction == DMA_DEV_TO_MEM) { |
1266 | plchan->src_addr = config->src_addr; | ||
1267 | plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR | | 1267 | plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR | |
1268 | pl08x_select_bus(plchan->cd->periph_buses, | 1268 | pl08x_select_bus(plchan->cd->periph_buses, |
1269 | pl08x->mem_buses); | 1269 | pl08x->mem_buses); |
1270 | } else { | 1270 | } else { |
1271 | plchan->dst_addr = config->dst_addr; | ||
1272 | plchan->dst_cctl = pl08x_cctl(cctl) | PL080_CONTROL_SRC_INCR | | 1271 | plchan->dst_cctl = pl08x_cctl(cctl) | PL080_CONTROL_SRC_INCR | |
1273 | pl08x_select_bus(pl08x->mem_buses, | 1272 | pl08x_select_bus(pl08x->mem_buses, |
1274 | plchan->cd->periph_buses); | 1273 | plchan->cd->periph_buses); |
@@ -1482,10 +1481,10 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg( | |||
1482 | 1481 | ||
1483 | if (direction == DMA_MEM_TO_DEV) { | 1482 | if (direction == DMA_MEM_TO_DEV) { |
1484 | txd->cctl = plchan->dst_cctl; | 1483 | txd->cctl = plchan->dst_cctl; |
1485 | slave_addr = plchan->dst_addr; | 1484 | slave_addr = plchan->cfg.dst_addr; |
1486 | } else if (direction == DMA_DEV_TO_MEM) { | 1485 | } else if (direction == DMA_DEV_TO_MEM) { |
1487 | txd->cctl = plchan->src_cctl; | 1486 | txd->cctl = plchan->src_cctl; |
1488 | slave_addr = plchan->src_addr; | 1487 | slave_addr = plchan->cfg.src_addr; |
1489 | } else { | 1488 | } else { |
1490 | pl08x_free_txd(pl08x, txd); | 1489 | pl08x_free_txd(pl08x, txd); |
1491 | dev_err(&pl08x->adev->dev, | 1490 | dev_err(&pl08x->adev->dev, |
@@ -1790,8 +1789,8 @@ static void pl08x_dma_slave_init(struct pl08x_dma_chan *chan) | |||
1790 | 1789 | ||
1791 | chan->slave = true; | 1790 | chan->slave = true; |
1792 | chan->name = chan->cd->bus_id; | 1791 | chan->name = chan->cd->bus_id; |
1793 | chan->src_addr = chan->cd->addr; | 1792 | chan->cfg.src_addr = chan->cd->addr; |
1794 | chan->dst_addr = chan->cd->addr; | 1793 | chan->cfg.dst_addr = chan->cd->addr; |
1795 | chan->src_cctl = cctl | PL080_CONTROL_DST_INCR | | 1794 | chan->src_cctl = cctl | PL080_CONTROL_DST_INCR | |
1796 | pl08x_select_bus(chan->cd->periph_buses, chan->host->mem_buses); | 1795 | pl08x_select_bus(chan->cd->periph_buses, chan->host->mem_buses); |
1797 | chan->dst_cctl = cctl | PL080_CONTROL_SRC_INCR | | 1796 | chan->dst_cctl = cctl | PL080_CONTROL_SRC_INCR | |