[PATCH v4 1/7] reset: Allow per-board reset type
dmukhin at ford.com
dmukhin at ford.com
Wed Jun 3 09:07:37 CEST 2026
Some prototype boards may not have (temporarily) all required reset
types supported (e.g. only warm reset supported).
Add a Kconfig choice to select the board-specific default reset type
used by the 'reset' command, allowing it to work on such boards.
Rely on 'poweroff' command if SYSRESET_POWER_OFF reset type is needed.
Keep cold reset as the default.
Signed-off-by: Denis Mukhin <dmukhin at ford.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
Changes since v3:
- updated comment for SYSRESET_CMD_RESET_DEFAULT_COLD in Kconfig description
- added a note in commit message on SYSRESET_POWER_OFF
- ensured no unreachable code
---
drivers/sysreset/Kconfig | 27 +++++++++++++++++++++++++++
drivers/sysreset/sysreset-uclass.c | 13 ++++++++++++-
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 90f740f51d42..83bfbc5a30f7 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -57,6 +57,33 @@ config SYSRESET_CMD_RESET_ARGS
additional arguments for implementing arch/board specific
functionality.
+if SYSRESET_CMD_RESET
+choice
+ prompt "Default reset type for reset command"
+ default SYSRESET_CMD_RESET_DEFAULT_COLD
+ help
+ Select the default reset type used by the reset command when no
+ explicit reset type is requested.
+
+config SYSRESET_CMD_RESET_DEFAULT_WARM
+ bool "Warm reset"
+ help
+ Reset CPU while keeping GPIOs active.
+
+config SYSRESET_CMD_RESET_DEFAULT_COLD
+ bool "Cold reset"
+ help
+ Full cold reset of the machine, including CPU, GPIOs, PMIC and
+ other logic in the machine.
+
+config SYSRESET_CMD_RESET_DEFAULT_POWER
+ bool "Power reset"
+ help
+ Reset PMIC by removing and restoring power.
+
+endchoice
+endif
+
if CMD_POWEROFF
config SYSRESET_CMD_POWEROFF
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index f25e09e9cd06..5c6dd7cc1c55 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -150,9 +150,20 @@ void reset_cpu(void)
}
#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET)
+static enum sysreset_t sysreset_get_default_type(void)
+{
+ if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_WARM))
+ return SYSRESET_WARM;
+
+ if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER))
+ return SYSRESET_POWER;
+
+ return SYSRESET_COLD;
+}
+
int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
- enum sysreset_t reset_type = SYSRESET_COLD;
+ enum sysreset_t reset_type = sysreset_get_default_type();
if (argc > 2)
return CMD_RET_USAGE;
--
2.54.0
More information about the U-Boot
mailing list