* [PATCH V2] tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms
@ 2023-08-01 2:23 Sherry Sun
0 siblings, 0 replies; only message in thread
From: Sherry Sun @ 2023-08-01 2:23 UTC (permalink / raw)
To: gregkh, jirislaby, atsushi.nemoto, tomonori.sakita
Cc: linux-serial, linux-kernel, linux-imx
Do not read the data register to clear the error flags for lpuart32
platforms, the additional read may cause the receive FIFO underflow
since the DMA has already read the data register.
Actually all lpuart32 platforms support write 1 to clear those error
bits, let's use this method to better clear the error flags.
Fixes: 42b68768e51b ("serial: fsl_lpuart: DMA support for 32-bit variant")
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
---
Changes in V2:
1. Improve commit message to avoid confusion as commented by Jiri.
---
drivers/tty/serial/fsl_lpuart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index f6644c5989d3..f72e1340b47d 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1120,8 +1120,8 @@ static void lpuart_copy_rx_to_tty(struct lpuart_port *sport)
unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
if (sr & (UARTSTAT_PE | UARTSTAT_FE)) {
- /* Read DR to clear the error flags */
- lpuart32_read(&sport->port, UARTDATA);
+ /* Clear the error flags */
+ lpuart32_write(&sport->port, sr, UARTSTAT);
if (sr & UARTSTAT_PE)
sport->port.icount.parity++;
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-01 2:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-01 2:23 [PATCH V2] tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms Sherry Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®