2022-11-10 08:52:45

by Sherry Sun

[permalink] [raw]
Subject: [PATCH V2 0/5] fsl_lpuart: improve Idle Line Interrupt and registers handle in .shutdown()

The patchset improve the Idle Line Interrupt for lpuart driver, also handle
the registers correctly for lpuart32 when closing the uart port.

Patches have been tested on imx8ulp-evk platform.

Sherry Sun (5):
tty: serial: fsl_lpuart: only enable Idle Line Interrupt for non-dma
case
tty: serial: fsl_lpuart: clear UARTCTRL_LOOPS in lpuart32_shutdown()
tty: serial: fsl_lpuart: clear UARTMODIR register in
lpuart32_shutdown()
tty: serial: fsl_lpuart: disable Rx/Tx DMA in lpuart32_shutdown()
tty: serial: fsl_lpuart: clear LPUART Status Register in
lpuart32_shutdown()

drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)

--
2.17.1



2022-11-10 09:37:33

by Sherry Sun

[permalink] [raw]
Subject: [PATCH V2 4/5] tty: serial: fsl_lpuart: disable Rx/Tx DMA in lpuart32_shutdown()

UARTBAUD_RDMAE and UARTBAUD_TDMAE are enabled in lpuart32_startup(), but
lpuart32_shutdown() not disable them, only free the dma ring buffer and
release the dma channels, so here disable the Rx/Tx DMA first in
lpuart32_shutdown().

Fixes: 42b68768e51b ("serial: fsl_lpuart: DMA support for 32-bit variant")
Signed-off-by: Sherry Sun <[email protected]>
---
Changes in V2:
1. Split one patch into four smaller patches to improve the commit
messages and add Fixes tag as suggested by Ilpo.
---
drivers/tty/serial/fsl_lpuart.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index a6f7b056d57b..c297be11422a 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1769,6 +1769,11 @@ static void lpuart32_shutdown(struct uart_port *port)

spin_lock_irqsave(&port->lock, flags);

+ /* disable Rx/Tx DMA */
+ temp = lpuart32_read(port, UARTBAUD);
+ temp &= ~(UARTBAUD_TDMAE | UARTBAUD_RDMAE);
+ lpuart32_write(port, temp, UARTBAUD);
+
/* disable Rx/Tx and interrupts */
temp = lpuart32_read(port, UARTCTRL);
temp &= ~(UARTCTRL_TE | UARTCTRL_RE | UARTCTRL_ILIE |
--
2.17.1