[PATCH 2/2] serial: lpuart: handle Overrun flag
Sébastien Szymanski
sebastien.szymanski at armadeus.com
Wed Feb 18 15:59:19 CET 2026
The receive FIFO may overflow if data are sent while U-Boot is still
booting. In that case, the Overrun flag (STAT[19]) is set and no
additional data is stored in the receive FIFO and the user cannot get
access to the U-Boot prompt.
Fix this by clearing the Overrun flag in _lpuart32_serial_tstc()
Signed-off-by: Sébastien Szymanski <sebastien.szymanski at armadeus.com>
---
drivers/serial/serial_lpuart.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index bbce59443388..0728feccd131 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -367,10 +367,13 @@ static int _lpuart32_serial_putc(struct lpuart_serial_plat *plat,
static int _lpuart32_serial_tstc(struct lpuart_serial_plat *plat)
{
struct lpuart_fsl_reg32 *base = plat->reg;
- u32 water;
+ u32 water, stat;
- lpuart_read32(plat->flags, &base->water, &water);
+ lpuart_read32(plat->flags, &base->stat, &stat);
+ if (stat & STAT_OR)
+ lpuart_write32(plat->flags, &base->stat, STAT_OR);
+ lpuart_read32(plat->flags, &base->water, &water);
if ((water >> 24) == 0)
return 0;
--
2.52.0
More information about the U-Boot
mailing list