All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] serial: sh-sci: FIFO initialization fixes
@ 2016-05-26 18:18 Geert Uytterhoeven
  2016-05-26 18:18 ` [PATCH 1/4] serial: sh-sci: Do not start transfers from sci_startup() Geert Uytterhoeven
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2016-05-26 18:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Magnus Damm
  Cc: linux-serial, linux-renesas-soc, Geert Uytterhoeven

	Hi Greg, Jiri, Magnus,

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.

This series applies against both v4.6 and next-20160526. 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-v1.

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 | 17 +++++++++++------
 drivers/tty/serial/sh-sci.h |  1 +
 2 files changed, 12 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] 9+ messages in thread

end of thread, other threads:[~2016-06-23 11:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-26 18:18 [PATCH 0/4] serial: sh-sci: FIFO initialization fixes Geert Uytterhoeven
2016-05-26 18:18 ` [PATCH 1/4] serial: sh-sci: Do not start transfers from sci_startup() Geert Uytterhoeven
2016-05-26 18:18 ` [PATCH 2/4] serial: sh-sci: Stop transfers in sci_shutdown() Geert Uytterhoeven
2016-06-21  7:35   ` Yoshihiro Shimoda
2016-06-21 14:52     ` Geert Uytterhoeven
2016-06-23 10:42       ` Yoshihiro Shimoda
2016-06-23 11:20         ` Geert Uytterhoeven
2016-05-26 18:18 ` [PATCH 3/4] serial: sh-sci: Clear RX, error, and break flags during reset Geert Uytterhoeven
2016-05-26 18:18 ` [PATCH 4/4] serial: sh-sci: Clear (H)SCIF timeout and overrun " Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.