All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@toradex.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/3] toradex: common: unify behaviour when config block is missing
Date: Thu, 28 Mar 2019 14:29:56 +0000	[thread overview]
Message-ID: <CAByghJYsDdL++wd-cg+L9G0JkXttWbDVZRN8LbMg9NfnY-RoZQ@mail.gmail.com> (raw)
In-Reply-To: <20190325161829.7888-3-marcel@ziswiler.com>

Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>

On Mon, Mar 25, 2019 at 6:19 PM Marcel Ziswiler <marcel@ziswiler.com> wrote:
>
> From: Bhuvanchandra DV <bhuvanchandra.dv@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@toradex.com>
> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> ---
>
> Changes in v2:
> - Introduced a define for the Toradex OUI ("0x00142dUL") as suggested by
>   Igor.
> - Removed redundant comment as suggested by Igor.
>
>  board/toradex/common/tdx-common.c | 34 ++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
> index fde230c955..2d560cceaf 100644
> --- a/board/toradex/common/tdx-common.c
> +++ b/board/toradex/common/tdx-common.c
> @@ -12,6 +12,8 @@
>  #include <asm/setup.h>
>  #include "tdx-common.h"
>
> +#define TORADEX_OUI 0x00142dUL
> +
>  #ifdef CONFIG_TDX_CFG_BLOCK
>  static char tdx_serial_str[9];
>  static char tdx_board_rev_str[6];
> @@ -68,20 +70,25 @@ 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(TORADEX_OUI << 8);
> +               tdx_eth_addr.nic = htonl(tdx_serial << 8);
>                 checkboard();
> -               return 0;
> +       } else {
> +               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 +108,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

  reply	other threads:[~2019-03-28 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 16:18 [U-Boot] [PATCH v2 0/3] toradex: common: fix/improve config block handling Marcel Ziswiler
2019-03-25 16:18 ` [U-Boot] [PATCH v2 1/3] toradex: configblock: add an -y parameter to 'cfgblock create’ Marcel Ziswiler
2019-03-25 16:18 ` [U-Boot] [PATCH v2 2/3] toradex: common: unify behaviour when config block is missing Marcel Ziswiler
2019-03-28 14:29   ` Igor Opaniuk [this message]
2019-03-25 16:18 ` [U-Boot] [PATCH v2 3/3] tdx-cfg-block: fix off by one issue Marcel Ziswiler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAByghJYsDdL++wd-cg+L9G0JkXttWbDVZRN8LbMg9NfnY-RoZQ@mail.gmail.com \
    --to=igor.opaniuk@toradex.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.