public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@foundries.io>
To: u-boot@lists.denx.de
Subject: [PATCH v4 4/5] sysreset: provide type of reset in do_reset cmd
Date: Thu,  1 Apr 2021 02:01:55 +0300	[thread overview]
Message-ID: <20210331230156.1850191-5-igor.opaniuk@gmail.com> (raw)
In-Reply-To: <20210331230156.1850191-1-igor.opaniuk@gmail.com>

From: Igor Opaniuk <igor.opaniuk@foundries.io>

Add additional param for reset cmd, which provides type of reset.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
---

 cmd/boot.c                         |  2 +-
 drivers/sysreset/sysreset-uclass.c | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/cmd/boot.c b/cmd/boot.c
index 36aba22b30..b84c0ed89e 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -56,7 +56,7 @@ U_BOOT_CMD(
 #endif
 
 U_BOOT_CMD(
-	reset, 1, 0,	do_reset,
+	reset, 2, 0,	do_reset,
 	"Perform RESET of the CPU",
 	""
 );
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index 6c9dc7a384..0412c4a29b 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -122,10 +122,19 @@ void reset_cpu(ulong addr)
 #if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET)
 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
+	enum sysreset_t reset_type = SYSRESET_COLD;
+
+	if (argc > 2)
+		return CMD_RET_USAGE;
+
+	if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'w') {
+		reset_type = SYSRESET_WARM;
+	}
+
 	printf("resetting ...\n");
 	mdelay(100);
 
-	sysreset_walk_halt(SYSRESET_COLD);
+	sysreset_walk_halt(reset_type);
 
 	return 0;
 }
-- 
2.25.1

  parent reply	other threads:[~2021-03-31 23:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 23:01 [PATCH v4 0/5] psci: add support for SYSTEM_RESET2 and PSCI_FEATURES Igor Opaniuk
2021-03-31 23:01 ` [PATCH v4 1/5] psci: add v1.0/v1.1 definitions from Linux Igor Opaniuk
2021-04-20 14:21   ` Tom Rini
2021-03-31 23:01 ` [PATCH v4 2/5] psci: add features/reset2 support Igor Opaniuk
2021-04-20 14:21   ` Tom Rini
2021-05-05 19:20     ` Alex G.
2021-03-31 23:01 ` [PATCH v4 3/5] sysreset: psci: use psci driver exported functions Igor Opaniuk
2021-04-20 14:21   ` Tom Rini
2021-03-31 23:01 ` Igor Opaniuk [this message]
2021-04-20 14:21   ` [PATCH v4 4/5] sysreset: provide type of reset in do_reset cmd Tom Rini
2021-03-31 23:01 ` [PATCH v4 5/5] doc: usage: add usage details for reset cmd Igor Opaniuk
2021-04-20 14:21   ` Tom Rini

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=20210331230156.1850191-5-igor.opaniuk@gmail.com \
    --to=igor.opaniuk@foundries.io \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox