[U-Boot] [PATCH] debug uart: don't print before initialization

Simon Glass sjg at chromium.org
Tue Oct 9 03:40:53 UTC 2018


Hi,

On 7 October 2018 at 11:52, Simon Goldschmidt
<simon.k.r.goldschmidt at gmail.com> wrote:
> At least on socfpga gen5, _debug_uart_putc() can be called
> before debug_uart_init(), which leaves us stuck in an
> infinite loop in the ns16550 debug uart driver.

Can you fix that? That is a bug.

>
> Since this prevents debugging startup problems instead
> of helping, let's add a field to 'gd' that prevents
> calling the _debug_uart_putc() until debug_uart_init()
> has been called.
>
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> ---
>
>  include/asm-generic/global_data.h |  3 +++
>  include/debug_uart.h              | 19 ++++++++++++++-----
>  2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index c83fc01b76..9de7f48476 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -122,6 +122,9 @@ typedef struct global_data {
>         struct list_head log_head;      /* List of struct log_device */
>         int log_fmt;                    /* Mask containing log format info */
>  #endif
> +#ifdef CONFIG_DEBUG_UART
> +       int debug_uart_initialized;     /* No print before debug_uart_init */
> +#endif

There is no requirement that gd be set up before the debug UART is
running. It certainly isn't on the few platforms I know about.

Regards,
Simon


More information about the U-Boot mailing list