linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA
@ 2018-10-09 17:41 Geert Uytterhoeven
  2018-10-12 12:19 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2018-10-09 17:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Yoshihiro Shimoda, Ulrich Hecht, Wolfram Sang, linux-serial,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

On SCIFA and SCIFB serial ports with DMA support (i.e. some ports on
R-Car Gen2 and RZ/G1 SoCs), receive DMA operations are submitted before
the DMA channel pointer is initialized.  Hence this fails, and the
driver tries to fall back to PIO.  However, at this early phase in the
initialization sequence, fallback to PIO does not work, leading to a
serial port that cannot receive any data.

Fix this by calling sci_submit_rx() after initialization of the DMA
channel pointer.

Reported-by: Jinzai Solution and RVC Test Teams via Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fixes: 2c4ee23530ffc022 ("serial: sh-sci: Postpone DMA release when falling back to PIO")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Reported on r8a7790/lager using SCIFA1 on Debug Serial 1.
Tested on r8a7791/koelsch using SCIFA3 on EXIO-B.

This fixes a regression introduced in v4.19-rc1, so please queue for
v4.19.

Thanks!
---
 drivers/tty/serial/sh-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index b73b27dc45e60ffb..7e98a4f3ec77abbd 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1614,10 +1614,10 @@ static void sci_request_dma(struct uart_port *port)
 		hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		s->rx_timer.function = rx_timer_fn;
 
+		s->chan_rx_saved = s->chan_rx = chan;
+
 		if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
 			sci_submit_rx(s);
-
-		s->chan_rx_saved = s->chan_rx = chan;
 	}
 }
 
-- 
2.17.1


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

* Re: [PATCH] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA
  2018-10-09 17:41 [PATCH] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA Geert Uytterhoeven
@ 2018-10-12 12:19 ` Wolfram Sang
  2018-10-15 11:49   ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2018-10-12 12:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Jiri Slaby, Yoshihiro Shimoda, Ulrich Hecht,
	Wolfram Sang, linux-serial, linux-renesas-soc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]

On Tue, Oct 09, 2018 at 07:41:58PM +0200, Geert Uytterhoeven wrote:
> On SCIFA and SCIFB serial ports with DMA support (i.e. some ports on
> R-Car Gen2 and RZ/G1 SoCs), receive DMA operations are submitted before
> the DMA channel pointer is initialized.  Hence this fails, and the
> driver tries to fall back to PIO.  However, at this early phase in the
> initialization sequence, fallback to PIO does not work, leading to a
> serial port that cannot receive any data.
> 
> Fix this by calling sci_submit_rx() after initialization of the DMA
> channel pointer.
> 
> Reported-by: Jinzai Solution and RVC Test Teams via Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Brainstorming: keep Shimoda-san's address as is and mention the test
teams in the commit message?

> Fixes: 2c4ee23530ffc022 ("serial: sh-sci: Postpone DMA release when falling back to PIO")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> ---
> Reported on r8a7790/lager using SCIFA1 on Debug Serial 1.

I hope to test this on Lager this weekend. I am quite sure it will work
now, but then we have this formally checked, too.

> Tested on r8a7791/koelsch using SCIFA3 on EXIO-B.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA
  2018-10-12 12:19 ` Wolfram Sang
@ 2018-10-15 11:49   ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2018-10-15 11:49 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Jiri Slaby, Yoshihiro Shimoda, Ulrich Hecht,
	Wolfram Sang, linux-serial, linux-renesas-soc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]


> > Fixes: 2c4ee23530ffc022 ("serial: sh-sci: Postpone DMA release when falling back to PIO")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> > ---
> > Reported on r8a7790/lager using SCIFA1 on Debug Serial 1.
> 
> I hope to test this on Lager this weekend. I am quite sure it will work
> now, but then we have this formally checked, too.

Done now:

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-10-15 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 17:41 [PATCH] serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA Geert Uytterhoeven
2018-10-12 12:19 ` Wolfram Sang
2018-10-15 11:49   ` Wolfram Sang

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