[U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found

Simon Glass sjg at chromium.org
Mon Jul 6 18:39:13 CEST 2015


Hi Hans,

On 5 July 2015 at 12:56, Hans de Goede <hdegoede at redhat.com> wrote:
> Some boards simply do not have any serial ports. Also no one will see the
> panic message as there is no where to print it if no serial port is found
> (and other stdout options are not yet set up at this point).
>

It is visible (or will be when some patches land) if you have a debug
UART set up.

> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  drivers/serial/serial-uclass.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
> index 815fec3..f036499 100644
> --- a/drivers/serial/serial-uclass.c
> +++ b/drivers/serial/serial-uclass.c
> @@ -27,7 +27,7 @@ static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
>  #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work"
>  #endif
>
> -static void serial_find_console_or_panic(void)
> +static void serial_find_console(void)
>  {
>         struct udevice *dev;
>         int node;
> @@ -77,14 +77,12 @@ static void serial_find_console_or_panic(void)
>                 }
>  #undef INDEX
>         }
> -
> -       panic_str("No serial driver found");
>  }
>
>  /* Called prior to relocation */
>  int serial_init(void)
>  {
> -       serial_find_console_or_panic();
> +       serial_find_console();
>         gd->flags |= GD_FLG_SERIAL_READY;
>
>         return 0;
> @@ -93,7 +91,7 @@ int serial_init(void)
>  /* Called after relocation */
>  void serial_initialize(void)
>  {
> -       serial_find_console_or_panic();
> +       serial_find_console();
>  }
>
>  static void _serial_putc(struct udevice *dev, char ch)

How is this handled before driver model? It is possible to mark a
device disabled in device tree - perhaps we should have a way to see
that the console is present (i.e. there is an alias) but it is
disabled?

Normally a serial console is required, so I'd like to preserve this
behaviour for most boards.

Regards,
Simon


More information about the U-Boot mailing list