* [PATCH v3 1/6] reset: Allow per-board reset type
2026-05-29 3:48 [PATCH v3 0/6] reset: add board reset type dmukhin
@ 2026-05-29 3:48 ` dmukhin
2026-06-01 14:54 ` Simon Glass
2026-05-29 3:48 ` [PATCH v3 2/6] reset: Add explicit cold reset support dmukhin
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: dmukhin @ 2026-05-29 3:48 UTC (permalink / raw)
To: u-boot; +Cc: sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
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.
Keep cold reset as the default.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v2:
- n/a
---
drivers/sysreset/Kconfig | 31 ++++++++++++++++++++++++++++++
drivers/sysreset/sysreset-uclass.c | 19 +++++++++++++++++-
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 90f740f51d42..2584c2b203e5 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -57,6 +57,37 @@ 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
+ Reset CPU and GPIOs.
+
+config SYSRESET_CMD_RESET_DEFAULT_POWER
+ bool "Power reset"
+ help
+ Reset PMIC by removing and restoring power.
+
+config SYSRESET_CMD_RESET_DEFAULT_POWER_OFF
+ bool "Power off"
+ help
+ Turn off 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..d2fddb470bf1 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -150,9 +150,26 @@ 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_COLD))
+ return SYSRESET_COLD;
+
+ if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER))
+ return SYSRESET_POWER;
+
+ if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER_OFF))
+ return SYSRESET_POWER_OFF;
+
+ 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
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3 1/6] reset: Allow per-board reset type
2026-05-29 3:48 ` [PATCH v3 1/6] reset: Allow per-board " dmukhin
@ 2026-06-01 14:54 ` Simon Glass
2026-06-02 6:29 ` dmukhin
0 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2026-06-01 14:54 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, sjg, trini
Hi Denis,
On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> reset: Allow per-board reset type
>
> 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.
>
> Keep cold reset as the default.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> drivers/sysreset/Kconfig | 31 +++++++++++++++++++++++++++++++
> drivers/sysreset/sysreset-uclass.c | 19 ++++++++++++++++++-
> 2 files changed, 49 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
> diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
> @@ -57,6 +57,37 @@ config SYSRESET_CMD_RESET_ARGS
> +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
> + Reset CPU and GPIOs.
This is very thin - as is the comment in include/sysreset.h - how about:
"Full cold reset of the machine, including CPU, GPIOs, PMIC and other
logic in the machine"
> diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
> @@ -57,6 +57,37 @@ config SYSRESET_CMD_RESET_ARGS
> +config SYSRESET_CMD_RESET_DEFAULT_POWER
> + bool "Power reset"
> + help
> + Reset PMIC by removing and restoring power.
> +
> +config SYSRESET_CMD_RESET_DEFAULT_POWER_OFF
> + bool "Power off"
> + help
> + Turn off power.
Could we use the 'poweroff' command instead?
> diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
> @@ -150,9 +150,26 @@ void reset_cpu(void)
> +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_COLD))
> + return SYSRESET_COLD;
> +
> + if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER))
> + return SYSRESET_POWER;
> +
> + if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER_OFF))
> + return SYSRESET_POWER_OFF;
> +
> + return SYSRESET_COLD;
> +}
The trailing return SYSRESET_COLD is unreachable, BTW.
Regards,
Simon
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v3 1/6] reset: Allow per-board reset type
2026-06-01 14:54 ` Simon Glass
@ 2026-06-02 6:29 ` dmukhin
0 siblings, 0 replies; 16+ messages in thread
From: dmukhin @ 2026-06-02 6:29 UTC (permalink / raw)
To: Simon Glass; +Cc: dmukhin, u-boot, trini
On Mon, Jun 01, 2026 at 08:54:18AM -0600, Simon Glass wrote:
> Hi Denis,
>
> On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> > reset: Allow per-board reset type
> >
> > 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.
> >
> > Keep cold reset as the default.
> >
> > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >
> > drivers/sysreset/Kconfig | 31 +++++++++++++++++++++++++++++++
> > drivers/sysreset/sysreset-uclass.c | 19 ++++++++++++++++++-
> > 2 files changed, 49 insertions(+), 1 deletion(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Thanks!
>
> > diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
> > @@ -57,6 +57,37 @@ config SYSRESET_CMD_RESET_ARGS
> > +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
> > + Reset CPU and GPIOs.
>
> This is very thin - as is the comment in include/sysreset.h - how about:
>
> "Full cold reset of the machine, including CPU, GPIOs, PMIC and other
> logic in the machine"
>
> > diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
> > @@ -57,6 +57,37 @@ config SYSRESET_CMD_RESET_ARGS
> > +config SYSRESET_CMD_RESET_DEFAULT_POWER
> > + bool "Power reset"
> > + help
> > + Reset PMIC by removing and restoring power.
> > +
> > +config SYSRESET_CMD_RESET_DEFAULT_POWER_OFF
> > + bool "Power off"
> > + help
> > + Turn off power.
>
> Could we use the 'poweroff' command instead?
Will drop SYSRESET_CMD_RESET_DEFAULT_POWER_OFF in v4 and leave
a code commentary to rely on poweroff command.
>
> > diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
> > @@ -150,9 +150,26 @@ void reset_cpu(void)
> > +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_COLD))
> > + return SYSRESET_COLD;
> > +
> > + if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER))
> > + return SYSRESET_POWER;
> > +
> > + if (IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_DEFAULT_POWER_OFF))
> > + return SYSRESET_POWER_OFF;
> > +
> > + return SYSRESET_COLD;
> > +}
>
> The trailing return SYSRESET_COLD is unreachable, BTW.
Thanks for the catch!
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 2/6] reset: Add explicit cold reset support
2026-05-29 3:48 [PATCH v3 0/6] reset: add board reset type dmukhin
2026-05-29 3:48 ` [PATCH v3 1/6] reset: Allow per-board " dmukhin
@ 2026-05-29 3:48 ` dmukhin
2026-06-01 14:54 ` Simon Glass
2026-05-29 3:48 ` [PATCH v3 3/6] reset: Print reset type on diagnostic console dmukhin
` (3 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: dmukhin @ 2026-05-29 3:48 UTC (permalink / raw)
To: u-boot; +Cc: sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Some prototype boards default to a non-cold reset type, e.g. warm reset.
Add `reset -c` so users can excplicitly request a cold reset when needed.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v2:
- n/a
Changes since v1:
- corrected args parsing in do_reset()
- updated commit message
- fixup reset command description
---
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..2cef907e291e 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 without level specifier\n"
#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"
"reset -w - warm reset if implemented"
);
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index d2fddb470bf1..df68b5c3f9eb 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -174,8 +174,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] == '-') {
+ switch (argv[1][1]) {
+ case 'c':
+ reset_type = SYSRESET_COLD;
+ break;
+ case 'w':
+ reset_type = SYSRESET_WARM;
+ break;
+ default:
+ return CMD_RET_USAGE;
+ }
}
printf("resetting ...\n");
--
2.54.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3 2/6] reset: Add explicit cold reset support
2026-05-29 3:48 ` [PATCH v3 2/6] reset: Add explicit cold reset support dmukhin
@ 2026-06-01 14:54 ` Simon Glass
2026-06-02 6:31 ` dmukhin
0 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2026-06-01 14:54 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, sjg, trini
Hi Denis,
On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> reset: Add explicit cold reset support
>
> Some prototype boards default to a non-cold reset type, e.g. warm reset.
>
> Add reset -c so users can excplicitly request a cold reset when needed.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> cmd/boot.c | 3 ++-
> drivers/sysreset/sysreset-uclass.c | 13 +++++++++++--
> 2 files changed, 13 insertions(+), 3 deletions(-)
> diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
> @@ -174,8 +174,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] == '-') {
> + switch (argv[1][1]) {
> + case 'c':
> + reset_type = SYSRESET_COLD;
> + break;
> + case 'w':
> + reset_type = SYSRESET_WARM;
> + break;
> + default:
> + return CMD_RET_USAGE;
> + }
> }
This regresses reset -edl on Qualcomm. Previously, an unknown -x
argument fell through to the SYSRESET_CMD_RESET_ARGS path, where
qcom_psci_sysreset_request_arg() picks up -edl and returns
-EINPROGRESS. With this change, argv[1][1] == 'e' hits the default
branch and bails out with CMD_RET_USAGE before sysreset_walk_arg()
runs, so reset -edl no longer works.
Please leave reset_type at its default for unrecognised flags (so the
arg-dispatch path can still claim them), or call sysreset_walk_arg()
first and only complain if nothing handled the argument. Also,
matching only argv[1][1] means reset -cx silently behaves like reset
-c - please tighten with strcmp() or a length check.
The could be a good usage for getopt() but sadly it increases code
size too much [1]
BTW -edl doesn't follow the normal flags approach, so we should
probably change that at some point.
> diff --git a/cmd/boot.c b/cmd/boot.c
> @@ -59,10 +59,11 @@ U_BOOT_CMD(
> U_BOOT_CMD(
> reset, 2, 0, do_reset,
> "Perform RESET of the CPU",
> - "- cold boot without level specifier\n"
> + "- reset without level specifier\n"
> #ifdef CONFIG_SYSRESET_QCOM_PSCI
> "reset -edl - Boot to Emergency DownLoad mode\n"
> #endif
> + "reset -c - cold reset if implemented\n"
> "reset -w - warm reset if implemented"
> );
The '- reset without level specifier' line reads oddly now that the
level is no longer guaranteed to be cold - perhaps '- reset using the
configured default type'.
> Add reset -c so users can excplicitly request a cold reset when needed.
Typo: excplicitly -> explicitly. Also please use single quotes around
tokens like 'reset -c' per U-Boot convention.
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/cover/20260519233207.2765755-1-sjg@chromium.org/
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v3 2/6] reset: Add explicit cold reset support
2026-06-01 14:54 ` Simon Glass
@ 2026-06-02 6:31 ` dmukhin
0 siblings, 0 replies; 16+ messages in thread
From: dmukhin @ 2026-06-02 6:31 UTC (permalink / raw)
To: Simon Glass; +Cc: dmukhin, u-boot, trini
On Mon, Jun 01, 2026 at 08:54:25AM -0600, Simon Glass wrote:
> Hi Denis,
>
> On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> > reset: Add explicit cold reset support
> >
> > Some prototype boards default to a non-cold reset type, e.g. warm reset.
> >
> > Add reset -c so users can excplicitly request a cold reset when needed.
> >
> > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >
> > cmd/boot.c | 3 ++-
> > drivers/sysreset/sysreset-uclass.c | 13 +++++++++++--
> > 2 files changed, 13 insertions(+), 3 deletions(-)
>
> > diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
> > @@ -174,8 +174,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] == '-') {
> > + switch (argv[1][1]) {
> > + case 'c':
> > + reset_type = SYSRESET_COLD;
> > + break;
> > + case 'w':
> > + reset_type = SYSRESET_WARM;
> > + break;
> > + default:
> > + return CMD_RET_USAGE;
> > + }
> > }
>
> This regresses reset -edl on Qualcomm. Previously, an unknown -x
> argument fell through to the SYSRESET_CMD_RESET_ARGS path, where
> qcom_psci_sysreset_request_arg() picks up -edl and returns
> -EINPROGRESS. With this change, argv[1][1] == 'e' hits the default
> branch and bails out with CMD_RET_USAGE before sysreset_walk_arg()
> runs, so reset -edl no longer works.
>
> Please leave reset_type at its default for unrecognised flags (so the
> arg-dispatch path can still claim them), or call sysreset_walk_arg()
> first and only complain if nothing handled the argument. Also,
> matching only argv[1][1] means reset -cx silently behaves like reset
> -c - please tighten with strcmp() or a length check.
Yes, will do; thanks for catching this!
>
> The could be a good usage for getopt() but sadly it increases code
> size too much [1]
>
> BTW -edl doesn't follow the normal flags approach, so we should
> probably change that at some point.
>
> > diff --git a/cmd/boot.c b/cmd/boot.c
> > @@ -59,10 +59,11 @@ U_BOOT_CMD(
> > U_BOOT_CMD(
> > reset, 2, 0, do_reset,
> > "Perform RESET of the CPU",
> > - "- cold boot without level specifier\n"
> > + "- reset without level specifier\n"
> > #ifdef CONFIG_SYSRESET_QCOM_PSCI
> > "reset -edl - Boot to Emergency DownLoad mode\n"
> > #endif
> > + "reset -c - cold reset if implemented\n"
> > "reset -w - warm reset if implemented"
> > );
>
> The '- reset without level specifier' line reads oddly now that the
> level is no longer guaranteed to be cold - perhaps '- reset using the
> configured default type'.
>
> > Add reset -c so users can excplicitly request a cold reset when needed.
>
> Typo: excplicitly -> explicitly. Also please use single quotes around
> tokens like 'reset -c' per U-Boot convention.
>
> Regards,
> Simon
>
> [1] https://patchwork.ozlabs.org/project/uboot/cover/20260519233207.2765755-1-sjg@chromium.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 3/6] reset: Print reset type on diagnostic console
2026-05-29 3:48 [PATCH v3 0/6] reset: add board reset type dmukhin
2026-05-29 3:48 ` [PATCH v3 1/6] reset: Allow per-board " dmukhin
2026-05-29 3:48 ` [PATCH v3 2/6] reset: Add explicit cold reset support dmukhin
@ 2026-05-29 3:48 ` dmukhin
2026-06-01 14:54 ` Simon Glass
2026-05-29 3:48 ` [PATCH v3 4/6] reset: x86: Use cpu_hlt() in pch_sysreset_power_off() dmukhin
` (2 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: dmukhin @ 2026-05-29 3:48 UTC (permalink / raw)
To: u-boot; +Cc: sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Add a diagnostic console trace indicating the reset type.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v2:
- n/a
Changes since v1:
- corrected the string representation for SYSRESET_POWER
---
drivers/sysreset/sysreset-uclass.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index df68b5c3f9eb..8f49a6093d49 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -22,6 +22,22 @@
#include <linux/err.h>
#include <asm/global_data.h>
+static const char *get_reset_type_str(enum sysreset_t reset_type)
+{
+ switch (reset_type) {
+ case SYSRESET_WARM:
+ return "warm";
+ case SYSRESET_COLD:
+ return "cold";
+ case SYSRESET_POWER:
+ return "power";
+ case SYSRESET_POWER_OFF:
+ return "power off";
+ default:
+ return "unknown";
+ }
+}
+
int sysreset_request(struct udevice *dev, enum sysreset_t type)
{
struct sysreset_ops *ops = sysreset_get_ops(dev);
@@ -187,7 +203,7 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
}
- printf("resetting ...\n");
+ printf("resetting (%s)...\n", get_reset_type_str(reset_type));
mdelay(100);
#if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET_ARGS)
--
2.54.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3 3/6] reset: Print reset type on diagnostic console
2026-05-29 3:48 ` [PATCH v3 3/6] reset: Print reset type on diagnostic console dmukhin
@ 2026-06-01 14:54 ` Simon Glass
0 siblings, 0 replies; 16+ messages in thread
From: Simon Glass @ 2026-06-01 14:54 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, sjg, trini
Hi Denis,
On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> reset: Print reset type on diagnostic console
>
> Add a diagnostic console trace indicating the reset type.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> drivers/sysreset/sysreset-uclass.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
> diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
> @@ -22,6 +22,22 @@
> #include <linux/err.h>
> #include <asm/global_data.h>
>
> +static const char *get_reset_type_str(enum sysreset_t reset_type)
> +{
> + switch (reset_type) {
> + case SYSRESET_WARM:
> + return 'warm';
> + case SYSRESET_COLD:
> + return 'cold';
> + case SYSRESET_POWER:
> + return 'power';
> + case SYSRESET_POWER_OFF:
> + return "power off";
> + default:
> + return 'unknown';
> + }
> +}
> +
This is placed outside the #if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET)
block, but its only caller (do_reset()) is inside it. With
CONFIG_SYSRESET_CMD_RESET=n the static function becomes unused and
triggers -Wunused-function. Please move it inside the guard, next to
do_reset()
Regards,
Simon
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 4/6] reset: x86: Use cpu_hlt() in pch_sysreset_power_off()
2026-05-29 3:48 [PATCH v3 0/6] reset: add board reset type dmukhin
` (2 preceding siblings ...)
2026-05-29 3:48 ` [PATCH v3 3/6] reset: Print reset type on diagnostic console dmukhin
@ 2026-05-29 3:48 ` dmukhin
2026-06-01 14:54 ` Simon Glass
2026-05-29 3:48 ` [PATCH v3 5/6] docs: reset: document cold reset option dmukhin
2026-05-29 3:48 ` [PATCH v3 6/6] tests: reset: add cold/warm reset types dmukhin
5 siblings, 1 reply; 16+ messages in thread
From: dmukhin @ 2026-05-29 3:48 UTC (permalink / raw)
To: u-boot; +Cc: sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Use cpu_hlt() instead of open-coded "hlt" in pch_sysreset_power_off().
Also, replace the open-coded busy loop in efi_reset_system() and use
cpu_hlt().
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v2:
- n/a
Changes since v1:
- dropped unneeded #include
- corrected the commit message
---
drivers/sysreset/sysreset_x86.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c
index c2f28c65280f..afb77d9c5c21 100644
--- a/drivers/sysreset/sysreset_x86.c
+++ b/drivers/sysreset/sysreset_x86.c
@@ -65,7 +65,7 @@ int pch_sysreset_power_off(struct udevice *dev)
outl(reg32, pm.base + pm.pm1_cnt_ofs);
for (;;)
- asm("hlt");
+ cpu_hlt();
}
static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
@@ -120,7 +120,8 @@ void __efi_runtime EFIAPI efi_reset_system(
/* TODO EFI_RESET_SHUTDOWN */
- while (1) { }
+ for (;;)
+ cpu_hlt();
}
#endif
--
2.54.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3 4/6] reset: x86: Use cpu_hlt() in pch_sysreset_power_off()
2026-05-29 3:48 ` [PATCH v3 4/6] reset: x86: Use cpu_hlt() in pch_sysreset_power_off() dmukhin
@ 2026-06-01 14:54 ` Simon Glass
2026-06-02 6:33 ` dmukhin
0 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2026-06-01 14:54 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, sjg, trini
Hi Denis,
On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> reset: x86: Use cpu_hlt() in pch_sysreset_power_off()
>
> Use cpu_hlt() instead of open-coded 'hlt' in pch_sysreset_power_off().
>
> Also, replace the open-coded busy loop in efi_reset_system() and use
> cpu_hlt().
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> drivers/sysreset/sysreset_x86.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
> diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c
> @@ -120,7 +120,8 @@ void __efi_runtime EFIAPI efi_reset_system(
>
> /* TODO EFI_RESET_SHUTDOWN */
>
> - while (1) { }
> + for (;;)
> + cpu_hlt();
> }
Just to check - this is an __efi_runtime function, so the body must
not call outside the runtime section after SetVirtualAddressMap().
cpu_hlt() is static inline __always_inline in asm/processor.h so it
expands to a bare hlt here, which is fine. Worth mentioning in the
commit message so the runtime-safety is explicit.
Regards,
Simon
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH v3 4/6] reset: x86: Use cpu_hlt() in pch_sysreset_power_off()
2026-06-01 14:54 ` Simon Glass
@ 2026-06-02 6:33 ` dmukhin
0 siblings, 0 replies; 16+ messages in thread
From: dmukhin @ 2026-06-02 6:33 UTC (permalink / raw)
To: Simon Glass; +Cc: dmukhin, u-boot, trini
On Mon, Jun 01, 2026 at 08:54:48AM -0600, Simon Glass wrote:
> Hi Denis,
>
> On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> > reset: x86: Use cpu_hlt() in pch_sysreset_power_off()
> >
> > Use cpu_hlt() instead of open-coded 'hlt' in pch_sysreset_power_off().
> >
> > Also, replace the open-coded busy loop in efi_reset_system() and use
> > cpu_hlt().
> >
> > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> >
> > drivers/sysreset/sysreset_x86.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> > diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c
> > @@ -120,7 +120,8 @@ void __efi_runtime EFIAPI efi_reset_system(
> >
> > /* TODO EFI_RESET_SHUTDOWN */
> >
> > - while (1) { }
> > + for (;;)
> > + cpu_hlt();
> > }
>
> Just to check - this is an __efi_runtime function, so the body must
> not call outside the runtime section after SetVirtualAddressMap().
> cpu_hlt() is static inline __always_inline in asm/processor.h so it
> expands to a bare hlt here, which is fine. Worth mentioning in the
> commit message so the runtime-safety is explicit.
I think I will move that efi_reset_system() fixup to a separate patch
with a proper description.
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 5/6] docs: reset: document cold reset option
2026-05-29 3:48 [PATCH v3 0/6] reset: add board reset type dmukhin
` (3 preceding siblings ...)
2026-05-29 3:48 ` [PATCH v3 4/6] reset: x86: Use cpu_hlt() in pch_sysreset_power_off() dmukhin
@ 2026-05-29 3:48 ` dmukhin
2026-06-01 14:54 ` Simon Glass
2026-05-29 3:48 ` [PATCH v3 6/6] tests: reset: add cold/warm reset types dmukhin
5 siblings, 1 reply; 16+ messages in thread
From: dmukhin @ 2026-05-29 3:48 UTC (permalink / raw)
To: u-boot; +Cc: sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Update the reset command documentation to cover `reset -c` and explain
that the default reset type can be overridden through the relevant
Kconfig choice.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v2:
- n/a
Changes since v1:
- new patch
---
doc/usage/cmd/reset.rst | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/doc/usage/cmd/reset.rst b/doc/usage/cmd/reset.rst
index 79bc8b9deca5..e319d2146caa 100644
--- a/doc/usage/cmd/reset.rst
+++ b/doc/usage/cmd/reset.rst
@@ -12,6 +12,7 @@ Synopsis
::
reset
+ reset -c
reset -w
reset -edl
@@ -21,6 +22,13 @@ Description
Perform reset of the CPU. By default does COLD reset, which resets CPU,
DDR and peripherals, on some boards also resets external PMIC.
+The default behavior may be overridden via
+CONFIG_SYSRESET_CMD_RESET_DEFAULT_{COLD,WARM,POWER,POWER_OFF}.
+
+-c
+ Do COLD reset: reset CPU and peripheral/DDR; on some boards also resets
+ external PMIC.
+
-w
Do WARM reset: reset CPU but keep peripheral/DDR/PMIC active.
--
2.54.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3 5/6] docs: reset: document cold reset option
2026-05-29 3:48 ` [PATCH v3 5/6] docs: reset: document cold reset option dmukhin
@ 2026-06-01 14:54 ` Simon Glass
0 siblings, 0 replies; 16+ messages in thread
From: Simon Glass @ 2026-06-01 14:54 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, sjg, trini
Hi Denis,
On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> docs: reset: document cold reset option
>
> Update the reset command documentation to cover reset -c and explain
> that the default reset type can be overridden through the relevant
> Kconfig choice.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> doc/usage/cmd/reset.rst | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
> diff --git a/doc/usage/cmd/reset.rst b/doc/usage/cmd/reset.rst
> @@ -19,6 +19,13 @@ Description
> Perform reset of the CPU. By default does COLD reset, which resets CPU,
> DDR and peripherals, on some boards also resets external PMIC.
>
> +The default behavior may be overridden via
> +CONFIG_SYSRESET_CMD_RESET_DEFAULT_{COLD,WARM,POWER,POWER_OFF}.
The two sentences contradict each other - the line above says the
default is always COLD, the new line says it can be anything. Please
rework as 'the default is COLD reset unless overridden by ...'.
> diff --git a/doc/usage/cmd/reset.rst b/doc/usage/cmd/reset.rst
> @@ -19,6 +19,13 @@ Description
> +-c
> + Do COLD reset: reset CPU and peripheral/DDR; on some boards also resets
> + external PMIC.
> +
> -w
> Do warm WARM, reset CPU but keep peripheral/DDR/PMIC active.
While here, please fix the pre-existing 'Do warm WARM,' typo on -w and
use a consistent form for both entries (e.g. 'Do WARM reset:' / 'Do
COLD reset:'). The new -c text also duplicates the Description
paragraph; a short 'Do COLD reset (same as the default when
CONFIG_SYSRESET_CMD_RESET_DEFAULT_COLD=y)' would avoid the repetition.
> diff --git a/doc/usage/cmd/reset.rst b/doc/usage/cmd/reset.rst
> @@ -11,7 +11,7 @@ Synopsis
>
> ::
>
> - reset [-w]
> + reset [-c|-w]
While here, -edl is documented further down but missing from the
synopsis. Please list it too so the synopsis matches the option list.
Regards,
Simon
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 6/6] tests: reset: add cold/warm reset types
2026-05-29 3:48 [PATCH v3 0/6] reset: add board reset type dmukhin
` (4 preceding siblings ...)
2026-05-29 3:48 ` [PATCH v3 5/6] docs: reset: document cold reset option dmukhin
@ 2026-05-29 3:48 ` dmukhin
2026-06-01 14:55 ` Simon Glass
5 siblings, 1 reply; 16+ messages in thread
From: dmukhin @ 2026-05-29 3:48 UTC (permalink / raw)
To: u-boot; +Cc: sjg, trini, dmukhin
From: Denis Mukhin <dmukhin@ford.com>
Extend reset tests to cover both -c/-w reset command flags.
Make sure sandbox reset tests are passing.
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v2:
- dropped sandbox condig for pytests
Changes since v1:
- new patch
Test for sandbox:
./test/py/test.py --bd sandbox --build -k test_reset -v
---
test/py/tests/test_reset.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/py/tests/test_reset.py b/test/py/tests/test_reset.py
index af079a706647..e1037c963f77 100644
--- a/test/py/tests/test_reset.py
+++ b/test/py/tests/test_reset.py
@@ -52,12 +52,12 @@ def test_reset(ubman):
test_000_version.test_version(ubman)
@pytest.mark.buildconfigspec('hush_parser')
-def test_reset_w(ubman):
- """Test the reset -w command in non-JTAG bootmode.
- It does WARM reset, which resets CPU but keep DDR/peripherals active.
+@pytest.mark.parametrize("reset_type", ["c", "w"])
+def test_reset_type(ubman, reset_type):
+ """Test the reset -{c,w} command in non-JTAG bootmode.
"""
setup_reset_env(ubman)
- ubman.run_command('reset -w', wait_for_reboot=True)
+ ubman.run_command(f"reset -{reset_type}", wait_for_reboot=True)
# Checks the u-boot command prompt's functionality after reset
test_000_version.test_version(ubman)
--
2.54.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v3 6/6] tests: reset: add cold/warm reset types
2026-05-29 3:48 ` [PATCH v3 6/6] tests: reset: add cold/warm reset types dmukhin
@ 2026-06-01 14:55 ` Simon Glass
0 siblings, 0 replies; 16+ messages in thread
From: Simon Glass @ 2026-06-01 14:55 UTC (permalink / raw)
To: dmukhin; +Cc: u-boot, sjg, trini
Hi Denis,
On 2026-05-29T03:48:33, None <dmukhin@ford.com> wrote:
> tests: reset: add cold/warm reset types
>
> Extend reset tests to cover both -c/-w reset command flags.
> Make sure sandbox reset tests are passing.
>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>
>
> test/py/tests/test_reset.py | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> diff --git a/test/py/tests/test_reset.py b/test/py/tests/test_reset.py
> @@ -52,12 +52,12 @@ def test_reset(ubman):
> +@pytest.mark.parametrize('reset_type', ['c', 'w'])
> +def test_reset_type(ubman, reset_type):
> + """Test the reset -{c,w} command in non-JTAG bootmode.
> """
> setup_reset_env(ubman)
> - ubman.run_command('reset -w', wait_for_reboot=True)
> + ubman.run_command(f"reset -{reset_type}", wait_for_reboot=True)
U-Boot uses single quotes throughout ('hush_parser', 'reset -w',
etc.). Please keep that style - @pytest.mark.parametrize('reset_type',
['c', 'w']) and f'reset -{reset_type}'.
Regards,
Simon
^ permalink raw reply [flat|nested] 16+ messages in thread