Skip to contentSkip to conversation

tty: serial: fsl_lpuart: Fix lpuart_flush_buffer()

PATCH In review Andrey Smirnov 4 participants 4 messages Oct 4, 2019 – Oct 5, 2019 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: serial: fsl_lpuart: Fix lpuart_flush_buffer()

Fix incorrect read-modify-write sequence in lpuart_flush_buffer() that was reading from UARTPFIFO and writing to UARTCFIFO instead of operating solely on the latter.

Fixes 9bc19af9dacb ("tty: serial: fsl_lpuart: Flush HW FIFOs in .flush_buffer")
Cc Stefan Agner <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Vivien Didelot <[email protected]>
Cc Chris Healy <[email protected]>
Cc Cory Tusar <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>

---

Greg:

This bug causes occasional boot hang on 5.4-rc1 on Vybrid, so it might be good to push that for 5.4-rc2.

Thanks,
Andrey Sirnov

 drivers/tty/serial/fsl_lpuart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/fsl_lpuart.c +1 -1
index 3e17bb8a0b16..537896c4d887 100644
@@ -548,7 +548,7 @@ static void lpuart_flush_buffer(struct uart_port *port)
 		val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH;
 		lpuart32_write(&sport->port, val, UARTFIFO);
 	} else {
-		val = readb(sport->port.membase + UARTPFIFO);
+		val = readb(sport->port.membase + UARTCFIFO);
 		val |= UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH;
 		writeb(val, sport->port.membase + UARTCFIFO);
 	}
Signature · 1 line
2.21.0
Tested-by on v1 1/1
#3 lore raw
In reply to Andrey Smirnov

Hi Andrey,

Quoted 6 lines · Andrey Smirnov

Fix incorrect read-modify-write sequence in lpuart_flush_buffer() that was reading from UARTPFIFO and writing to UARTCFIFO instead of operating solely on the latter.

Fixes 9bc19af9dacb ("tty: serial: fsl_lpuart: Flush HW FIFOs in .flush_buffer")

This fixes the TTY on my ZII Devel Boards Rev B and C:

Thank you!

Vivien