linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcar-dmac: fixup descriptor pointer for descriptor mode
@ 2017-05-23  7:08 Kuninori Morimoto
  2017-05-30  6:20 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Kuninori Morimoto @ 2017-05-23  7:08 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, Laurent Pinchart, Geert Uytterhoeven
  Cc: dmaengine, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>
---
 drivers/dma/sh/rcar-dmac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index d2cb4a0..ffcadca 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1293,6 +1293,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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rcar-dmac: fixup descriptor pointer for descriptor mode
  2017-05-23  7:08 [PATCH] rcar-dmac: fixup descriptor pointer for descriptor mode Kuninori Morimoto
@ 2017-05-30  6:20 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2017-05-30  6:20 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Dan Williams, Laurent Pinchart, Geert Uytterhoeven, dmaengine,
	linux-kernel

On Tue, May 23, 2017 at 07:08:43AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-30  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23  7:08 [PATCH] rcar-dmac: fixup descriptor pointer for descriptor mode Kuninori Morimoto
2017-05-30  6:20 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).