serial: lpuart: fix RXFE filed offset and handle Overrun flag
cover serial: lpuart: fix RXFE filed offset and handle Overrun flag
This couple patches fixes the RXFE filed offset on i.MX9 platforms and handle the Overrun flag which can prevent user from accessing the U-Boot prompt.
---
Sébastien Szymanski (2):
serial: lpuart: fix RXFE filed offset for i.MX9
serial: lpuart: handle Overrun flag
drivers/serial/serial_lpuart.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
---
base-commit: 8666b16015d4212facacc514e2eb626f3630dcf0
change-id: 20260218-lpuart-fix-rxfe-offset-f04ef861ae99
Best regards,
Signature · 1 line
Sébastien Szymanski <[email protected]>
PATCH 1/2 serial: lpuart: fix RXFE filed offset for i.MX9
Like i.MX8 and i.MXRT, on i.MX9, the Receive RX FIFO Enable (RXFE) field in LPUART FIFO register is bit 3, so set FIFO_RXFE to 0x08 on i.MX9 too.
--- drivers/serial/serial_lpuart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/serial/serial_lpuart.c +2 -1
@@ -53,7 +53,8 @@#define FIFO_RXSIZE_MASK 0x7#define FIFO_RXSIZE_OFF 0#define FIFO_TXFE 0x80 -#if defined(CONFIG_ARCH_IMX8 ) || defined(CONFIG_ARCH_IMXRT ) +#if defined(CONFIG_ARCH_IMX8 ) || defined (CONFIG_ARCH_IMX9 ) || \ + defined(CONFIG_ARCH_IMXRT )#define FIFO_RXFE 0x08#else #define FIFO_RXFE 0x40
Signature · 1 line
2.52.0
RE: [PATCH 1/2] serial: lpuart: fix RXFE filed offset for i.MX9
Quoted 8 lines
Subject: [PATCH 1/2] serial: lpuart: fix RXFE filed offset for i.MX9
Like i.MX8 and i.MXRT, on i.MX9, the Receive RX FIFO Enable (RXFE) field in LPUART FIFO register is bit 3, so set
FIFO_RXFEto0x08on i.MX9 too.Signed-off-by: Sébastien Szymanski
<[email protected]>
LGTM: Reviewed-by: Peng Fan <[email protected]>
Re: [PATCH 1/2] serial: lpuart: fix RXFE filed offset for i.MX9
In reply to Sébastien SzymanskiQuoted 13 lines · Sébastien Szymanski
Like i.MX8 and i.MXRT, on i.MX9, the Receive RX FIFO Enable (RXFE) field in LPUART FIFO register is bit 3, so set
FIFO_RXFEto0x08on i.MX9 too.Signed-off-by Sébastien Szymanski <[email protected]>--- drivers/serial/serial_lpuart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/serial/serial_lpuart.c +0
-0
drivers/serial/serial_lpuart.c line 60
Quoted 9 lines
drivers/serial/serial_lpuart.c +2
-1@@ -53,7 +53,8 @@#define FIFO_RXSIZE_MASK 0x7#define FIFO_RXSIZE_OFF 0#define FIFO_TXFE 0x80 -#if defined(CONFIG_ARCH_IMX8 ) || defined(CONFIG_ARCH_IMXRT ) +#if defined(CONFIG_ARCH_IMX8 ) || defined (CONFIG_ARCH_IMX9 ) || \ + defined(CONFIG_ARCH_IMXRT )#define FIFO_RXFE 0x08#else #define FIFO_RXFE 0x40
Previous value 0x40 is wrong for all platforms. You can directly change it to 0x08 and remove all ARCH marcos.
Best regards,
Ye Li
Quoted 1 line
PATCH 2/2 serial: lpuart: handle Overrun flag
In reply to Sébastien SzymanskiThe 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()
--- drivers/serial/serial_lpuart.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/serial/serial_lpuart.c +5 -2
@@ -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 ;
Signature · 1 line
2.52.0
RE: [PATCH 2/2] serial: lpuart: handle Overrun flag
Quoted 11 lines
Subject: [PATCH 2/2] serial: lpuart: handle Overrun flag
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
<[email protected]>
LGTM: Reviewed-by: Peng Fan <[email protected]>
Quoted 2 lines · On Wed, 18 Feb 2026 15:59:17 +0100 Sébastien Szymanski…
This couple patches fixes the RXFE filed offset on i.MX9 platforms and handle the Overrun flag which can prevent user from accessing the U-Boot prompt.
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com