aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sh-sci.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2016-06-24 16:59:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-25 09:09:53 -0700
commit2768cf42874ae04bdbc33a9c9db96181dc0bbb8d (patch)
tree4298e3d7ee8b4e6c6c843fb4c3a66918a7d953b2 /drivers/tty/serial/sh-sci.c
parentserial: sh-sci: Do not start transfers from sci_startup() (diff)
downloadlinux-dev-2768cf42874ae04bdbc33a9c9db96181dc0bbb8d.tar.xz
linux-dev-2768cf42874ae04bdbc33a9c9db96181dc0bbb8d.zip
serial: sh-sci: Clear RX, error, and break flags during reset
Setting the FIFO reset bits is not sufficient to reset the RX FIFO. After this the status register's RDF flag bit may still be set, causing the reception of one stale byte of data. To fix this, clear all status flag bits related to reception, error, and break handling, cfr. the initialization flowchart in the datasheet. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r--drivers/tty/serial/sh-sci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d88c84cd88a4..408f706393de 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2152,6 +2152,10 @@ static void sci_reset(struct uart_port *port)
reg = sci_getreg(port, SCFCR);
if (reg->size)
serial_port_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
+
+ sci_clear_SCxSR(port,
+ SCxSR_RDxF_CLEAR(port) & SCxSR_ERROR_CLEAR(port) &
+ SCxSR_BREAK_CLEAR(port));
}
static void sci_set_termios(struct uart_port *port, struct ktermios *termios,