dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dmaengine: rcar-dmac: clear channel register when error
@ 2018-07-02  1:07 Kuninori Morimoto
  0 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2018-07-02  1:07 UTC (permalink / raw)
  To: Vinod
  Cc: Geert Uytterhoeven, Dan Williams, Magnus Damm, Linux-Renesas,
	Laurent Pinchart, Kieran Bingham, Geert Uytterhoeven, dmaengine

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

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 register 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.

// This patch started to use C++ style comment out
// because it is recent Linus request

Reported-by: Hiroki Negishi <hiroki.negishi.bx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Hiroki Negishi <hiroki.negishi.bx@renesas.com>
---
 drivers/dma/sh/rcar-dmac.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 279c930..35d7a16 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1525,7 +1525,13 @@ 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;
 	}

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

* dmaengine: rcar-dmac: clear channel register when error
@ 2018-07-02  1:24 Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2018-07-02  1:24 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Vinod, Geert Uytterhoeven, Dan Williams, Magnus Damm,
	Linux-Renesas, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, dmaengine

Hi Kuninori-san,

On Sun, Jul 1, 2018 at 10:07 PM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> 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 register 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.
>
> // This patch started to use C++ style comment out
> // because it is recent Linus request

This is valid for the SPDX part only.

For code you should still use the standard /* style.
---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* dmaengine: rcar-dmac: clear channel register when error
@ 2018-07-02  2:20 Kuninori Morimoto
  0 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2018-07-02  2:20 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Vinod, Geert Uytterhoeven, Dan Williams, Magnus Damm,
	Linux-Renesas, Laurent Pinchart, Kieran Bingham,
	Geert Uytterhoeven, dmaengine

Hi Fabio

> > // This patch started to use C++ style comment out
> > // because it is recent Linus request
> 
> This is valid for the SPDX part only.
> 
> For code you should still use the standard /* style.

Wow !
Thanks, I will post v2 patch

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* dmaengine: rcar-dmac: clear channel register when error
@ 2018-07-02  6:37 Laurent Pinchart
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2018-07-02  6:37 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Vinod, Geert Uytterhoeven, Dan Williams, Magnus Damm,
	Linux-Renesas, Kieran Bingham, Geert Uytterhoeven, dmaengine

Hi Morimoto-san,

Thank you for the patch.

On Monday, 2 July 2018 04:07:17 EEST Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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 register 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.
> 
> // This patch started to use C++ style comment out
> // because it is recent Linus request

I fear this will generate lots of frustration :-/ While I strongly prefer the 
traditional C style, I'm fine leaving the choice to driver authors. However, I 
think that mixing different styles in the same file only hinders readability. 
Would you like to convert the whole file ? ;-)

> Reported-by: Hiroki Negishi <hiroki.negishi.bx@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Reviewed-by: Hiroki Negishi <hiroki.negishi.bx@renesas.com>
> ---
>  drivers/dma/sh/rcar-dmac.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
> index 279c930..35d7a16 100644
> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -1525,7 +1525,13 @@ 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);

This could be simplified with

		struct rcar_dmac *dmac = to_rcar_dmac(chan->chan.device);

> +
> +		// 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.

Is it also a request from Linus to wrap text much before the 80 characters 
limit ? :-)

> +		rcar_dmac_write(dmac, RCAR_DMACHCLR, 1 << chan->index);
> +		rcar_dmac_chcr_de_barrier(chan);
>  		reinit = true;
>  		goto spin_lock_end;
>  	}

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

* dmaengine: rcar-dmac: clear channel register when error
@ 2018-07-02  6:53 Kuninori Morimoto
  0 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2018-07-02  6:53 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Vinod, Geert Uytterhoeven, Dan Williams, Magnus Damm,
	Linux-Renesas, Kieran Bingham, Geert Uytterhoeven, dmaengine

Hi Laurent

> > // This patch started to use C++ style comment out
> > // because it is recent Linus request
> 
> I fear this will generate lots of frustration :-/ While I strongly prefer the 
> traditional C style, I'm fine leaving the choice to driver authors. However, I 
> think that mixing different styles in the same file only hinders readability. 
> Would you like to convert the whole file ? ;-)

I already posted v2 patch ;P

> >  	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);
> 
> This could be simplified with
> 
> 		struct rcar_dmac *dmac = to_rcar_dmac(chan->chan.device);

Nice to know.
Will post v3 patch

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-07-02  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02  6:37 dmaengine: rcar-dmac: clear channel register when error Laurent Pinchart
  -- strict thread matches above, loose matches on Subject: below --
2018-07-02  6:53 Kuninori Morimoto
2018-07-02  2:20 Kuninori Morimoto
2018-07-02  1:24 Fabio Estevam
2018-07-02  1:07 Kuninori Morimoto

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).