diff options
author | Kazuhiro Fujita <[email protected]> | 2020-03-27 18:17:28 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2020-04-16 16:16:52 +0200 |
commit | 3dc4db3662366306e54ddcbda4804acb1258e4ba (patch) | |
tree | 688fd4a8b7e5f6220c23b1f5d89ffb31ed266878 | |
parent | 0f87aa66e8c314f95c00eeff978c8a0b41e05d50 (diff) |
serial: sh-sci: Make sure status register SCxSR is read in correct sequence
For SCIF and HSCIF interfaces the SCxSR register holds the status of
data that is to be read next from SCxRDR register, But where as for
SCIFA and SCIFB interfaces SCxSR register holds status of data that is
previously read from SCxRDR register.
This patch makes sure the status register is read depending on the port
types so that errors are caught accordingly.
Cc: <[email protected]>
Signed-off-by: Kazuhiro Fujita <[email protected]>
Signed-off-by: Hao Bui <[email protected]>
Signed-off-by: KAZUMI HARADA <[email protected]>
Signed-off-by: Lad Prabhakar <[email protected]>
Tested-by: Geert Uytterhoeven <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index c073aa7001c4..e1179e74a2b8 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -870,9 +870,16 @@ static void sci_receive_chars(struct uart_port *port) tty_insert_flip_char(tport, c, TTY_NORMAL); } else { for (i = 0; i < count; i++) { - char c = serial_port_in(port, SCxRDR); - - status = serial_port_in(port, SCxSR); + char c; + + if (port->type == PORT_SCIF || + port->type == PORT_HSCIF) { + status = serial_port_in(port, SCxSR); + c = serial_port_in(port, SCxRDR); + } else { + c = serial_port_in(port, SCxRDR); + status = serial_port_in(port, SCxSR); + } if (uart_handle_sysrq_char(port, c)) { count--; i--; continue; |