All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: pl011: Resend the character if FIFO is full in debug uart
@ 2021-07-18  8:36 Chen Baozi
  2021-07-19  6:17 ` Stefan Roese
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Baozi @ 2021-07-18  8:36 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass, Tom Rini

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>
---
 drivers/serial/serial_pl01x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index 76b96ad414..17b26aed81 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -417,7 +417,7 @@ 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
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] serial: pl011: Resend the character if FIFO is full in debug uart
  2021-07-18  8:36 [PATCH] serial: pl011: Resend the character if FIFO is full in debug uart Chen Baozi
@ 2021-07-19  6:17 ` Stefan Roese
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2021-07-19  6:17 UTC (permalink / raw)
  To: Chen Baozi, u-boot; +Cc: Simon Glass, Tom Rini

On 18.07.21 10:36, Chen Baozi wrote:
> 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>
> ---
>   drivers/serial/serial_pl01x.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
> index 76b96ad414..17b26aed81 100644
> --- a/drivers/serial/serial_pl01x.c
> +++ b/drivers/serial/serial_pl01x.c
> @@ -417,7 +417,7 @@ 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);

I just recently also stumbled over this problem, that this serial driver
did "swallow" many char's in the early debug stage.

Coding style is a bit non-optimal though IMHO. Please move the ";" into
the next newline instead.

Other than that:

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-19  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-18  8:36 [PATCH] serial: pl011: Resend the character if FIFO is full in debug uart Chen Baozi
2021-07-19  6:17 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.