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>
This commit is contained in:
Sherry Sun 2025-01-07 15:48:34 +08:00 committed by Greg Kroah-Hartman
parent 79d65fda55
commit d78a899909

View File

@ -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);