All of lore.kernel.org
 help / color / mirror / Atom feed
From: dmukhin@ford.com
To: Simon Glass <sjg@chromium.org>
Cc: dmukhin@ford.com, u-boot@lists.denx.de, trini@konsulko.com
Subject: Re: [PATCH v3 2/6] reset: Add explicit cold reset support
Date: Mon, 1 Jun 2026 23:31:47 -0700	[thread overview]
Message-ID: <ah540+djuS/XDbHO@kraken> (raw)
In-Reply-To: <CAFLszTgsoLcMuhy6qQQKhwQOpWxhpF6VJiYCFt8Nh=Vs7drhkg@mail.gmail.com>

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/

  reply	other threads:[~2026-06-02  6:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-06-01 14:54   ` Simon Glass
2026-06-02  6:29     ` dmukhin
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 [this message]
2026-05-29  3:48 ` [PATCH v3 3/6] reset: Print reset type on diagnostic console 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
2026-06-01 14:54   ` Simon Glass
2026-06-02  6:33     ` dmukhin
2026-05-29  3:48 ` [PATCH v3 5/6] docs: reset: document cold reset option 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
2026-06-01 14:55   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ah540+djuS/XDbHO@kraken \
    --to=dmukhin@ford.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.