summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMehmet Fide <mehmet.fide@screeningeagle.com>2026-08-06 14:48:00 +0200
committerFabio Estevam <festevam@gmail.com>2026-08-14 16:14:01 -0300
commit6a385d0d85c79e6916d720f303994a22af46633b (patch)
tree44ed26e8fa4e52067a3c7c7e969310820a4b19d1
parentba8c3a1f6ea960dc0d57c25c4422c7ddad1732b4 (diff)
downloadu-boot-6a385d0d85c79e6916d720f303994a22af46633b.tar.gz
u-boot-6a385d0d85c79e6916d720f303994a22af46633b.zip
serial: lpuart: test the receive flag, not the FIFO counter
On the 8 bit register variant, the only user of which is fsl,vf610-lpuart, _lpuart_serial_init() disables the FIFO: /* Disable FIFO and flush buffer */ __raw_writeb(0x0, &base->upfifo); while _lpuart_serial_tstc() asks the receive FIFO counter whether a character arrived: if (__raw_readb(&base->urcfifo) == 0) return 0; With the FIFO disabled the dataword lands in the data register and raises S1[RDRF], but RCFIFO stays zero, so tstc() never reports a character. The console is then output only: autoboot cannot be interrupted, ctrlc() never fires, and anything polling for a key waits forever. _lpuart_serial_getc() in the same driver already tests S1, and the 32 bit variant enables its FIFO in _lpuart32_serial_init() before reading the RXCOUNT field of WATER, so only this path is inconsistent. Test S1 the way getc() does. Tested on a Colibri VF50: U-Boot printed its whole log over UART0 but accepted no input at all, neither a key during the boot delay nor Ctrl-C during a sleep, while Linux received on the same pads with the same pin mux. With the fix the boot delay can be interrupted, including with bootdelay=0, where the key is already buffered when abortboot_single_key() checks. Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
-rw-r--r--drivers/serial/serial_lpuart.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 917445e1ee2..dccd0974150 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -194,10 +194,11 @@ static int _lpuart_serial_tstc(struct lpuart_serial_plat *plat)
{
struct lpuart_fsl *base = plat->reg;
- if (__raw_readb(&base->urcfifo) == 0)
- return 0;
-
- return 1;
+ /*
+ * The receive FIFO counter stays at zero because _lpuart_serial_init()
+ * disables the FIFO, so ask the status register, the way getc() does.
+ */
+ return __raw_readb(&base->us1) & (US1_RDRF | US1_OR) ? 1 : 0;
}
/*