[PATCH v2] serial: mxc: Keep the original FIFO empty check
Fabio Estevam
festevam at gmail.com
Wed Oct 26 00:56:57 CEST 2022
From: Fabio Estevam <festevam at denx.de>
Tim Harvey reported that since commit c7878a0483c5 ("serial: mxc:
have putc use the TXFIFO"), console messages put inside board_init()
are no longer printed correctly.
This change added a check to handle the UART FIFO full condition and
removed the UART FIFO empty check, which causes the problem.
To avoid console corruption, add back the original UART FIFO empty
check so that when the FIFO is empty, mxc_serial_putc() returns -EAGAIN
to the core serial-uclass.c.
This way the serial core can properly handle the UART empty condition
by not doing character transmission when -EAGAIN is returned.
Fixes: c7878a0483c5 ("serial: mxc: have putc use the TXFIFO")
Reported-by: Tim Harvey <tharvey at gateworks.com>
Signed-off-by: Fabio Estevam <festevam at denx.de>
---
Changes since v1:
- Add the check for FIFO full and FIFO empty.
drivers/serial/serial_mxc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 4cf79c1ca24f..d3fbe76065ec 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -311,7 +311,7 @@ static int mxc_serial_putc(struct udevice *dev, const char ch)
struct mxc_serial_plat *plat = dev_get_plat(dev);
struct mxc_uart *const uart = plat->reg;
- if (readl(&uart->ts) & UTS_TXFULL)
+ if ((readl(&uart->ts) & UTS_TXFULL) || !(readl(&uart->ts) & UTS_TXEMPTY))
return -EAGAIN;
writel(ch, &uart->txd);
--
2.25.1
More information about the U-Boot
mailing list