From: Chen Baozi <chenbaozi@phytium.com.cn>
Date: Mon, 19 Jul 2021 07:36:04 +0000 (+0800)
Subject: serial: pl011: Resend the character if FIFO is full in debug uart
X-Git-Tag: v2025.01-rc5-pxa1908~1781^2~2
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/%7B%7B%20%24.Site.BaseURL%20%7D%7Dposts/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=198201509a460c8f1b85e3447b35599129f4f885;p=u-boot.git

serial: pl011: Resend the character if FIFO is full in debug uart

pl01x_putc() might return -EAGAIN if there was no space in FIFO. In that
case, high-level caller should wait until there is space and resend the
character.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index 76b96ad414..8ff19acf33 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -417,7 +417,8 @@ static inline void _debug_uart_putc(int ch)
 {
 	struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
 
-	pl01x_putc(regs, ch);
+	while (pl01x_putc(regs, ch) == -EAGAIN)
+		;
 }
 
 DEBUG_UART_FUNCS