aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/fsldma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/fsldma.c')
-rw-r--r--drivers/dma/fsldma.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index b98070c33ca..8f84761f98b 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -35,6 +35,7 @@
35#include <linux/dmapool.h> 35#include <linux/dmapool.h>
36#include <linux/of_platform.h> 36#include <linux/of_platform.h>
37 37
38#include "dmaengine.h"
38#include "fsldma.h" 39#include "fsldma.h"
39 40
40#define chan_dbg(chan, fmt, arg...) \ 41#define chan_dbg(chan, fmt, arg...) \
@@ -413,17 +414,10 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx)
413 * assign cookies to all of the software descriptors 414 * assign cookies to all of the software descriptors
414 * that make up this transaction 415 * that make up this transaction
415 */ 416 */
416 cookie = chan->common.cookie;
417 list_for_each_entry(child, &desc->tx_list, node) { 417 list_for_each_entry(child, &desc->tx_list, node) {
418 cookie++; 418 cookie = dma_cookie_assign(&child->async_tx);
419 if (cookie < DMA_MIN_COOKIE)
420 cookie = DMA_MIN_COOKIE;
421
422 child->async_tx.cookie = cookie;
423 } 419 }
424 420
425 chan->common.cookie = cookie;
426
427 /* put this transaction onto the tail of the pending queue */ 421 /* put this transaction onto the tail of the pending queue */
428 append_ld_queue(chan, desc); 422 append_ld_queue(chan, desc);
429 423
@@ -765,6 +759,7 @@ fail:
765 * @sg_len: number of entries in @scatterlist 759 * @sg_len: number of entries in @scatterlist
766 * @direction: DMA direction 760 * @direction: DMA direction
767 * @flags: DMAEngine flags 761 * @flags: DMAEngine flags
762 * @context: transaction context (ignored)
768 * 763 *
769 * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the 764 * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
770 * DMA_SLAVE API, this gets the device-specific information from the 765 * DMA_SLAVE API, this gets the device-specific information from the
@@ -772,7 +767,8 @@ fail:
772 */ 767 */
773static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg( 768static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
774 struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len, 769 struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
775 enum dma_transfer_direction direction, unsigned long flags) 770 enum dma_transfer_direction direction, unsigned long flags,
771 void *context)
776{ 772{
777 /* 773 /*
778 * This operation is not supported on the Freescale DMA controller 774 * This operation is not supported on the Freescale DMA controller
@@ -984,19 +980,14 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan,
984 struct dma_tx_state *txstate) 980 struct dma_tx_state *txstate)
985{ 981{
986 struct fsldma_chan *chan = to_fsl_chan(dchan); 982 struct fsldma_chan *chan = to_fsl_chan(dchan);
987 dma_cookie_t last_complete; 983 enum dma_status ret;
988 dma_cookie_t last_used;
989 unsigned long flags; 984 unsigned long flags;
990 985
991 spin_lock_irqsave(&chan->desc_lock, flags); 986 spin_lock_irqsave(&chan->desc_lock, flags);
992 987 ret = dma_cookie_status(dchan, cookie, txstate);
993 last_complete = chan->completed_cookie;
994 last_used = dchan->cookie;
995
996 spin_unlock_irqrestore(&chan->desc_lock, flags); 988 spin_unlock_irqrestore(&chan->desc_lock, flags);
997 989
998 dma_set_tx_state(txstate, last_complete, last_used, 0); 990 return ret;
999 return dma_async_is_complete(cookie, last_complete, last_used);
1000} 991}
1001 992
1002/*----------------------------------------------------------------------------*/ 993/*----------------------------------------------------------------------------*/
@@ -1087,8 +1078,8 @@ static void dma_do_tasklet(unsigned long data)
1087 1078
1088 desc = to_fsl_desc(chan->ld_running.prev); 1079 desc = to_fsl_desc(chan->ld_running.prev);
1089 cookie = desc->async_tx.cookie; 1080 cookie = desc->async_tx.cookie;
1081 dma_cookie_complete(&desc->async_tx);
1090 1082
1091 chan->completed_cookie = cookie;
1092 chan_dbg(chan, "completed_cookie=%d\n", cookie); 1083 chan_dbg(chan, "completed_cookie=%d\n", cookie);
1093 } 1084 }
1094 1085
@@ -1303,6 +1294,7 @@ static int __devinit fsl_dma_chan_probe(struct fsldma_device *fdev,
1303 chan->idle = true; 1294 chan->idle = true;
1304 1295
1305 chan->common.device = &fdev->common; 1296 chan->common.device = &fdev->common;
1297 dma_cookie_init(&chan->common);
1306 1298
1307 /* find the IRQ line, if it exists in the device tree */ 1299 /* find the IRQ line, if it exists in the device tree */
1308 chan->irq = irq_of_parse_and_map(node, 0); 1300 chan->irq = irq_of_parse_and_map(node, 0);