aboutsummaryrefslogtreecommitdiff
path: root/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/starfive/visionfive2/visionfive2-i2c-eeprom.c')
-rw-r--r--board/starfive/visionfive2/visionfive2-i2c-eeprom.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
index c334d98cf6..c36de1a512 100644
--- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
+++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
@@ -190,6 +190,7 @@ static void show_eeprom(void)
pbuf.eeprom.atom4.data.mac1_addr[4], pbuf.eeprom.atom4.data.mac1_addr[5]);
} else {
printf("Custom data v%d is not Supported\n", pbuf.eeprom.atom4.data.version);
+ dump_raw_eeprom();
}
printf("--------EEPROM INFO--------\n\n");
}
@@ -404,29 +405,6 @@ static void set_product_id(char *string)
update_crc();
}
-static int print_usage(void)
-{
- printf("display and program the system ID and MAC addresses in EEPROM\n"
- "[read_eeprom|initialize|write_eeprom|mac_address|pcb_revision|bom_revision|product_id]\n"
- "mac read_eeprom\n"
- " - read EEPROM content into memory data structure\n"
- "mac write_eeprom\n"
- " - save memory data structure to the EEPROM\n"
- "mac initialize\n"
- " - initialize the in-memory EEPROM copy with default data\n"
- "mac mac0_address <xx:xx:xx:xx:xx:xx>\n"
- " - stores a MAC0 address into the local EEPROM copy\n"
- "mac mac1_address <xx:xx:xx:xx:xx:xx>\n"
- " - stores a MAC1 address into the local EEPROM copy\n"
- "mac pcb_revision <?>\n"
- " - 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 product_id <VF7110A1-2228-D008E000-xxxxxxxx>\n"
- " - stores a StarFive product ID into the local EEPROM copy\n");
- return 0;
-}
-
int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
char *cmd;
@@ -437,7 +415,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc > 3)
- return print_usage();
+ return CMD_RET_USAGE;
cmd = argv[1];
@@ -450,10 +428,13 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 0;
} else if (!strcmp(cmd, "write_eeprom")) {
return prog_eeprom(STARFIVE_EEPROM_HATS_SIZE_MAX);
+ } else if (!strcmp(cmd, "raw")) {
+ dump_raw_eeprom();
+ return 0;
}
if (argc != 3)
- return print_usage();
+ return CMD_RET_USAGE;
if (is_match_magic()) {
printf("Please read the EEPROM ('read_eeprom') and/or initialize the EEPROM ('initialize') first.\n");
@@ -477,7 +458,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
- return print_usage();
+ return CMD_RET_USAGE;
}
/**
@@ -559,3 +540,30 @@ u32 get_ddr_size_from_eeprom(void)
return hextoul(&pbuf.eeprom.atom1.data.pstr[14], NULL);
}
+
+U_BOOT_LONGHELP(mac,
+ "\n"
+ " - display EEPROM content\n"
+ "mac read_eeprom\n"
+ " - read EEPROM content into memory data structure\n"
+ "mac write_eeprom\n"
+ " - save memory data structure to the EEPROM\n"
+ "mac initialize\n"
+ " - initialize the in-memory EEPROM copy with default data\n"
+ "mac raw\n"
+ " - hexdump memory data structure\n"
+ "mac mac0_address <xx:xx:xx:xx:xx:xx>\n"
+ " - stores a MAC0 address into the local EEPROM copy\n"
+ "mac mac1_address <xx:xx:xx:xx:xx:xx>\n"
+ " - stores a MAC1 address into the local EEPROM copy\n"
+ "mac pcb_revision <?>\n"
+ " - 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 product_id <VF7110A1-2228-D008E000-xxxxxxxx>\n"
+ " - stores a StarFive product ID into the local EEPROM copy\n");
+
+U_BOOT_CMD(
+ mac, 3, 1, do_mac,
+ "display and program the board revision and MAC address in EEPROM",
+ mac_help_text);