[U-Boot] [PATCH v1 2/3] toradex: common: unify behaviour when config block is missing

Igor Opaniuk igor.opaniuk at toradex.com
Thu Mar 7 05:21:15 UTC 2019


Just some minor stuff:

On Fri, 1 Feb 2019 at 17:22, Marcel Ziswiler <marcel at ziswiler.com> wrote:
>
> From: Bhuvanchandra DV <bhuvanchandra.dv at toradex.com>
>
> If the config block is missing, various things may fail or behave
> strangely on certain modules. This patch unifies that behaviour by
> using a fake MAC address, until user updates the config block.
>
> Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv at toradex.com>
> Acked-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
>
> ---
>
>  board/toradex/common/tdx-common.c | 33 ++++++++++++++++---------------
>  1 file changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
> index fde230c955..e7234686ae 100644
> --- a/board/toradex/common/tdx-common.c
> +++ b/board/toradex/common/tdx-common.c
> @@ -68,20 +68,26 @@ int show_board_info(void)
>         unsigned char ethaddr[6];
>
>         if (read_tdx_cfg_block()) {
> -               printf("Missing Toradex config block\n");
> +               printf("MISSING TORADEX CONFIG BLOCK\n");
> +               tdx_eth_addr.oui = htonl(0x00142dUL << 8);

Could you please introduce a define for this magic number ("0x00142dUL")?

> +               tdx_eth_addr.nic = htonl(tdx_serial << 8);
>                 checkboard();
> -               return 0;
> +       } else {
> +               /* board serial-number */
redundant comment, this is obvious that the next few lines are for
printing board serial number.
> +               sprintf(tdx_serial_str, "%08u", tdx_serial);
> +               sprintf(tdx_board_rev_str, "V%1d.%1d%c",
> +                       tdx_hw_tag.ver_major,
> +                       tdx_hw_tag.ver_minor,
> +                       (char)tdx_hw_tag.ver_assembly + 'A');
> +
> +               env_set("serial#", tdx_serial_str);
> +
> +               printf("Model: Toradex %s %s, Serial# %s\n",
> +                      toradex_modules[tdx_hw_tag.prodid],
> +                      tdx_board_rev_str,
> +                      tdx_serial_str);
>         }
>
> -       /* board serial-number */
> -       sprintf(tdx_serial_str, "%08u", tdx_serial);
> -       sprintf(tdx_board_rev_str, "V%1d.%1d%c",
> -               tdx_hw_tag.ver_major,
> -               tdx_hw_tag.ver_minor,
> -               (char)tdx_hw_tag.ver_assembly + 'A');
> -
> -       env_set("serial#", tdx_serial_str);
> -
>         /*
>          * Check if environment contains a valid MAC address,
>          * set the one from config block if not
> @@ -101,11 +107,6 @@ int show_board_info(void)
>         }
>  #endif
>
> -       printf("Model: Toradex %s %s, Serial# %s\n",
> -              toradex_modules[tdx_hw_tag.prodid],
> -              tdx_board_rev_str,
> -              tdx_serial_str);
> -
>         return 0;
>  }
>
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list