diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-05-12 06:25:26 +0200 |
---|---|---|
committer | Leo Yu-Chi Liang <ycliang@andestech.com> | 2024-05-14 18:40:10 +0800 |
commit | fcaf019c4ed85607bef759ec074df92da222afcf (patch) | |
tree | 51892befc3a9947edf6c8bff19c9a41e9b18d650 /board | |
parent | 215dc02aeed96dcc78f9b23f6b81e50a61b2d8bd (diff) | |
download | u-boot-fcaf019c4ed85607bef759ec074df92da222afcf.zip u-boot-fcaf019c4ed85607bef759ec074df92da222afcf.tar.gz u-boot-fcaf019c4ed85607bef759ec074df92da222afcf.tar.bz2 |
starfive: add mac vendor sub-command
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>
Diffstat (limited to 'board')
-rw-r--r-- | board/starfive/visionfive2/visionfive2-i2c-eeprom.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c index 9648a27..838f41e 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)); + + strncpy(pbuf.eeprom.atom1.data.vstr, + string, sizeof(pbuf.eeprom.atom1.data.vstr) - 1); + + 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, |