From: Sherry Sun Date: Tue, 7 Jan 2025 07:48:34 +0000 (+0800) Subject: tty: serial: fsl_lpuart: flush RX and TX FIFO when lpuart shutdown X-Git-Tag: v6.14-rc1~59^2~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d78a89990986a4d7d34313d3f58f8596b8ae1222;p=thirdparty%2Fkernel%2Flinux.git 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 Link: https://lore.kernel.org/r/20250107074834.3115230-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 7cb1e36fdaab7..c91b9d9818cd8 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);