diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2011-01-03 17:40:53 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-01-04 22:16:13 -0500 |
commit | c7da9a56d608145cc763bcfc9329b92c4244d8d9 (patch) | |
tree | 2e85075b24b15bc3e252f0295099ad8649c77ade /drivers/dma/amba-pl08x.c | |
parent | 1cae78f12028eebdc9107eaf168add46e66fb3f8 (diff) |
ARM: PL08x: move AHB master port selection into prep_* functions
As we initialize the default cctl value in the prep_* functions along
with the increment settings, we don't need to repeat the selection of
the AHB ports each time we create a LLI entry. Do this in the prep_*
functions once per transfer.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/amba-pl08x.c')
-rw-r--r-- | drivers/dma/amba-pl08x.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 72cc971e93e5..4ee0ab19b1b6 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -597,26 +597,6 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x, | |||
597 | /* Get the default CCTL */ | 597 | /* Get the default CCTL */ |
598 | cctl = txd->cctl; | 598 | cctl = txd->cctl; |
599 | 599 | ||
600 | /* | ||
601 | * On the PL080 we have two bus masters and we | ||
602 | * should select one for source and one for | ||
603 | * destination. We try to use AHB2 for the | ||
604 | * bus which does not increment (typically the | ||
605 | * peripheral) else we just choose something. | ||
606 | */ | ||
607 | cctl &= ~(PL080_CONTROL_DST_AHB2 | PL080_CONTROL_SRC_AHB2); | ||
608 | if (pl08x->vd->dualmaster) { | ||
609 | if (cctl & PL080_CONTROL_SRC_INCR) | ||
610 | /* Source increments, use AHB2 for destination */ | ||
611 | cctl |= PL080_CONTROL_DST_AHB2; | ||
612 | else if (cctl & PL080_CONTROL_DST_INCR) | ||
613 | /* Destination increments, use AHB2 for source */ | ||
614 | cctl |= PL080_CONTROL_SRC_AHB2; | ||
615 | else | ||
616 | /* Just pick something, source AHB1 dest AHB2 */ | ||
617 | cctl |= PL080_CONTROL_DST_AHB2; | ||
618 | } | ||
619 | |||
620 | /* Find maximum width of the source bus */ | 600 | /* Find maximum width of the source bus */ |
621 | txd->srcbus.maxwidth = | 601 | txd->srcbus.maxwidth = |
622 | pl08x_get_bytes_for_cctl((cctl & PL080_CONTROL_SWIDTH_MASK) >> | 602 | pl08x_get_bytes_for_cctl((cctl & PL080_CONTROL_SWIDTH_MASK) >> |
@@ -1340,14 +1320,25 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy( | |||
1340 | txd->direction = DMA_NONE; | 1320 | txd->direction = DMA_NONE; |
1341 | txd->srcbus.addr = src; | 1321 | txd->srcbus.addr = src; |
1342 | txd->dstbus.addr = dest; | 1322 | txd->dstbus.addr = dest; |
1323 | txd->len = len; | ||
1343 | 1324 | ||
1344 | /* Set platform data for m2m */ | 1325 | /* Set platform data for m2m */ |
1345 | txd->ccfg |= PL080_FLOW_MEM2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; | 1326 | txd->ccfg |= PL080_FLOW_MEM2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; |
1346 | txd->cctl = pl08x->pd->memcpy_channel.cctl; | 1327 | txd->cctl = pl08x->pd->memcpy_channel.cctl & |
1328 | ~(PL080_CONTROL_DST_AHB2 | PL080_CONTROL_SRC_AHB2); | ||
1347 | 1329 | ||
1348 | /* Both to be incremented or the code will break */ | 1330 | /* Both to be incremented or the code will break */ |
1349 | txd->cctl |= PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR; | 1331 | txd->cctl |= PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR; |
1350 | txd->len = len; | 1332 | |
1333 | /* | ||
1334 | * On the PL080 we have two bus masters and we should select one for | ||
1335 | * source and one for destination. We try to use AHB2 for the bus | ||
1336 | * which does not increment (typically the peripheral) else we just | ||
1337 | * choose something. | ||
1338 | */ | ||
1339 | if (pl08x->vd->dualmaster) | ||
1340 | /* Source increments, use AHB2 for destination */ | ||
1341 | txd->cctl |= PL080_CONTROL_DST_AHB2; | ||
1351 | 1342 | ||
1352 | ret = pl08x_prep_channel_resources(plchan, txd); | 1343 | ret = pl08x_prep_channel_resources(plchan, txd); |
1353 | if (ret) | 1344 | if (ret) |
@@ -1399,8 +1390,11 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg( | |||
1399 | * channel target address dynamically at runtime. | 1390 | * channel target address dynamically at runtime. |
1400 | */ | 1391 | */ |
1401 | txd->direction = direction; | 1392 | txd->direction = direction; |
1393 | txd->len = sgl->length; | ||
1394 | |||
1402 | txd->cctl = plchan->cd->cctl & | 1395 | txd->cctl = plchan->cd->cctl & |
1403 | ~(PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR | | 1396 | ~(PL080_CONTROL_SRC_AHB2 | PL080_CONTROL_DST_AHB2 | |
1397 | PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR | | ||
1404 | PL080_CONTROL_PROT_MASK); | 1398 | PL080_CONTROL_PROT_MASK); |
1405 | 1399 | ||
1406 | /* Access the cell in privileged mode, non-bufferable, non-cacheable */ | 1400 | /* Access the cell in privileged mode, non-bufferable, non-cacheable */ |
@@ -1409,6 +1403,9 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg( | |||
1409 | if (direction == DMA_TO_DEVICE) { | 1403 | if (direction == DMA_TO_DEVICE) { |
1410 | txd->ccfg |= PL080_FLOW_MEM2PER << PL080_CONFIG_FLOW_CONTROL_SHIFT; | 1404 | txd->ccfg |= PL080_FLOW_MEM2PER << PL080_CONFIG_FLOW_CONTROL_SHIFT; |
1411 | txd->cctl |= PL080_CONTROL_SRC_INCR; | 1405 | txd->cctl |= PL080_CONTROL_SRC_INCR; |
1406 | if (pl08x->vd->dualmaster) | ||
1407 | /* Source increments, use AHB2 for destination */ | ||
1408 | txd->cctl |= PL080_CONTROL_DST_AHB2; | ||
1412 | txd->srcbus.addr = sgl->dma_address; | 1409 | txd->srcbus.addr = sgl->dma_address; |
1413 | if (plchan->runtime_addr) | 1410 | if (plchan->runtime_addr) |
1414 | txd->dstbus.addr = plchan->runtime_addr; | 1411 | txd->dstbus.addr = plchan->runtime_addr; |
@@ -1417,6 +1414,9 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg( | |||
1417 | } else if (direction == DMA_FROM_DEVICE) { | 1414 | } else if (direction == DMA_FROM_DEVICE) { |
1418 | txd->ccfg |= PL080_FLOW_PER2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; | 1415 | txd->ccfg |= PL080_FLOW_PER2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; |
1419 | txd->cctl |= PL080_CONTROL_DST_INCR; | 1416 | txd->cctl |= PL080_CONTROL_DST_INCR; |
1417 | if (pl08x->vd->dualmaster) | ||
1418 | /* Destination increments, use AHB2 for source */ | ||
1419 | txd->cctl |= PL080_CONTROL_SRC_AHB2; | ||
1420 | if (plchan->runtime_addr) | 1420 | if (plchan->runtime_addr) |
1421 | txd->srcbus.addr = plchan->runtime_addr; | 1421 | txd->srcbus.addr = plchan->runtime_addr; |
1422 | else | 1422 | else |
@@ -1427,7 +1427,6 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg( | |||
1427 | "%s direction unsupported\n", __func__); | 1427 | "%s direction unsupported\n", __func__); |
1428 | return NULL; | 1428 | return NULL; |
1429 | } | 1429 | } |
1430 | txd->len = sgl->length; | ||
1431 | 1430 | ||
1432 | ret = pl08x_prep_channel_resources(plchan, txd); | 1431 | ret = pl08x_prep_channel_resources(plchan, txd); |
1433 | if (ret) | 1432 | if (ret) |