Hi Denis,
On 6/3/26 9:07 AM, [email protected] wrote:
Some prototype boards default to a non-cold reset type, e.g. warm reset.
Add 'reset -c' so users can explicitly request a cold reset when needed.
Signed-off-by: Denis Mukhin <[email protected]>
---
Changes since v3:
- preserved existing behavior for 'reset -edl' handling
- corrected commit message formatting
---
cmd/boot.c | 3 ++-
drivers/sysreset/sysreset-uclass.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/cmd/boot.c b/cmd/boot.c
index 29cdf4a9a81a..5cac6cf3fed0 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -59,13 +59,14 @@ U_BOOT_CMD(
U_BOOT_CMD(
reset, 2, 0, do_reset,
"Perform RESET of the CPU",
- "- cold boot without level specifier\n"
+ "- reset using the configured default type\n"
NACK. It performs a cold boot when the level (-w) is not specified so we
need to keep this as is.
#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_ARGS)
// All options handled by sysreset drivers via their sysreset_ops.request_arg
callback
#ifdef CONFIG_SYSRESET_QCOM_PSCI
"reset -edl - Boot to Emergency DownLoad mode\n"
#endif
#endif
+ "reset -c - cold reset if implemented\n"
But... why? `reset` already does that why do we need yet another option
for something we already do when no argument is passed?
"reset -w - warm reset if implemented"
);
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index 5c6dd7cc1c55..1ba698b37285 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -168,8 +168,17 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
if (argc > 2)
return CMD_RET_USAGE;
- if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'w') {
- reset_type = SYSRESET_WARM;
+ if (argc == 2 && argv[1][0] == '-' && strlen(argv[1]) == 2) {
+ switch (argv[1][1]) {
+ case 'c':
+ reset_type = SYSRESET_COLD;
+ break;
+ case 'w':
+ reset_type = SYSRESET_WARM;
+ break;
+ default:
+ return CMD_RET_USAGE;
NACK. We support passing arguments to sysreset drivers whenever -w is
not passed, so this will break them. See the sysreset_walk_arg below.
Cheers,
Quentin