From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Hal Feng <hal.feng@starfivetech.com>
Cc: u-boot@lists.denx.de, Leo <ycliang@andestech.com>,
Tom Rini <trini@konsulko.com>, Rick Chen <rick@andestech.com>,
Sumit Garg <sumit.garg@kernel.org>,
Emil Renner Berthing <emil.renner.berthing@canonical.com>,
E Shattow <e@freeshell.de>
Subject: Re: [RFC 04/10] eeprom: starfive: Correct get_pcb_revision_from_eeprom()
Date: Fri, 29 Aug 2025 09:44:12 +0200 [thread overview]
Message-ID: <7c0bdef3-69df-4536-bddf-e2912ce71eed@canonical.com> (raw)
In-Reply-To: <20250829060931.79940-5-hal.feng@starfivetech.com>
On 29.08.25 08:09, Hal Feng wrote:
> pcb_revision is stored in the pcb_revision field of ATOM4. Correct it.
> Move the function description to the header file.
> Remove the function calls in board/starfive/visionfive2/.
>
> Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration")
> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
> ---
> arch/riscv/include/asm/arch-jh7110/eeprom.h | 5 +++++
> board/starfive/visionfive2/spl.c | 18 ++++++-----------
> .../visionfive2/starfive_visionfive2.c | 20 ++++++-------------
> .../visionfive2/visionfive2-i2c-eeprom.c | 11 ++--------
> 4 files changed, 19 insertions(+), 35 deletions(-)
>
> diff --git a/arch/riscv/include/asm/arch-jh7110/eeprom.h b/arch/riscv/include/asm/arch-jh7110/eeprom.h
> index 6d0a0ba0c4a..025f1d32c49 100644
> --- a/arch/riscv/include/asm/arch-jh7110/eeprom.h
> +++ b/arch/riscv/include/asm/arch-jh7110/eeprom.h
> @@ -9,6 +9,11 @@
>
> #include <linux/types.h>
>
> +/**
> + * get_pcb_revision_from_eeprom() - get the PCB revision
> + *
> + * @return: the PCB revision or 0xFF on error.
> + */
> u8 get_pcb_revision_from_eeprom(void);
>
> /**
> diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c
> index 3dfa931b655..901e7b58f36 100644
> --- a/board/starfive/visionfive2/spl.c
> +++ b/board/starfive/visionfive2/spl.c
> @@ -126,19 +126,13 @@ int board_fit_config_name_match(const char *name)
> !strncmp(get_product_id_from_eeprom(), "STAR64", 6)) {
> return 0;
> } else if (!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.2a") &&
> - !strncmp(get_product_id_from_eeprom(), "VF7110", 6)) {
> - switch (get_pcb_revision_from_eeprom()) {
> - case 'a':
> - case 'A':
> - return 0;
> - }
> + (!strncmp(get_product_id_from_eeprom(), "VF7110A", 7) ||
> + !strncmp(get_product_id_from_eeprom(), "VF7110a", 7))) {
> + return 0;
> } else if (!strcmp(name, "starfive/jh7110-starfive-visionfive-2-v1.3b") &&
> - !strncmp(get_product_id_from_eeprom(), "VF7110", 6)) {
> - switch (get_pcb_revision_from_eeprom()) {
> - case 'b':
> - case 'B':
> - return 0;
> - }
> + (!strncmp(get_product_id_from_eeprom(), "VF7110B", 7) ||
> + !strncmp(get_product_id_from_eeprom(), "VF7110b", 7))) {
> + return 0;
> }
>
> return -EINVAL;
> diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c
> index bfbb11a2ee7..f38433e94ac 100644
> --- a/board/starfive/visionfive2/starfive_visionfive2.c
> +++ b/board/starfive/visionfive2/starfive_visionfive2.c
> @@ -59,20 +59,12 @@ static void set_fdtfile(void)
> fdtfile = "starfive/jh7110-milkv-mars.dtb";
> } else if (!strncmp(get_product_id_from_eeprom(), "STAR64", 6)) {
> fdtfile = "starfive/jh7110-pine64-star64.dtb";
> - } else if (!strncmp(get_product_id_from_eeprom(), "VF7110", 6)) {
> - switch (get_pcb_revision_from_eeprom()) {
> - case 'a':
> - case 'A':
> - fdtfile = "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb";
> - break;
> - case 'b':
> - case 'B':
> - fdtfile = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb";
> - break;
> - default:
> - log_err("Unknown revision\n");
> - return;
> - }
> + } else if (!strncmp(get_product_id_from_eeprom(), "VF7110A", 7) ||
> + !strncmp(get_product_id_from_eeprom(), "VF7110a", 7)) {
Where boards both with 'a' and 'b' ever shipped?
I have only seen 'A' and 'B' in pbuf.eeprom.atom1.data.pstr[6].
The change looks technically correct.
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> + fdtfile = "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb";
> + } else if (!strncmp(get_product_id_from_eeprom(), "VF7110B", 7) ||
> + !strncmp(get_product_id_from_eeprom(), "VF7110b", 7)) {
> + fdtfile = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb";
> } else {
> log_err("Unknown product\n");
> return;
> diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> index 3866d07f9d4..43b8af4fc59 100644
> --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> @@ -535,19 +535,12 @@ int mac_read_from_eeprom(void)
> return 0;
> }
>
> -/**
> - * get_pcb_revision_from_eeprom - get the PCB revision
> - *
> - * 1.2A return 'A'/'a', 1.3B return 'B'/'b',other values are illegal
> - */
> u8 get_pcb_revision_from_eeprom(void)
> {
> - u8 pv = 0xFF;
> -
> if (read_eeprom())
> - return pv;
> + return 0xFF;
>
> - return pbuf.eeprom.atom1.data.pstr[6];
> + return pbuf.eeprom.atom4.data.pcb_revision;
> }
>
> u8 get_ddr_size_from_eeprom(void)
next prev parent reply other threads:[~2025-08-29 7:44 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 6:09 [RFC 00/10] Add support for StarFive VisionFive 2 Lite board Hal Feng
2025-08-29 6:09 ` [RFC 01/10] riscv: dts: starfive: jh7110-common: Move out some nodes to the board dts Hal Feng
2025-08-29 7:19 ` Heinrich Schuchardt
2025-09-02 16:17 ` E Shattow
2025-10-22 9:59 ` Hal Feng
2025-10-22 11:26 ` E Shattow
2025-08-29 6:09 ` [RFC 02/10] riscv: dts: starfive: Add VisionFive 2 Lite board device tree Hal Feng
2025-09-02 20:03 ` E Shattow
2025-09-03 11:07 ` Sumit Garg
2025-09-03 12:03 ` Heinrich Schuchardt
2025-09-04 2:39 ` Hal Feng
2025-08-29 6:09 ` [RFC 03/10] eeprom: starfive: Simplify get_ddr_size_from_eeprom() Hal Feng
2025-08-29 7:33 ` Heinrich Schuchardt
2025-09-02 21:28 ` E Shattow
2025-09-02 22:18 ` Heinrich Schuchardt
2025-10-21 9:20 ` Hal Feng
2025-10-21 19:04 ` E Shattow
2025-08-29 6:09 ` [RFC 04/10] eeprom: starfive: Correct get_pcb_revision_from_eeprom() Hal Feng
2025-08-29 7:44 ` Heinrich Schuchardt [this message]
2025-09-02 7:44 ` Hal Feng
2025-09-02 22:12 ` E Shattow
2025-09-02 22:32 ` Heinrich Schuchardt
2025-10-22 3:02 ` Hal Feng
2025-10-22 8:44 ` Hal Feng
2025-08-29 6:09 ` [RFC 05/10] eeprom: starfive: Update eeprom data format version to 3 Hal Feng
2025-08-29 7:47 ` Heinrich Schuchardt
2025-09-02 7:10 ` Hal Feng
2025-09-02 23:29 ` E Shattow
2025-10-22 5:55 ` Hal Feng
2025-08-29 6:09 ` [RFC 06/10] pcie: starfive: Add a optional power gpio support Hal Feng
2025-09-02 23:47 ` E Shattow
2025-10-22 6:13 ` Hal Feng
2025-08-29 6:09 ` [RFC 07/10] riscv: dts: jh7110: Add StarFive VisionFive 2 Lite u-boot device tree Hal Feng
2025-09-03 0:00 ` E Shattow
2025-08-29 6:09 ` [RFC 08/10] configs: visionfive2: Add VisionFive 2 Lite DT to OF_LIST Hal Feng
2025-09-03 0:15 ` E Shattow
2025-10-22 7:12 ` Hal Feng
2025-08-29 6:09 ` [RFC 09/10] board: starfive: spl: Support VisionFive 2 Lite Hal Feng
2025-09-03 0:21 ` E Shattow
2025-08-29 6:09 ` [RFC 10/10] board: starfive: visionfive2: Add VisionFive 2 Lite fdt selection Hal Feng
2025-09-03 0:26 ` E Shattow
2025-09-03 4:34 ` Heinrich Schuchardt
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=7c0bdef3-69df-4536-bddf-e2912ce71eed@canonical.com \
--to=heinrich.schuchardt@canonical.com \
--cc=e@freeshell.de \
--cc=emil.renner.berthing@canonical.com \
--cc=hal.feng@starfivetech.com \
--cc=rick@andestech.com \
--cc=sumit.garg@kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--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 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.