diff options
-rw-r--r-- | drivers/dma/mxs-dma.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 1d1b6e99993d..083e7f1a94f0 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c | |||
@@ -58,6 +58,8 @@ | |||
58 | (((dma_is_apbh(d) && apbh_is_old(d)) ? 0x050 : 0x110) + (n) * 0x70) | 58 | (((dma_is_apbh(d) && apbh_is_old(d)) ? 0x050 : 0x110) + (n) * 0x70) |
59 | #define HW_APBHX_CHn_SEMA(d, n) \ | 59 | #define HW_APBHX_CHn_SEMA(d, n) \ |
60 | (((dma_is_apbh(d) && apbh_is_old(d)) ? 0x080 : 0x140) + (n) * 0x70) | 60 | (((dma_is_apbh(d) && apbh_is_old(d)) ? 0x080 : 0x140) + (n) * 0x70) |
61 | #define HW_APBHX_CHn_BAR(d, n) \ | ||
62 | (((dma_is_apbh(d) && apbh_is_old(d)) ? 0x070 : 0x130) + (n) * 0x70) | ||
61 | 63 | ||
62 | /* | 64 | /* |
63 | * ccw bits definitions | 65 | * ccw bits definitions |
@@ -623,8 +625,24 @@ static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, | |||
623 | dma_cookie_t cookie, struct dma_tx_state *txstate) | 625 | dma_cookie_t cookie, struct dma_tx_state *txstate) |
624 | { | 626 | { |
625 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); | 627 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); |
628 | struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma; | ||
629 | u32 residue = 0; | ||
630 | |||
631 | if (mxs_chan->status == DMA_IN_PROGRESS && | ||
632 | mxs_chan->flags & MXS_DMA_SG_LOOP) { | ||
633 | struct mxs_dma_ccw *last_ccw; | ||
634 | u32 bar; | ||
635 | |||
636 | last_ccw = &mxs_chan->ccw[mxs_chan->desc_count - 1]; | ||
637 | residue = last_ccw->xfer_bytes + last_ccw->bufaddr; | ||
638 | |||
639 | bar = readl(mxs_dma->base + | ||
640 | HW_APBHX_CHn_BAR(mxs_dma, chan->chan_id)); | ||
641 | residue -= bar; | ||
642 | } | ||
626 | 643 | ||
627 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, 0); | 644 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, |
645 | residue); | ||
628 | 646 | ||
629 | return mxs_chan->status; | 647 | return mxs_chan->status; |
630 | } | 648 | } |