[PATCH v4 2/7] reset: Add explicit cold reset support

Simon Glass sjg at chromium.org
Sat Jun 27 10:28:15 CEST 2026


Hi Quentin,

On Fri, 26 Jun 2026 at 16:00, Quentin Schulz <quentin.schulz at cherry.de> wrote:
>
> Hi Denis,
>
> On 6/3/26 9:07 AM, dmukhin at ford.com 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 <dmukhin at ford.com>
> > ---
> > 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.

Yes, I wasn't too keen on that [1]...it seems to be causing problems
now. So I suggest removing that method. The only user is Qualcomm - we
can define a new sysreset_t value instead (such as
SYSRESET_TO_DOWNLOAD). Passing argc/argv to a uclass method is really
not a great idea - arg parsing should be done in cmd/

Regards,
Simon

[1] https://lore.kernel.org/u-boot/20260217143957.GZ2747538@bill-the-cat/


More information about the U-Boot mailing list