diff options
Diffstat (limited to 'drivers/dma/mv_xor.c')
-rw-r--r-- | drivers/dma/mv_xor.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index e779b434af45..fa5d55fea46c 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/memory.h> | 27 | #include <linux/memory.h> |
28 | #include <plat/mv_xor.h> | 28 | #include <plat/mv_xor.h> |
29 | |||
30 | #include "dmaengine.h" | ||
29 | #include "mv_xor.h" | 31 | #include "mv_xor.h" |
30 | 32 | ||
31 | static void mv_xor_issue_pending(struct dma_chan *chan); | 33 | static void mv_xor_issue_pending(struct dma_chan *chan); |
@@ -435,7 +437,7 @@ static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) | |||
435 | } | 437 | } |
436 | 438 | ||
437 | if (cookie > 0) | 439 | if (cookie > 0) |
438 | mv_chan->completed_cookie = cookie; | 440 | mv_chan->common.completed_cookie = cookie; |
439 | } | 441 | } |
440 | 442 | ||
441 | static void | 443 | static void |
@@ -534,18 +536,6 @@ retry: | |||
534 | return NULL; | 536 | return NULL; |
535 | } | 537 | } |
536 | 538 | ||
537 | static dma_cookie_t | ||
538 | mv_desc_assign_cookie(struct mv_xor_chan *mv_chan, | ||
539 | struct mv_xor_desc_slot *desc) | ||
540 | { | ||
541 | dma_cookie_t cookie = mv_chan->common.cookie; | ||
542 | |||
543 | if (++cookie < 0) | ||
544 | cookie = 1; | ||
545 | mv_chan->common.cookie = desc->async_tx.cookie = cookie; | ||
546 | return cookie; | ||
547 | } | ||
548 | |||
549 | /************************ DMA engine API functions ****************************/ | 539 | /************************ DMA engine API functions ****************************/ |
550 | static dma_cookie_t | 540 | static dma_cookie_t |
551 | mv_xor_tx_submit(struct dma_async_tx_descriptor *tx) | 541 | mv_xor_tx_submit(struct dma_async_tx_descriptor *tx) |
@@ -563,7 +553,7 @@ mv_xor_tx_submit(struct dma_async_tx_descriptor *tx) | |||
563 | grp_start = sw_desc->group_head; | 553 | grp_start = sw_desc->group_head; |
564 | 554 | ||
565 | spin_lock_bh(&mv_chan->lock); | 555 | spin_lock_bh(&mv_chan->lock); |
566 | cookie = mv_desc_assign_cookie(mv_chan, sw_desc); | 556 | cookie = dma_cookie_assign(tx); |
567 | 557 | ||
568 | if (list_empty(&mv_chan->chain)) | 558 | if (list_empty(&mv_chan->chain)) |
569 | list_splice_init(&sw_desc->tx_list, &mv_chan->chain); | 559 | list_splice_init(&sw_desc->tx_list, &mv_chan->chain); |
@@ -820,27 +810,16 @@ static enum dma_status mv_xor_status(struct dma_chan *chan, | |||
820 | struct dma_tx_state *txstate) | 810 | struct dma_tx_state *txstate) |
821 | { | 811 | { |
822 | struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan); | 812 | struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan); |
823 | dma_cookie_t last_used; | ||
824 | dma_cookie_t last_complete; | ||
825 | enum dma_status ret; | 813 | enum dma_status ret; |
826 | 814 | ||
827 | last_used = chan->cookie; | 815 | ret = dma_cookie_status(chan, cookie, txstate); |
828 | last_complete = mv_chan->completed_cookie; | ||
829 | mv_chan->is_complete_cookie = cookie; | ||
830 | dma_set_tx_state(txstate, last_complete, last_used, 0); | ||
831 | |||
832 | ret = dma_async_is_complete(cookie, last_complete, last_used); | ||
833 | if (ret == DMA_SUCCESS) { | 816 | if (ret == DMA_SUCCESS) { |
834 | mv_xor_clean_completed_slots(mv_chan); | 817 | mv_xor_clean_completed_slots(mv_chan); |
835 | return ret; | 818 | return ret; |
836 | } | 819 | } |
837 | mv_xor_slot_cleanup(mv_chan); | 820 | mv_xor_slot_cleanup(mv_chan); |
838 | 821 | ||
839 | last_used = chan->cookie; | 822 | return dma_cookie_status(chan, cookie, txstate); |
840 | last_complete = mv_chan->completed_cookie; | ||
841 | |||
842 | dma_set_tx_state(txstate, last_complete, last_used, 0); | ||
843 | return dma_async_is_complete(cookie, last_complete, last_used); | ||
844 | } | 823 | } |
845 | 824 | ||
846 | static void mv_dump_xor_regs(struct mv_xor_chan *chan) | 825 | static void mv_dump_xor_regs(struct mv_xor_chan *chan) |
@@ -1214,6 +1193,7 @@ static int __devinit mv_xor_probe(struct platform_device *pdev) | |||
1214 | INIT_LIST_HEAD(&mv_chan->completed_slots); | 1193 | INIT_LIST_HEAD(&mv_chan->completed_slots); |
1215 | INIT_LIST_HEAD(&mv_chan->all_slots); | 1194 | INIT_LIST_HEAD(&mv_chan->all_slots); |
1216 | mv_chan->common.device = dma_dev; | 1195 | mv_chan->common.device = dma_dev; |
1196 | dma_cookie_init(&mv_chan->common); | ||
1217 | 1197 | ||
1218 | list_add_tail(&mv_chan->common.device_node, &dma_dev->channels); | 1198 | list_add_tail(&mv_chan->common.device_node, &dma_dev->channels); |
1219 | 1199 | ||