Skip to content

Commit

Permalink
dmaengine: PL08x: move the bus and increment selection to dma prepare…
Browse files Browse the repository at this point in the history
… function

Move the bus and transfer increment selection to the DMA prepare
function rather than the slave configuration function.

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>
  • Loading branch information
Russell King committed Jul 1, 2012
1 parent 95442b2 commit 409ec8d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions drivers/dma/amba-pl08x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1258,13 +1258,9 @@ static int dma_set_runtime_config(struct dma_chan *chan,
cctl |= burst << PL080_CONTROL_DB_SIZE_SHIFT;

if (plchan->runtime_direction == DMA_DEV_TO_MEM) {
plchan->src_cctl = pl08x_cctl(cctl) | PL080_CONTROL_DST_INCR |
pl08x_select_bus(plchan->cd->periph_buses,
pl08x->mem_buses);
plchan->src_cctl = pl08x_cctl(cctl);
} else {
plchan->dst_cctl = pl08x_cctl(cctl) | PL080_CONTROL_SRC_INCR |
pl08x_select_bus(pl08x->mem_buses,
plchan->cd->periph_buses);
plchan->dst_cctl = pl08x_cctl(cctl);
}

dev_dbg(&pl08x->adev->dev,
Expand Down Expand Up @@ -1451,6 +1447,8 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
struct scatterlist *sg;
dma_addr_t slave_addr;
int ret, tmp;
u8 src_buses, dst_buses;
u32 cctl;

dev_dbg(&pl08x->adev->dev, "%s prepare transaction of %d bytes from %s\n",
__func__, sg_dma_len(sgl), plchan->name);
Expand All @@ -1474,18 +1472,24 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
txd->direction = direction;

if (direction == DMA_MEM_TO_DEV) {
txd->cctl = plchan->dst_cctl;
cctl = plchan->dst_cctl | PL080_CONTROL_SRC_INCR;
slave_addr = plchan->cfg.dst_addr;
src_buses = pl08x->mem_buses;
dst_buses = plchan->cd->periph_buses;
} else if (direction == DMA_DEV_TO_MEM) {
txd->cctl = plchan->src_cctl;
cctl = plchan->src_cctl | PL080_CONTROL_DST_INCR;
slave_addr = plchan->cfg.src_addr;
src_buses = plchan->cd->periph_buses;
dst_buses = pl08x->mem_buses;
} else {
pl08x_free_txd(pl08x, txd);
dev_err(&pl08x->adev->dev,
"%s direction unsupported\n", __func__);
return NULL;
}

txd->cctl = cctl | pl08x_select_bus(src_buses, dst_buses);

if (plchan->cfg.device_fc)
tmp = (direction == DMA_MEM_TO_DEV) ? PL080_FLOW_MEM2PER_PER :
PL080_FLOW_PER2MEM_PER;
Expand Down Expand Up @@ -1785,10 +1789,8 @@ static void pl08x_dma_slave_init(struct pl08x_dma_chan *chan)
chan->name = chan->cd->bus_id;
chan->cfg.src_addr = chan->cd->addr;
chan->cfg.dst_addr = chan->cd->addr;
chan->src_cctl = cctl | PL080_CONTROL_DST_INCR |
pl08x_select_bus(chan->cd->periph_buses, chan->host->mem_buses);
chan->dst_cctl = cctl | PL080_CONTROL_SRC_INCR |
pl08x_select_bus(chan->host->mem_buses, chan->cd->periph_buses);
chan->src_cctl = cctl;
chan->dst_cctl = cctl;
}

/*
Expand Down

0 comments on commit 409ec8d

Please sign in to comment.