serial: sh-sci: Fix hang in sci_reset()

When the .set_termios() callback resets the UART, it first waits (busy
loops) until all characters in the transmit FIFO have been transmitted,
to prevent a port configuration change from impacting these characters.

However, if the UART has dedicated RTS/CTS hardware flow control
enabled, these characters may have been stuck in the FIFO due to CTS not
being asserted by the remote side.

  - When a new user opens the port, .set_termios() is called while
    transmission is still disabled, leading to an infinite loop:

	NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s!

  - When an active user changes port configuration without waiting for
    the draining of the transmit FIFO, this may also block indefinitely,
    until CTS is asserted by the remote side.

This has been observed with SCIFA (on r8a7740/armadillo), and SCIFB and
HSCIF (on r8a7791/koelsch).

To fix this, remove the code that waits for the draining of the transmit
FIFO.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Geert Uytterhoeven 2017-03-28 11:13:44 +02:00 committed by Greg Kroah-Hartman
parent b5090cb46e
commit e37f712f76
1 changed files with 0 additions and 4 deletions

View File

@ -2159,10 +2159,6 @@ static void sci_reset(struct uart_port *port)
unsigned int status; unsigned int status;
struct sci_port *s = to_sci_port(port); struct sci_port *s = to_sci_port(port);
do {
status = serial_port_in(port, SCxSR);
} while (!(status & SCxSR_TEND(port)));
serial_port_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ serial_port_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
reg = sci_getreg(port, SCFCR); reg = sci_getreg(port, SCFCR);