eeprom: SiFive Unmatched: re-implement mac command

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>
This commit is contained in:
Heinrich Schuchardt 2023-09-30 14:01:44 +02:00 committed by Tom Rini
parent f5e921e948
commit dd1118227e

View file

@ -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 */