Skip to content

Commit 2411fd9

Browse files
SherrySun5gregkh
authored andcommitted
tty: serial: fsl_lpuart: skip waiting for transmission complete when UARTCTRL_SBK is asserted
According to LPUART RM, Transmission Complete Flag becomes 0 if queuing a break character by writing 1 to CTRL[SBK], so here need to skip waiting for transmission complete when UARTCTRL_SBK is asserted, otherwise the kernel may stuck here. And actually set_termios() adds transmission completion waiting to avoid data loss or data breakage when changing the baud rate, but we don't need to worry about this when queuing break characters. Signed-off-by: Sherry Sun <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2d638be commit 2411fd9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/tty/serial/fsl_lpuart.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,9 +2240,15 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
22402240
/* update the per-port timeout */
22412241
uart_update_timeout(port, termios->c_cflag, baud);
22422242

2243-
/* wait transmit engin complete */
2244-
lpuart32_write(&sport->port, 0, UARTMODIR);
2245-
lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC);
2243+
/*
2244+
* LPUART Transmission Complete Flag may never be set while queuing a break
2245+
* character, so skip waiting for transmission complete when UARTCTRL_SBK is
2246+
* asserted.
2247+
*/
2248+
if (!(old_ctrl & UARTCTRL_SBK)) {
2249+
lpuart32_write(&sport->port, 0, UARTMODIR);
2250+
lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC);
2251+
}
22462252

22472253
/* disable transmit and receive */
22482254
lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE),

0 commit comments

Comments
 (0)