2022-11-10 08:35:47

by Sherry Sun

[permalink] [raw]
Subject: [PATCH V2 5/5] tty: serial: fsl_lpuart: clear LPUART Status Register in lpuart32_shutdown()

The LPUART Status Register needs to be cleared when closing the uart
port to get a clean environment when reopening the uart.

Fixes: 380c966c093e ("tty: serial: fsl_lpuart: add 32-bit register interface support")
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 | 4 ++++
1 file changed, 4 insertions(+)

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

spin_lock_irqsave(&port->lock, flags);

+ /* clear statue */
+ temp = lpuart32_read(&sport->port, UARTSTAT);
+ lpuart32_write(&sport->port, temp, UARTSTAT);
+
/* disable Rx/Tx DMA */
temp = lpuart32_read(port, UARTBAUD);
temp &= ~(UARTBAUD_TDMAE | UARTBAUD_RDMAE);
--
2.17.1



2022-11-23 11:10:05

by Michael Walle

[permalink] [raw]
Subject: Re: [PATCH V2 5/5] tty: serial: fsl_lpuart: clear LPUART Status Register in lpuart32_shutdown()

Am 2022-11-10 09:17, schrieb Sherry Sun:
> The LPUART Status Register needs to be cleared when closing the uart
> port to get a clean environment when reopening the uart.

Shouldn't it be cleared on startup instead? What if there was some
kind of event between shutdown and startup?

-michael

2022-11-23 12:41:51

by Sherry Sun

[permalink] [raw]
Subject: RE: [PATCH V2 5/5] tty: serial: fsl_lpuart: clear LPUART Status Register in lpuart32_shutdown()



> -----Original Message-----
> From: Michael Walle <[email protected]>
> Sent: 2022??11??23?? 18:36
> To: Sherry Sun <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; dl-linux-imx <[email protected]>
> Subject: Re: [PATCH V2 5/5] tty: serial: fsl_lpuart: clear LPUART Status
> Register in lpuart32_shutdown()
>
> Am 2022-11-10 09:17, schrieb Sherry Sun:
> > The LPUART Status Register needs to be cleared when closing the uart
> > port to get a clean environment when reopening the uart.
>
> Shouldn't it be cleared on startup instead? What if there was some kind of
> event between shutdown and startup?
>

Hi Michael, same as what we discussed under another patch, unfortunately the .startup() won??t clear the status of the uart port.

Best Regards
Sherry