summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHarsha Vardhan V M <[email protected]>2025-03-19 14:17:12 +0530
committerTom Rini <[email protected]>2025-04-04 12:25:02 -0600
commit578e7882bfb79848ff91cd65a5ebf4e795d26bb5 (patch)
treedb7b4bfee151c9beb8692fc46ce5aadcd09936f6 /cmd
parent833c05ea272a086b5428166552ceb021b50c4cda (diff)
cmd: fuse: Add fuse writebuff sub-system command
Add CMD_FUSE_WRITEBUFF config option to add and enable fuse writebuff sub-system command. Add fuse_writebuff function to be invoked on writebuff command. Signed-off-by: Harsha Vardhan V M <[email protected]> Reviewed-by: Tom Rini <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig8
-rw-r--r--cmd/fuse.c30
2 files changed, 33 insertions, 5 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index cd391d422ae..81c59becc2d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1236,6 +1236,14 @@ config CMD_FUSE
which control the behaviour of the device. The command uses the
fuse_...() API.
+config CMD_FUSE_WRITEBUFF
+ bool "Support for the fuse writebuff"
+ depends on CMD_FUSE
+ help
+ This allows programming fuses, which control the behaviour of
+ the device, using a structured buffer in memory. The command
+ uses the fuse_writebuff() API.
+
config CMD_GPIO
bool "gpio"
help
diff --git a/cmd/fuse.c b/cmd/fuse.c
index a23cedba90f..6c42c096809 100644
--- a/cmd/fuse.c
+++ b/cmd/fuse.c
@@ -43,11 +43,18 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
argc -= 2 + confirmed;
argv += 2 + confirmed;
- if (argc < 2)
- return CMD_RET_USAGE;
+ if (IS_ENABLED(CONFIG_CMD_FUSE_WRITEBUFF) && !strcmp(op, "writebuff")) {
+ if (argc == 1)
+ addr = simple_strtoul(argv[0], NULL, 16);
+ else
+ return CMD_RET_USAGE;
+ } else {
+ if (argc < 2)
+ return CMD_RET_USAGE;
- bank = simple_strtoul(argv[0], NULL, 0);
- word = simple_strtoul(argv[1], NULL, 0);
+ bank = simple_strtoul(argv[0], NULL, 0);
+ word = simple_strtoul(argv[1], NULL, 0);
+ }
if (!strcmp(op, "read")) {
if (argc == 2)
@@ -161,6 +168,15 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
if (ret)
goto err;
}
+ } else if (IS_ENABLED(CONFIG_CMD_FUSE_WRITEBUFF) && !strcmp(op, "writebuff")) {
+ printf("Programming fuses using a structured buffer in memory "
+ "starting at addr 0x%lx\n", addr);
+ if (!confirmed && !confirm_prog())
+ return CMD_RET_FAILURE;
+
+ ret = fuse_writebuff(addr);
+ if (ret)
+ goto err;
} else {
return CMD_RET_USAGE;
}
@@ -186,5 +202,9 @@ U_BOOT_CMD(
"fuse prog [-y] <bank> <word> <hexval> [<hexval>...] - program 1 or\n"
" several fuse words, starting at 'word' (PERMANENT)\n"
"fuse override <bank> <word> <hexval> [<hexval>...] - override 1 or\n"
- " several fuse words, starting at 'word'"
+ " several fuse words, starting at 'word'\n"
+#ifdef CONFIG_CMD_FUSE_WRITEBUFF
+ "fuse writebuff [-y] <addr> - program fuse data\n"
+ " using a structured buffer in memory starting at 'addr'\n"
+#endif /* CONFIG_CMD_FUSE_WRITEBUFF */
);