aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/imx-sdma.c
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@linux.intel.com>2012-03-13 03:09:49 -0400
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-13 03:09:49 -0400
commit1f3d6dc0be92f0caca937926cca16ec4fdd585a3 (patch)
treea12562009ae984dd16ed080af13d0036b88a93a7 /drivers/dma/imx-sdma.c
parent5170c051a56244816d948c43592c1b2805ed4f3a (diff)
parent949ff5b8d46b5e3435d21b2651ce3a2599208d44 (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/imx-sdma.c')
-rw-r--r--drivers/dma/imx-sdma.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index f0bfc0e07416..5da552d1f92d 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -43,6 +43,8 @@
43#include <mach/dma.h> 43#include <mach/dma.h>
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45 45
46#include "dmaengine.h"
47
46/* SDMA registers */ 48/* SDMA registers */
47#define SDMA_H_C0PTR 0x000 49#define SDMA_H_C0PTR 0x000
48#define SDMA_H_INTR 0x004 50#define SDMA_H_INTR 0x004
@@ -267,7 +269,6 @@ struct sdma_channel {
267 struct dma_chan chan; 269 struct dma_chan chan;
268 spinlock_t lock; 270 spinlock_t lock;
269 struct dma_async_tx_descriptor desc; 271 struct dma_async_tx_descriptor desc;
270 dma_cookie_t last_completed;
271 enum dma_status status; 272 enum dma_status status;
272 unsigned int chn_count; 273 unsigned int chn_count;
273 unsigned int chn_real_count; 274 unsigned int chn_real_count;
@@ -529,7 +530,7 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)
529 else 530 else
530 sdmac->status = DMA_SUCCESS; 531 sdmac->status = DMA_SUCCESS;
531 532
532 sdmac->last_completed = sdmac->desc.cookie; 533 dma_cookie_complete(&sdmac->desc);
533 if (sdmac->desc.callback) 534 if (sdmac->desc.callback)
534 sdmac->desc.callback(sdmac->desc.callback_param); 535 sdmac->desc.callback(sdmac->desc.callback_param);
535} 536}
@@ -814,19 +815,6 @@ out:
814 return ret; 815 return ret;
815} 816}
816 817
817static dma_cookie_t sdma_assign_cookie(struct sdma_channel *sdmac)
818{
819 dma_cookie_t cookie = sdmac->chan.cookie;
820
821 if (++cookie < 0)
822 cookie = 1;
823
824 sdmac->chan.cookie = cookie;
825 sdmac->desc.cookie = cookie;
826
827 return cookie;
828}
829
830static struct sdma_channel *to_sdma_chan(struct dma_chan *chan) 818static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
831{ 819{
832 return container_of(chan, struct sdma_channel, chan); 820 return container_of(chan, struct sdma_channel, chan);
@@ -840,7 +828,7 @@ static dma_cookie_t sdma_tx_submit(struct dma_async_tx_descriptor *tx)
840 828
841 spin_lock_irqsave(&sdmac->lock, flags); 829 spin_lock_irqsave(&sdmac->lock, flags);
842 830
843 cookie = sdma_assign_cookie(sdmac); 831 cookie = dma_cookie_assign(tx);
844 832
845 spin_unlock_irqrestore(&sdmac->lock, flags); 833 spin_unlock_irqrestore(&sdmac->lock, flags);
846 834
@@ -1127,7 +1115,7 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan,
1127 1115
1128 last_used = chan->cookie; 1116 last_used = chan->cookie;
1129 1117
1130 dma_set_tx_state(txstate, sdmac->last_completed, last_used, 1118 dma_set_tx_state(txstate, chan->completed_cookie, last_used,
1131 sdmac->chn_count - sdmac->chn_real_count); 1119 sdmac->chn_count - sdmac->chn_real_count);
1132 1120
1133 return sdmac->status; 1121 return sdmac->status;
@@ -1368,6 +1356,7 @@ static int __init sdma_probe(struct platform_device *pdev)
1368 spin_lock_init(&sdmac->lock); 1356 spin_lock_init(&sdmac->lock);
1369 1357
1370 sdmac->chan.device = &sdma->dma_device; 1358 sdmac->chan.device = &sdma->dma_device;
1359 dma_cookie_init(&sdmac->chan);
1371 sdmac->channel = i; 1360 sdmac->channel = i;
1372 1361
1373 /* 1362 /*