diff options
Diffstat (limited to 'drivers/dma/mxs-dma.c')
-rw-r--r-- | drivers/dma/mxs-dma.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index b06cd4ca626f..a2267f9ab568 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <mach/dma.h> | 28 | #include <mach/dma.h> |
29 | #include <mach/common.h> | 29 | #include <mach/common.h> |
30 | 30 | ||
31 | #include "dmaengine.h" | ||
32 | |||
31 | /* | 33 | /* |
32 | * NOTE: The term "PIO" throughout the mxs-dma implementation means | 34 | * NOTE: The term "PIO" throughout the mxs-dma implementation means |
33 | * PIO mode of mxs apbh-dma and apbx-dma. With this working mode, | 35 | * PIO mode of mxs apbh-dma and apbx-dma. With this working mode, |
@@ -111,7 +113,6 @@ struct mxs_dma_chan { | |||
111 | struct mxs_dma_ccw *ccw; | 113 | struct mxs_dma_ccw *ccw; |
112 | dma_addr_t ccw_phys; | 114 | dma_addr_t ccw_phys; |
113 | int desc_count; | 115 | int desc_count; |
114 | dma_cookie_t last_completed; | ||
115 | enum dma_status status; | 116 | enum dma_status status; |
116 | unsigned int flags; | 117 | unsigned int flags; |
117 | #define MXS_DMA_SG_LOOP (1 << 0) | 118 | #define MXS_DMA_SG_LOOP (1 << 0) |
@@ -193,19 +194,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan) | |||
193 | mxs_chan->status = DMA_IN_PROGRESS; | 194 | mxs_chan->status = DMA_IN_PROGRESS; |
194 | } | 195 | } |
195 | 196 | ||
196 | static dma_cookie_t mxs_dma_assign_cookie(struct mxs_dma_chan *mxs_chan) | ||
197 | { | ||
198 | dma_cookie_t cookie = mxs_chan->chan.cookie; | ||
199 | |||
200 | if (++cookie < 0) | ||
201 | cookie = 1; | ||
202 | |||
203 | mxs_chan->chan.cookie = cookie; | ||
204 | mxs_chan->desc.cookie = cookie; | ||
205 | |||
206 | return cookie; | ||
207 | } | ||
208 | |||
209 | static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) | 197 | static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) |
210 | { | 198 | { |
211 | return container_of(chan, struct mxs_dma_chan, chan); | 199 | return container_of(chan, struct mxs_dma_chan, chan); |
@@ -217,7 +205,7 @@ static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
217 | 205 | ||
218 | mxs_dma_enable_chan(mxs_chan); | 206 | mxs_dma_enable_chan(mxs_chan); |
219 | 207 | ||
220 | return mxs_dma_assign_cookie(mxs_chan); | 208 | return dma_cookie_assign(tx); |
221 | } | 209 | } |
222 | 210 | ||
223 | static void mxs_dma_tasklet(unsigned long data) | 211 | static void mxs_dma_tasklet(unsigned long data) |
@@ -274,7 +262,7 @@ static irqreturn_t mxs_dma_int_handler(int irq, void *dev_id) | |||
274 | stat1 &= ~(1 << channel); | 262 | stat1 &= ~(1 << channel); |
275 | 263 | ||
276 | if (mxs_chan->status == DMA_SUCCESS) | 264 | if (mxs_chan->status == DMA_SUCCESS) |
277 | mxs_chan->last_completed = mxs_chan->desc.cookie; | 265 | dma_cookie_complete(&mxs_chan->desc); |
278 | 266 | ||
279 | /* schedule tasklet on this channel */ | 267 | /* schedule tasklet on this channel */ |
280 | tasklet_schedule(&mxs_chan->tasklet); | 268 | tasklet_schedule(&mxs_chan->tasklet); |
@@ -538,7 +526,7 @@ static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, | |||
538 | dma_cookie_t last_used; | 526 | dma_cookie_t last_used; |
539 | 527 | ||
540 | last_used = chan->cookie; | 528 | last_used = chan->cookie; |
541 | dma_set_tx_state(txstate, mxs_chan->last_completed, last_used, 0); | 529 | dma_set_tx_state(txstate, chan->completed_cookie, last_used, 0); |
542 | 530 | ||
543 | return mxs_chan->status; | 531 | return mxs_chan->status; |
544 | } | 532 | } |
@@ -630,6 +618,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev) | |||
630 | 618 | ||
631 | mxs_chan->mxs_dma = mxs_dma; | 619 | mxs_chan->mxs_dma = mxs_dma; |
632 | mxs_chan->chan.device = &mxs_dma->dma_device; | 620 | mxs_chan->chan.device = &mxs_dma->dma_device; |
621 | dma_cookie_init(&mxs_chan->chan); | ||
633 | 622 | ||
634 | tasklet_init(&mxs_chan->tasklet, mxs_dma_tasklet, | 623 | tasklet_init(&mxs_chan->tasklet, mxs_dma_tasklet, |
635 | (unsigned long) mxs_chan); | 624 | (unsigned long) mxs_chan); |