blob: 465005303be6730bc867ffbaf371deb7871d1cdb [file] [log] [blame]
From acd40bdff4c20d4f347a1baa9df718a9fd3a0286 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 23 May 2017 07:08:43 +0000
Subject: [PATCH 087/286] 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>
(cherry picked from commit 56b177055adb246cdeca174331dbf92fc49bfccd)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/dma/sh/rcar-dmac.c | 3 +++
1 file changed, 3 insertions(+)
--- 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_r
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;