aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/iop-adma.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-29 18:34:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-29 18:34:57 -0400
commitef08e78268423fc4d7fbc3e54bd9a67fc8da7cc5 (patch)
treed0561d3ef89c9cd277a38168e33850666cbd33c4 /drivers/dma/iop-adma.c
parent71db34fc4330f7c784397acb9f1e6ee7f7b32eb2 (diff)
parent5b2e02e401deb44e7f5befe19404d8b2688efea4 (diff)
Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine update from Vinod Koul: "This includes the cookie cleanup by Russell, the addition of context parameter for dmaengine APIs, more arm dmaengine driver cleanup by moving code to dmaengine, this time for imx by Javier and pl330 by Boojin along with the usual driver fixes." Fix up some fairly trivial conflicts with various other cleanups. * 'next' of git://git.infradead.org/users/vkoul/slave-dma: (67 commits) dmaengine: imx: fix the build failure on x86_64 dmaengine: i.MX: Fix merge of cookie branch. dmaengine: i.MX: Add support for interleaved transfers. dmaengine: imx-dma: use 'dev_dbg' and 'dev_warn' for messages. dmaengine: imx-dma: remove 'imx_dmav1_baseaddr' and 'dma_clk'. dmaengine: imx-dma: remove unused arg of imxdma_sg_next. dmaengine: imx-dma: remove internal structure. dmaengine: imx-dma: remove 'resbytes' field of 'internal' structure. dmaengine: imx-dma: remove 'in_use' field of 'internal' structure. dmaengine: imx-dma: remove sg member from internal structure. dmaengine: imx-dma: remove 'imxdma_setup_sg_hw' function. dmaengine: imx-dma: remove 'imxdma_config_channel_hw' function. dmaengine: imx-dma: remove 'imxdma_setup_mem2mem_hw' function. dmaengine: imx-dma: remove dma_mode member of internal structure. dmaengine: imx-dma: remove data member from internal structure. dmaengine: imx-dma: merge old dma-v1.c with imx-dma.c dmaengine: at_hdmac: add slave config operation dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic dmaengine/dma_slave: introduce inline wrappers dma: imx-sdma: Treat firmware messages as warnings instead of erros ...
Diffstat (limited to 'drivers/dma/iop-adma.c')
-rw-r--r--drivers/dma/iop-adma.c52
1 files changed, 13 insertions, 39 deletions
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index faf88b7e1e71..da6c4c2c066a 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -36,6 +36,8 @@
36 36
37#include <mach/adma.h> 37#include <mach/adma.h>
38 38
39#include "dmaengine.h"
40
39#define to_iop_adma_chan(chan) container_of(chan, struct iop_adma_chan, common) 41#define to_iop_adma_chan(chan) container_of(chan, struct iop_adma_chan, common)
40#define to_iop_adma_device(dev) \ 42#define to_iop_adma_device(dev) \
41 container_of(dev, struct iop_adma_device, common) 43 container_of(dev, struct iop_adma_device, common)
@@ -317,7 +319,7 @@ static void __iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan)
317 } 319 }
318 320
319 if (cookie > 0) { 321 if (cookie > 0) {
320 iop_chan->completed_cookie = cookie; 322 iop_chan->common.completed_cookie = cookie;
321 pr_debug("\tcompleted cookie %d\n", cookie); 323 pr_debug("\tcompleted cookie %d\n", cookie);
322 } 324 }
323} 325}
@@ -438,18 +440,6 @@ retry:
438 return NULL; 440 return NULL;
439} 441}
440 442
441static dma_cookie_t
442iop_desc_assign_cookie(struct iop_adma_chan *iop_chan,
443 struct iop_adma_desc_slot *desc)
444{
445 dma_cookie_t cookie = iop_chan->common.cookie;
446 cookie++;
447 if (cookie < 0)
448 cookie = 1;
449 iop_chan->common.cookie = desc->async_tx.cookie = cookie;
450 return cookie;
451}
452
453static void iop_adma_check_threshold(struct iop_adma_chan *iop_chan) 443static void iop_adma_check_threshold(struct iop_adma_chan *iop_chan)
454{ 444{
455 dev_dbg(iop_chan->device->common.dev, "pending: %d\n", 445 dev_dbg(iop_chan->device->common.dev, "pending: %d\n",
@@ -477,7 +467,7 @@ iop_adma_tx_submit(struct dma_async_tx_descriptor *tx)
477 slots_per_op = grp_start->slots_per_op; 467 slots_per_op = grp_start->slots_per_op;
478 468
479 spin_lock_bh(&iop_chan->lock); 469 spin_lock_bh(&iop_chan->lock);
480 cookie = iop_desc_assign_cookie(iop_chan, sw_desc); 470 cookie = dma_cookie_assign(tx);
481 471
482 old_chain_tail = list_entry(iop_chan->chain.prev, 472 old_chain_tail = list_entry(iop_chan->chain.prev,
483 struct iop_adma_desc_slot, chain_node); 473 struct iop_adma_desc_slot, chain_node);
@@ -904,24 +894,15 @@ static enum dma_status iop_adma_status(struct dma_chan *chan,
904 struct dma_tx_state *txstate) 894 struct dma_tx_state *txstate)
905{ 895{
906 struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan); 896 struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan);
907 dma_cookie_t last_used; 897 int ret;
908 dma_cookie_t last_complete; 898
909 enum dma_status ret; 899 ret = dma_cookie_status(chan, cookie, txstate);
910
911 last_used = chan->cookie;
912 last_complete = iop_chan->completed_cookie;
913 dma_set_tx_state(txstate, last_complete, last_used, 0);
914 ret = dma_async_is_complete(cookie, last_complete, last_used);
915 if (ret == DMA_SUCCESS) 900 if (ret == DMA_SUCCESS)
916 return ret; 901 return ret;
917 902
918 iop_adma_slot_cleanup(iop_chan); 903 iop_adma_slot_cleanup(iop_chan);
919 904
920 last_used = chan->cookie; 905 return dma_cookie_status(chan, cookie, txstate);
921 last_complete = iop_chan->completed_cookie;
922 dma_set_tx_state(txstate, last_complete, last_used, 0);
923
924 return dma_async_is_complete(cookie, last_complete, last_used);
925} 906}
926 907
927static irqreturn_t iop_adma_eot_handler(int irq, void *data) 908static irqreturn_t iop_adma_eot_handler(int irq, void *data)
@@ -1565,6 +1546,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev)
1565 INIT_LIST_HEAD(&iop_chan->chain); 1546 INIT_LIST_HEAD(&iop_chan->chain);
1566 INIT_LIST_HEAD(&iop_chan->all_slots); 1547 INIT_LIST_HEAD(&iop_chan->all_slots);
1567 iop_chan->common.device = dma_dev; 1548 iop_chan->common.device = dma_dev;
1549 dma_cookie_init(&iop_chan->common);
1568 list_add_tail(&iop_chan->common.device_node, &dma_dev->channels); 1550 list_add_tail(&iop_chan->common.device_node, &dma_dev->channels);
1569 1551
1570 if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) { 1552 if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
@@ -1642,16 +1624,12 @@ static void iop_chan_start_null_memcpy(struct iop_adma_chan *iop_chan)
1642 iop_desc_set_dest_addr(grp_start, iop_chan, 0); 1624 iop_desc_set_dest_addr(grp_start, iop_chan, 0);
1643 iop_desc_set_memcpy_src_addr(grp_start, 0); 1625 iop_desc_set_memcpy_src_addr(grp_start, 0);
1644 1626
1645 cookie = iop_chan->common.cookie; 1627 cookie = dma_cookie_assign(&sw_desc->async_tx);
1646 cookie++;
1647 if (cookie <= 1)
1648 cookie = 2;
1649 1628
1650 /* initialize the completed cookie to be less than 1629 /* initialize the completed cookie to be less than
1651 * the most recently used cookie 1630 * the most recently used cookie
1652 */ 1631 */
1653 iop_chan->completed_cookie = cookie - 1; 1632 iop_chan->common.completed_cookie = cookie - 1;
1654 iop_chan->common.cookie = sw_desc->async_tx.cookie = cookie;
1655 1633
1656 /* channel should not be busy */ 1634 /* channel should not be busy */
1657 BUG_ON(iop_chan_is_busy(iop_chan)); 1635 BUG_ON(iop_chan_is_busy(iop_chan));
@@ -1699,16 +1677,12 @@ static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan)
1699 iop_desc_set_xor_src_addr(grp_start, 0, 0); 1677 iop_desc_set_xor_src_addr(grp_start, 0, 0);
1700 iop_desc_set_xor_src_addr(grp_start, 1, 0); 1678 iop_desc_set_xor_src_addr(grp_start, 1, 0);
1701 1679
1702 cookie = iop_chan->common.cookie; 1680 cookie = dma_cookie_assign(&sw_desc->async_tx);
1703 cookie++;
1704 if (cookie <= 1)
1705 cookie = 2;
1706 1681
1707 /* initialize the completed cookie to be less than 1682 /* initialize the completed cookie to be less than
1708 * the most recently used cookie 1683 * the most recently used cookie
1709 */ 1684 */
1710 iop_chan->completed_cookie = cookie - 1; 1685 iop_chan->common.completed_cookie = cookie - 1;
1711 iop_chan->common.cookie = sw_desc->async_tx.cookie = cookie;
1712 1686
1713 /* channel should not be busy */ 1687 /* channel should not be busy */
1714 BUG_ON(iop_chan_is_busy(iop_chan)); 1688 BUG_ON(iop_chan_is_busy(iop_chan));