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: <stable@vger.kernel.org> Signed-off-by: Kazuhiro Fujita <kazuhiro.fujita.jg@renesas.com> Signed-off-by: Hao Bui <hao.bui.yg@renesas.com> Signed-off-by: KAZUMI HARADA <kazumi.harada.rh@renesas.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/1585333048-31828-1-git-send-email-kazuhiro.fujita.jg@renesas.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0f87aa66e8
commit
3dc4db3662
|
@ -870,9 +870,16 @@ static void sci_receive_chars(struct uart_port *port)
|
||||||
tty_insert_flip_char(tport, c, TTY_NORMAL);
|
tty_insert_flip_char(tport, c, TTY_NORMAL);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
char c = serial_port_in(port, SCxRDR);
|
char c;
|
||||||
|
|
||||||
|
if (port->type == PORT_SCIF ||
|
||||||
|
port->type == PORT_HSCIF) {
|
||||||
status = serial_port_in(port, SCxSR);
|
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)) {
|
if (uart_handle_sysrq_char(port, c)) {
|
||||||
count--; i--;
|
count--; i--;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue