diff options
author | Vinod Koul <vinod.koul@linux.intel.com> | 2012-03-13 12:39:49 +0530 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-03-13 12:39:49 +0530 |
commit | 1f3d6dc0be92f0caca937926cca16ec4fdd585a3 (patch) | |
tree | a12562009ae984dd16ed080af13d0036b88a93a7 /drivers/dma/pl330.c | |
parent | 5170c051a56244816d948c43592c1b2805ed4f3a (diff) | |
parent | 949ff5b8d46b5e3435d21b2651ce3a2599208d44 (diff) |
Merge branch 'rmk_cookie_fixes2' into next
Conflicts:
drivers/dma/imx-dma.c
drivers/dma/pl330.c
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/pl330.c')
-rw-r--r-- | drivers/dma/pl330.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 7253d17f05f..e863d7fc465 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -28,6 +28,7 @@ #include <linux/scatterlist.h> #include <linux/of.h> +#include "dmaengine.h" #define PL330_MAX_CHAN 8 #define PL330_MAX_IRQS 32 #define PL330_MAX_PERI 32 @@ -285,6 +286,7 @@ static unsigned cmd_line; #endif /* The number of default descriptors */ + #define NR_DEFAULT_DESC 16 /* Populated by the PL330 core driver for DMA API driver's info */ @@ -545,9 +547,6 @@ struct dma_pl330_chan { /* DMA-Engine Channel */ struct dma_chan chan; - /* Last completed cookie */ - dma_cookie_t completed; - /* List of to be xfered descriptors */ struct list_head work_list; @@ -2320,7 +2319,7 @@ static void pl330_tasklet(unsigned long data) /* Pick up ripe tomatoes */ list_for_each_entry_safe(desc, _dt, &pch->work_list, node) if (desc->status == DONE) { - pch->completed = desc->txd.cookie; + dma_cookie_complete(&desc->txd); list_move_tail(&desc->node, &list); } @@ -2391,7 +2390,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) spin_lock_irqsave(&pch->lock, flags); - pch->completed = chan->cookie = 1; + dma_cookie_init(chan); pch->cyclic = false; pch->pl330_chid = pl330_request_channel(&pdmac->pif); @@ -2426,7 +2425,6 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned /* Mark all desc done */ list_for_each_entry_safe(desc, _dt, &pch->work_list , node) { desc->status = DONE; - pch->completed = desc->txd.cookie; list_move_tail(&desc->node, &list); } @@ -2482,18 +2480,7 @@ static enum dma_status pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct dma_pl330_chan *pch = to_pchan(chan); - dma_cookie_t last_done, last_used; - int ret; - - last_done = pch->completed; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_done, last_used); - - dma_set_tx_state(txstate, last_done, last_used, 0); - - return ret; + return dma_cookie_status(chan, cookie, txstate); } static void pl330_issue_pending(struct dma_chan *chan) @@ -2516,26 +2503,16 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) spin_lock_irqsave(&pch->lock, flags); /* Assign cookies to all nodes */ - cookie = tx->chan->cookie; - while (!list_empty(&last->node)) { desc = list_entry(last->node.next, struct dma_pl330_desc, node); - if (++cookie < 0) - cookie = 1; - desc->txd.cookie = cookie; + dma_cookie_assign(&desc->txd); list_move_tail(&desc->node, &pch->work_list); } - if (++cookie < 0) - cookie = 1; - last->txd.cookie = cookie; - + cookie = dma_cookie_assign(&last->txd); list_add_tail(&last->node, &pch->work_list); - - tx->chan->cookie = cookie; - spin_unlock_irqrestore(&pch->lock, flags); return cookie; |