summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/fsl_lpuart.c
diff options
context:
space:
mode:
authorSherry Sun <sherry.sun@nxp.com>2022-08-21 12:15:27 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-30 14:32:33 +0200
commitd5a2e0834364377a5d5a2fff1890a0b3f0bafd1f (patch)
treecebeb45fdb89ea3638e5c8d015f0d5caa8599686 /drivers/tty/serial/fsl_lpuart.c
parenttty: Fix lookahead_buf crash with serdev (diff)
downloadlinux-d5a2e0834364377a5d5a2fff1890a0b3f0bafd1f.tar.xz
linux-d5a2e0834364377a5d5a2fff1890a0b3f0bafd1f.zip
tty: serial: lpuart: disable flow control while waiting for the transmit engine to complete
When the user initializes the uart port, and waits for the transmit engine to complete in lpuart32_set_termios(), if the UART TX fifo has dirty data and the UARTMODIR enable the flow control, the TX fifo may never be empty. So here we should disable the flow control first to make sure the transmit engin can complete. Fixes: 380c966c093e ("tty: serial: fsl_lpuart: add 32-bit register interface support") Cc: stable <stable@kernel.org> Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Link: https://lore.kernel.org/r/20220821101527.10066-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/fsl_lpuart.c')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index e9ba0f0bd441..b20f6f2fa51c 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -2191,6 +2191,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
uart_update_timeout(port, termios->c_cflag, baud);
/* wait transmit engin complete */
+ lpuart32_write(&sport->port, 0, UARTMODIR);
lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC);
/* disable transmit and receive */