From: Hal Feng <hal.feng@starfivetech.com>
To: 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>,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
E Shattow <e@freeshell.de>
Cc: Hal Feng <hal.feng@starfivetech.com>, u-boot@lists.denx.de
Subject: [PATCH v1 5/9] eeprom: starfive: Support eeprom data format v3
Date: Fri, 24 Oct 2025 16:59:28 +0800 [thread overview]
Message-ID: <20251024085932.83596-6-hal.feng@starfivetech.com> (raw)
In-Reply-To: <20251024085932.83596-1-hal.feng@starfivetech.com>
Add eeprom data format v3 support. Add onboard_module field in
ATOM4 and add "mac onboard_module <?>" command to modify it.
The onboard module field marks the additional modules compared
with VisionFive 2 board. Now we define
bit7-1: reserved, bit0: WIFI/BT
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
---
.../visionfive2/visionfive2-i2c-eeprom.c | 36 +++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
index 986dcc94992..b9197cdd34f 100644
--- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
+++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
@@ -105,7 +105,8 @@ struct eeprom_atom4_data {
u8 bom_revision; /* BOM version */
u8 mac0_addr[MAC_ADDR_BYTES]; /* Ethernet0 MAC */
u8 mac1_addr[MAC_ADDR_BYTES]; /* Ethernet1 MAC */
- u8 reserved[2];
+ u8 onboard_module; /* Onboard module flag: bit7-1: reserved, bit0: WIFI/BT */
+ u8 reserved;
};
struct starfive_eeprom_atom4 {
@@ -176,7 +177,7 @@ static void show_eeprom(void)
printf("Vendor : %s\n", pbuf.eeprom.atom1.data.vstr);
printf("Product full SN: %s\n", pbuf.eeprom.atom1.data.pstr);
printf("data version: 0x%x\n", pbuf.eeprom.atom4.data.version);
- if (pbuf.eeprom.atom4.data.version == 2) {
+ if (pbuf.eeprom.atom4.data.version == 2 || pbuf.eeprom.atom4.data.version == 3) {
printf("PCB revision: 0x%x\n", pbuf.eeprom.atom4.data.pcb_revision);
printf("BOM revision: %c\n", pbuf.eeprom.atom4.data.bom_revision);
printf("Ethernet MAC0 address: %02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -187,6 +188,14 @@ static void show_eeprom(void)
pbuf.eeprom.atom4.data.mac1_addr[0], pbuf.eeprom.atom4.data.mac1_addr[1],
pbuf.eeprom.atom4.data.mac1_addr[2], pbuf.eeprom.atom4.data.mac1_addr[3],
pbuf.eeprom.atom4.data.mac1_addr[4], pbuf.eeprom.atom4.data.mac1_addr[5]);
+ if (pbuf.eeprom.atom4.data.version == 3) {
+ char str[25] = "Onboard module: ";
+
+ if (pbuf.eeprom.atom4.data.onboard_module & BIT(0))
+ strcat(str, "WIFI/BT");
+
+ printf("%s\n", str);
+ }
} else {
printf("Custom data v%d is not Supported\n", pbuf.eeprom.atom4.data.version);
dump_raw_eeprom();
@@ -260,6 +269,7 @@ static void init_local_copy(void)
pbuf.eeprom.atom4.data.bom_revision = BOM_VERSION;
set_mac_address(STARFIVE_DEFAULT_MAC0, 0);
set_mac_address(STARFIVE_DEFAULT_MAC1, 1);
+ pbuf.eeprom.atom4.data.onboard_module = 0;
}
/**
@@ -385,6 +395,23 @@ static void set_bom_revision(char *string)
update_crc();
}
+/**
+ * set_onboard_module() - stores a StarFive onboard module flag into the local EEPROM copy
+ *
+ * Takes a pointer to a string representing the numeric onboard module flag in
+ * Hexadecimal ("0" - "FF"), stores it in the onboard_module field of the
+ * EEPROM local copy, and updates the CRC of the local copy.
+ */
+static void set_onboard_module(char *string)
+{
+ u8 onboard_module;
+
+ onboard_module = simple_strtoul(string, &string, 16);
+ pbuf.eeprom.atom4.data.onboard_module = onboard_module;
+
+ update_crc();
+}
+
/**
* set_product_id() - stores a StarFive product ID into the local EEPROM copy
*
@@ -478,6 +505,9 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
} else if (!strcmp(cmd, "bom_revision")) {
set_bom_revision(argv[2]);
return 0;
+ } else if (!strcmp(cmd, "onboard_module")) {
+ set_onboard_module(argv[2]);
+ return 0;
} else if (!strcmp(cmd, "product_id")) {
set_product_id(argv[2]);
return 0;
@@ -585,6 +615,8 @@ U_BOOT_LONGHELP(mac,
" - stores a StarFive PCB revision into the local EEPROM copy\n"
"mac bom_revision <A>\n"
" - stores a StarFive BOM revision into the local EEPROM copy\n"
+ "mac onboard_module <?>\n"
+ " - stores a StarFive onboard module flag 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"
"mac vendor <Vendor Name>\n"
--
2.43.2
next prev parent reply other threads:[~2025-10-24 14:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 8:59 [PATCH v1 0/9] Add support for StarFive VisionFive 2 Lite board Hal Feng
2025-10-24 8:59 ` [PATCH v1 1/9] riscv: dts: starfive: jh7110-common: Move out some nodes to the board dts Hal Feng
2025-10-24 11:17 ` E Shattow
2025-10-24 8:59 ` [PATCH v1 2/9] riscv: dts: starfive: Add VisionFive 2 Lite board device tree Hal Feng
2025-10-24 10:58 ` E Shattow
2025-10-27 8:14 ` Hal Feng
2025-12-04 9:37 ` Leo Liang
2025-12-04 9:46 ` Conor Dooley
2025-12-04 10:37 ` Leo Liang
2025-12-05 6:43 ` Hal Feng
2025-10-24 8:59 ` [PATCH v1 3/9] eeprom: starfive: Simplify get_ddr_size_from_eeprom() Hal Feng
2025-10-24 11:24 ` E Shattow
2025-10-24 8:59 ` [PATCH v1 4/9] eeprom: starfive: Correct get_pcb_revision_from_eeprom() Hal Feng
2025-10-24 11:30 ` E Shattow
2025-10-24 8:59 ` Hal Feng [this message]
2025-10-24 12:41 ` [PATCH v1 5/9] eeprom: starfive: Support eeprom data format v3 E Shattow
2025-10-24 8:59 ` [PATCH v1 6/9] pcie: starfive: Add a optional power gpio support Hal Feng
2025-10-24 13:09 ` E Shattow
2025-10-27 8:26 ` Hal Feng
2025-10-24 8:59 ` [PATCH v1 7/9] configs: visionfive2: Add VisionFive 2 Lite DT to OF_LIST Hal Feng
2025-10-24 8:59 ` [PATCH v1 8/9] board: starfive: spl: Support VisionFive 2 Lite Hal Feng
2025-10-24 8:59 ` [PATCH v1 9/9] board: starfive: visionfive2: Add VisionFive 2 Lite fdt selection Hal Feng
2026-02-09 11:21 ` [PATCH v1 0/9] Add support for StarFive VisionFive 2 Lite board Leo Liang
2026-02-09 19:10 ` E Shattow
2026-02-14 9:26 ` Hal Feng
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=20251024085932.83596-6-hal.feng@starfivetech.com \
--to=hal.feng@starfivetech.com \
--cc=e@freeshell.de \
--cc=emil.renner.berthing@canonical.com \
--cc=heinrich.schuchardt@canonical.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox