serial: sh-sci: Clear (H)SCIF timeout and overrun during reset
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 24 Jun 2016 14:59:16 +0000 (16:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2016 16:09:53 +0000 (09:09 -0700)
Add the missing timeout bit definition for (H)SCIF.
Clear the timeout and overrun flag bits during UART reset, 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>
drivers/tty/serial/sh-sci.c
drivers/tty/serial/sh-sci.h

index 408f706..432d9ac 100644 (file)
@@ -2156,6 +2156,11 @@ static void sci_reset(struct uart_port *port)
        sci_clear_SCxSR(port,
                        SCxSR_RDxF_CLEAR(port) & SCxSR_ERROR_CLEAR(port) &
                        SCxSR_BREAK_CLEAR(port));
+       if (sci_getreg(port, SCLSR)->size) {
+               status = serial_port_in(port, SCLSR);
+               status &= ~(SCLSR_TO | SCLSR_ORER);
+               serial_port_out(port, SCLSR, status);
+       }
 }
 
 static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
index e7d2bc6..ffa6d68 100644 (file)
@@ -105,6 +105,7 @@ enum {
 #define SCFCR_LOOP     BIT(0)  /* Loopback Test */
 
 /* SCLSR (Line Status Register) on (H)SCIF */
+#define SCLSR_TO       BIT(2)  /* Timeout */
 #define SCLSR_ORER     BIT(0)  /* Overrun Error */
 
 /* SCSPTR (Serial Port Register), optional */