From: Kuninori Morimoto <[email protected]>

We need to clear channel register in error case as recovery.
The channel is already stopped in such case, thus we don't need to call
rcar_dmac_chan_halt() before clearing.

rcar_dmac_chan_halt() will clear and confirm DE bit.
But it will be failed because channel is already stopped in error case.
In other words, we shouldn't call it then.

Reported-by: Hiroki Negishi <[email protected]>
Signed-off-by: Kuninori Morimoto <[email protected]>
Reviewed-by: Hiroki Negishi <[email protected]>
---
v1 -> v2

 - use /* */ style comment instead of C++ style
 - Cc:ed to Negishi-san

 drivers/dma/sh/rcar-dmac.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 279c930..a65292d 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1525,7 +1525,15 @@ static irqreturn_t rcar_dmac_isr_channel(int irq, void 
*dev)
 
        chcr = rcar_dmac_chan_read(chan, RCAR_DMACHCR);
        if (chcr & RCAR_DMACHCR_CAE) {
-               rcar_dmac_chan_halt(chan);
+               struct rcar_dmac *dmac = 
dev_get_drvdata(chan->chan.device->dev);
+
+               /*
+                * We don't need to call rcar_dmac_chan_halt()
+                * because channel is already stopped in error case.
+                * We need to clear register and check DE bit as recovery.
+                */
+               rcar_dmac_write(dmac, RCAR_DMACHCLR, 1 << chan->index);
+               rcar_dmac_chcr_de_barrier(chan);
                reinit = true;
                goto spin_lock_end;
        }
-- 
2.7.4

Reply via email to