diff options
author | Sherry Sun <sherry.sun@nxp.com> | 2023-01-30 13:41:07 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-31 10:53:34 +0100 |
commit | 8a79052c329ed7d738411286dba8c5896fa96140 (patch) | |
tree | 67ef9b27621af77ea83d6b464645ddca758e625d /drivers/tty | |
parent | ed0400ad547c0b88d2f06ecf22a089eb2e84c9b7 (diff) |
tty: serial: fsl_lpuart: don't enable receiver/transmitter before rx/tx dma ready
lpuart32_setup_watermark_enable() will configure the UART FIFO and
watermark, also enable the receiver and transmitter, this should be done
after the rx/tx dma steup ready.
Also add lpuart32_hw_disable() to make sure the receiver/transmitter and
interrupts are disabled during the dma steup.
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Link: https://lore.kernel.org/r/20230130054107.9119-1-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/fsl_lpuart.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 04fecff2fa5f..eac5243a9db0 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1702,6 +1702,16 @@ static int lpuart_startup(struct uart_port *port) return 0; } +static void lpuart32_hw_disable(struct lpuart_port *sport) +{ + unsigned long temp; + + temp = lpuart32_read(&sport->port, UARTCTRL); + temp &= ~(UARTCTRL_RIE | UARTCTRL_ILIE | UARTCTRL_RE | + UARTCTRL_TIE | UARTCTRL_TE); + lpuart32_write(&sport->port, temp, UARTCTRL); +} + static void lpuart32_configure(struct lpuart_port *sport) { unsigned long temp; @@ -1726,11 +1736,12 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) spin_lock_irqsave(&sport->port.lock, flags); - lpuart32_setup_watermark_enable(sport); + lpuart32_hw_disable(sport); lpuart_rx_dma_startup(sport); lpuart_tx_dma_startup(sport); + lpuart32_setup_watermark_enable(sport); lpuart32_configure(sport); spin_unlock_irqrestore(&sport->port.lock, flags); |