tty: serial: fsl_lpuart: skip waiting for transmission complete when UARTCTRL_SBK is asserted
commit 2411fd94ceaa6e11326e95d6ebf876cbfed28d23 upstream. 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 <sherry.sun@nxp.com> Cc: stable <stable@kernel.org> Link: https://lore.kernel.org/r/20230223093941.31790-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
020166bc66
commit
f5a5150c70
@@ -2159,9 +2159,15 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||||||
/* update the per-port timeout */
|
/* update the per-port timeout */
|
||||||
uart_update_timeout(port, termios->c_cflag, baud);
|
uart_update_timeout(port, termios->c_cflag, baud);
|
||||||
|
|
||||||
/* wait transmit engin complete */
|
/*
|
||||||
lpuart32_write(&sport->port, 0, UARTMODIR);
|
* LPUART Transmission Complete Flag may never be set while queuing a break
|
||||||
lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC);
|
* character, so skip waiting for transmission complete when UARTCTRL_SBK is
|
||||||
|
* asserted.
|
||||||
|
*/
|
||||||
|
if (!(old_ctrl & UARTCTRL_SBK)) {
|
||||||
|
lpuart32_write(&sport->port, 0, UARTMODIR);
|
||||||
|
lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC);
|
||||||
|
}
|
||||||
|
|
||||||
/* disable transmit and receive */
|
/* disable transmit and receive */
|
||||||
lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE),
|
lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE),
|
||||||
|
Reference in New Issue
Block a user