summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSherry Sun <sherry.sun@nxp.com>2025-01-07 15:48:34 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-07 11:50:05 +0100
commitd78a89990986a4d7d34313d3f58f8596b8ae1222 (patch)
treebcc71c56d284ffa59cd5fd4e7ec0773c687cf83d
parent79d65fda55cf1a6dac96a69913cd2294a3d8948a (diff)
tty: serial: fsl_lpuart: flush RX and TX FIFO when lpuart shutdown
Need to flush UART RX and TX FIFO when lpuart is shutting down to make sure restore a clean data transfer environment. Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Link: https://lore.kernel.org/r/20250107074834.3115230-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/fsl_lpuart.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 7cb1e36fdaab..c91b9d9818cd 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1965,6 +1965,11 @@ static void lpuart32_shutdown(struct uart_port *port)
UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE | UARTCTRL_SBK);
lpuart32_write(port, temp, UARTCTRL);
+ /* flush Rx/Tx FIFO */
+ temp = lpuart32_read(port, UARTFIFO);
+ temp |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH;
+ lpuart32_write(port, temp, UARTFIFO);
+
uart_port_unlock_irqrestore(port, flags);
lpuart_dma_shutdown(sport);