diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2017-05-23 09:08:43 +0200 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2017-05-30 08:19:28 +0200 |
commit | 56b177055adb246cdeca174331dbf92fc49bfccd (patch) | |
tree | 65f7f1be8ccc4c48a84671663f7c683719d10363 /drivers/dma/sh | |
parent | dmaengine: ep93xx: Don't drain the transfers in terminate_all() (diff) | |
download | linux-56b177055adb246cdeca174331dbf92fc49bfccd.tar.xz linux-56b177055adb246cdeca174331dbf92fc49bfccd.zip |
rcar-dmac: fixup descriptor pointer for descriptor mode
In descriptor mode, the descriptor running pointer is not maintained
by the interrupt handler, thus, driver finds the running descriptor
from the descriptor pointer field in the CHCRB register.
But, CHCRB::DPTR indicates *next* descriptor pointer, not current.
Thus, The residue calculation will be missed. This patch fixup it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/sh')
-rw-r--r-- | drivers/dma/sh/rcar-dmac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index db41795fe42a..bd261c9e9664 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1287,6 +1287,9 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan, if (desc->hwdescs.use) { dptr = (rcar_dmac_chan_read(chan, RCAR_DMACHCRB) & RCAR_DMACHCRB_DPTR_MASK) >> RCAR_DMACHCRB_DPTR_SHIFT; + if (dptr == 0) + dptr = desc->nchunks; + dptr--; WARN_ON(dptr >= desc->nchunks); } else { running = desc->running; |