summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Kumar Chaudhary <[email protected]>2026-06-07 21:06:31 +0530
committerLeo Yu-Chi Liang <[email protected]>2026-07-26 21:04:42 -0700
commitc201051a9cd3a358cb67cbba9b1c5fa717cf1c40 (patch)
tree8d88b3023cbb83272253367ba4f00c8263115a51
parentb3b5b305e2c9f09440bda5fd3edf9e230c54d94f (diff)
serial: sifive: remove busy-loops from getc and putc ops
The DM serial framework in __serial_getc() and __serial_putc() already retries when driver ops return -EAGAIN, calling schedule() between attempts to service the watchdog. sifive_serial_getc() and sifive_serial_putc() spin internally on -EAGAIN, which prevents the framework from calling schedule(). This can lead to watchdog timeouts when waiting for RX data or TX FIFO space. Remove the busy-loops and return -EAGAIN directly from the underlying helpers, letting the framework handle retries with proper watchdog servicing. This is consistent with how other DM serial drivers (pl01x, meson, cortina, etc.) implement their ops. Signed-off-by: Naveen Kumar Chaudhary <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
-rw-r--r--drivers/serial/serial_sifive.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
index e47828e4d6a..0203e2fc37c 100644
--- a/drivers/serial/serial_sifive.c
+++ b/drivers/serial/serial_sifive.c
@@ -144,23 +144,16 @@ static int sifive_serial_probe(struct udevice *dev)
static int sifive_serial_getc(struct udevice *dev)
{
- int c;
struct sifive_uart_plat *plat = dev_get_plat(dev);
- struct uart_sifive *regs = plat->regs;
-
- while ((c = _sifive_serial_getc(regs)) == -EAGAIN) ;
- return c;
+ return _sifive_serial_getc(plat->regs);
}
static int sifive_serial_putc(struct udevice *dev, const char ch)
{
- int rc;
struct sifive_uart_plat *plat = dev_get_plat(dev);
- while ((rc = _sifive_serial_putc(plat->regs, ch)) == -EAGAIN) ;
-
- return rc;
+ return _sifive_serial_putc(plat->regs, ch);
}
static int sifive_serial_pending(struct udevice *dev, bool input)