U-boot Archive mirror
 help / color / mirror / Atom feed
From: E Shattow <lucent@gmail.com>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Minda Chen <minda.chen@starfivetech.com>,
	Hal Feng <hal.feng@starfivetech.com>,
	 Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>,
	 Aurelien Jarno <aurelien@aurel32.net>,
	Lukasz Tekieli <tekieli.lukasz@gmail.com>,
	 Lukas Funke <lukas.funke@weidmueller.com>,
	Shiji Yang <yangshiji66@outlook.com>,
	Shengyu Qu <wiagn233@outlook.com>,
	Michal Simek <michal.simek@amd.com>,
	 Seung-Woo Kim <sw0312.kim@samsung.com>,
	Mason Huo <mason.huo@starfivetech.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH v4 5/5] starfive: add mac vendor sub-command
Date: Fri, 10 May 2024 21:20:36 -0700	[thread overview]
Message-ID: <CANV2PTN3Kfd7SG_ENw5FqXCuKSEWvNj3_58oR0SyYnL5H0Hpbw@mail.gmail.com> (raw)
In-Reply-To: <20240510055223.11617-6-heinrich.schuchardt@canonical.com>

On comparing raw bytes from manufacturer data in EEPROM to having done
mac initialize and each of the commands incl. 'mac vendor' to
construct again that data, looks good.

On Thu, May 9, 2024 at 10:52 PM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> As boards from multiple vendors (Milk-V, StarFive, Pine64) use the mac
> command provide a sub-command to set the vendor string.
>
> Reported-by: E. Shattow <lucent@gmail.com>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> v4:
>         no change
> v3:
>         new patch
> ---
>  .../visionfive2/visionfive2-i2c-eeprom.c      | 25 ++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> index 9648a270494..141d3db8667 100644
> --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> @@ -404,6 +404,24 @@ static void set_product_id(char *string)
>         update_crc();
>  }
>
> +/**
> + * set_vendor() - set vendor name
> + *
> + * Takes a pointer to a string representing the vendor name, e.g.
> + * "StarFive Technology Co., Ltd.", stores it in the vendor field
> + * of the EEPROM local copy, and updates the CRC of the local copy.
> + */
> +static void set_vendor(char *string)
> +{
> +       memset(pbuf.eeprom.atom1.data.vstr, 0,
> +              sizeof(pbuf.eeprom.atom1.data.vstr));
> +
> +       snprintf(pbuf.eeprom.atom1.data.vstr,
> +                sizeof(pbuf.eeprom.atom1.data.vstr), string);
> +
> +       update_crc();
> +}
> +
>  const char *get_product_id_from_eeprom(void)
>  {
>         if (read_eeprom())
> @@ -463,6 +481,9 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>         } else if (!strcmp(cmd, "product_id")) {
>                 set_product_id(argv[2]);
>                 return 0;
> +       } else if (!strcmp(cmd, "vendor")) {
> +               set_vendor(argv[2]);
> +               return 0;
>         }
>
>         return CMD_RET_USAGE;
> @@ -586,7 +607,9 @@ U_BOOT_LONGHELP(mac,
>         "mac bom_revision <A>\n"
>         "    - stores a StarFive BOM revision into the local EEPROM copy\n"
>         "mac product_id <VF7110A1-2228-D008E000-xxxxxxxx>\n"
> -       "    - stores a StarFive product ID into the local EEPROM copy\n");
> +       "    - stores a StarFive product ID into the local EEPROM copy\n"
> +       "mac vendor <Vendor Name>\n"
> +       "    - set vendor string\n");
>
>  U_BOOT_CMD(
>         mac, 3, 1,  do_mac,
> --
> 2.43.0
>

Tested-by: E Shattow <lucent@gmail.com>

      reply	other threads:[~2024-05-11  4:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  5:52 [PATCH v4 0/5] board: starfive: add Milk-V Mars CM support Heinrich Schuchardt
2024-05-10  5:52 ` [PATCH v4 1/5] board: starfive: function to read eMMC size Heinrich Schuchardt
2024-05-10  5:52 ` [PATCH v4 2/5] board: add support for Milk-V Mars CM Heinrich Schuchardt
2024-05-10 15:01   ` Shengyu Qu
2024-05-10 15:04     ` Shengyu Qu
2024-05-10 15:39     ` Shengyu Qu
2024-05-10 18:17       ` E Shattow
2024-05-10  5:52 ` [PATCH v4 3/5] doc: Milk-V Mars CM and Milk-V Mars CM Lite Heinrich Schuchardt
2024-05-10  5:52 ` [PATCH v4 4/5] configs: visionfive2: enable SPL_YMODEM_SUPPORT Heinrich Schuchardt
2024-05-10  5:52 ` [PATCH v4 5/5] starfive: add mac vendor sub-command Heinrich Schuchardt
2024-05-11  4:20   ` E Shattow [this message]

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=CANV2PTN3Kfd7SG_ENw5FqXCuKSEWvNj3_58oR0SyYnL5H0Hpbw@mail.gmail.com \
    --to=lucent@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=hal.feng@starfivetech.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=lukas.funke@weidmueller.com \
    --cc=mason.huo@starfivetech.com \
    --cc=michal.simek@amd.com \
    --cc=minda.chen@starfivetech.com \
    --cc=rick@andestech.com \
    --cc=sw0312.kim@samsung.com \
    --cc=tekieli.lukasz@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=wiagn233@outlook.com \
    --cc=yangshiji66@outlook.com \
    --cc=ycliang@andestech.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).