linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] serial: sh-sci: FIFO initialization fixes
@ 2016-06-24 14:59 Geert Uytterhoeven
  2016-06-24 14:59 ` [PATCH v2 1/4] serial: sh-sci: Do not start transfers from sci_startup() Geert Uytterhoeven
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-06-24 14:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Magnus Damm, Yoshihiro Shimoda, linux-serial, linux-renesas-soc,
	linux-sh, uclinux-h8-devel, Geert Uytterhoeven

	Hi Greg, Jiri,

When opening a Renesas SCIF serial port after it has been used before,
stale data may be read.  This has been observed on R-Car Gen2 and R-Car
Gen3, with all SCIF variants present (SCIF, SCIFA, SCIFB, and HSCIF). It
is much more likely to happen when DMA is enabled, although it has been
seen with PIO, too.

There are actually two reasons why stale data is received:
  1. Transfers are started, or are still activated, before the FIFO is
     reset, causing one or more (up to the RX FIFO size) stale bytes
     (fixed by patches 1 and 2),
  2. FIFO reset lacked clearing the RDF flag, causing one byte of stale
     data (fixed by patch 3).
While at it, patch 4 adds the missing clearing of two other flags in the
initialization sequence on (H)SCIF.

While the issue can be reproduced using subsequent runs of sertest[1],
I wrote a new test program, fifotest[2], to trigger it more easily.
More detailed test information can be found on the eLinux wiki[3].

I have verified that this series fixes the issue on SCIF, SCIFA, SCIFB,
and HSCIF, on R-Car Gen2 (r8a7791/koelsch) and R-Car Gen3
(r8a7795/salvator-x).
Basic regression testing has been done with SCIFA on sh73a0/kzm9g.
Regression testing on other variants (notably SCI) would be appreciated.

Changes compared to v1:
  - Do not clear clock source bits, since the serial console relies on
    them, as reported by Shimoda-san.

This series applies against both v4.6 and next-20160526.
For testing, it's also available in a topic branch at
https://git.kernel.org/cgit/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/scif-fifo-v2.

Please apply, thanks!

[1] https://github.com/geertu/sertest
[2] https://github.com/geertu/fifotest
[3] http://elinux.org/Tests:SCIF-FIFO

Geert Uytterhoeven (4):
  serial: sh-sci: Do not start transfers from sci_startup()
  serial: sh-sci: Stop transfers in sci_shutdown()
  serial: sh-sci: Clear RX, error, and break flags during reset
  serial: sh-sci: Clear (H)SCIF timeout and overrun during reset

 drivers/tty/serial/sh-sci.c | 20 ++++++++++++++------
 drivers/tty/serial/sh-sci.h |  1 +
 2 files changed, 15 insertions(+), 6 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

end of thread, other threads:[~2016-06-25 17:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24 14:59 [PATCH v2 0/4] serial: sh-sci: FIFO initialization fixes Geert Uytterhoeven
2016-06-24 14:59 ` [PATCH v2 1/4] serial: sh-sci: Do not start transfers from sci_startup() Geert Uytterhoeven
2016-06-24 14:59 ` [PATCH v2 2/4] serial: sh-sci: Stop transfers in sci_shutdown() Geert Uytterhoeven
2016-06-25 16:09   ` Greg Kroah-Hartman
2016-06-25 16:10     ` Greg Kroah-Hartman
2016-06-25 17:01       ` Greg Kroah-Hartman
2016-06-24 14:59 ` [PATCH v2 3/4] serial: sh-sci: Clear RX, error, and break flags during reset Geert Uytterhoeven
2016-06-24 14:59 ` [PATCH v2 4/4] serial: sh-sci: Clear (H)SCIF timeout and overrun " Geert Uytterhoeven

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