
The different implementations of the mac command have board or vendor specific sub-commands.
Add the command definition specific to the SiFive HiFive Unmatched board.
Don't call cmd_usage() directly but return CMD_RET_USAGE instead.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- .../unmatched/hifive-platform-i2c-eeprom.c | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c index 2b985b9b22..3c7ba4e0d3 100644 --- a/board/sifive/unmatched/hifive-platform-i2c-eeprom.c +++ b/board/sifive/unmatched/hifive-platform-i2c-eeprom.c @@ -426,7 +426,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }
if (argc > 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE;
cmd = argv[1];
@@ -443,7 +443,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }
if (argc != 3) - return cmd_usage(cmdtp); + return CMD_RET_USAGE;
if (!is_match_magic()) { printf("Please read the EEPROM ('read_eeprom') and/or initialize the EEPROM ('initialize') first.\n"); @@ -470,7 +470,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return 0; }
- return cmd_usage(cmdtp); + return CMD_RET_USAGE; }
/** @@ -551,3 +551,27 @@ u8 get_pcb_revision_from_eeprom(void)
return be.pcb_revision; } + +#ifndef CONFIG_SPL_BUILD + +#ifdef CONFIG_SYS_LONGHELP +static char booti_help_text[] = + "- displays memory copy of EEPROM\n" + "mac read_eeprom - reads EEPROM into memory\n" + "mac initialize - initializes memory copy with magic number\n" + "mac write_eeprom - writes the EEPROM from memory\n" + "mac manuf_test_status [unknown|pass|fail] - sets test status in memory\n" + "mac_address <addr> - sets MAC address in memory\n" + "mac pcb_revision <rev> - sets PCB revision in memory\n" + "mac bom_variant <var> - sets BOM variant in memory\n" + "mac bom_revision <rev> - sets BOM revision in memory\n"; +#else + ""; +#endif + +U_BOOT_CMD( + mac, 3, 1, do_mac, + "display and program the board revision and MAC address in EEPROM", + booti_help_text); + +#endif /* CONFIG_SPL_BUILD */