diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2017-05-23 07:08:43 +0000 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2017-05-30 11:49:28 +0530 |
commit | 56b177055adb246cdeca174331dbf92fc49bfccd (patch) | |
tree | 65f7f1be8ccc4c48a84671663f7c683719d10363 /drivers/dma/sh | |
parent | 98f9de366fccee7572c646af226b2d4b4841e3b5 (diff) | |
download | linux-56b177055adb246cdeca174331dbf92fc49bfccd.tar.gz |
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; |