All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: reset: add parameters to specify reboot_mode
@ 2019-05-03 20:25 Simon Goldschmidt
  2019-05-03 20:27 ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Goldschmidt @ 2019-05-03 20:25 UTC (permalink / raw)
  To: u-boot

This patch adds parameter support for the 'reset' command to specify
the reboot mode (cold vs. warm).

Checking these parameters is implemented in the DM implementation.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

 cmd/boot.c                         |  4 ++--
 drivers/sysreset/sysreset-uclass.c | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/cmd/boot.c b/cmd/boot.c
index 9150fce80b..c3f33a9ca3 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -56,9 +56,9 @@ U_BOOT_CMD(
 #endif
 
 U_BOOT_CMD(
-	reset, 1, 0,	do_reset,
+	reset, 2, 0,	do_reset,
 	"Perform RESET of the CPU",
-	""
+	"[<cold|warm>] - type of reboot"
 );
 
 #ifdef CONFIG_CMD_POWEROFF
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index ad831c703a..fbda3f44f2 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -111,9 +111,24 @@ void reset_cpu(ulong addr)
 
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+	enum sysreset_t reboot_mode = SYSRESET_COLD;
+
+	if (argc > 1 && argv[1]) {
+		switch (*argv[1]) {
+		case 'w':
+			reboot_mode = SYSRESET_WARM;
+			printf("warm ");
+			break;
+		case 'c':
+			reboot_mode = SYSRESET_COLD;
+			printf("cold ");
+			break;
+		}
+	}
+
 	printf("resetting ...\n");
 
-	sysreset_walk_halt(SYSRESET_COLD);
+	sysreset_walk_halt(reboot_mode);
 
 	return 0;
 }
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-10-09 18:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 20:25 [U-Boot] [PATCH] cmd: reset: add parameters to specify reboot_mode Simon Goldschmidt
2019-05-03 20:27 ` Marek Vasut
2019-05-03 20:33   ` Simon Goldschmidt
2019-05-03 20:37     ` Marek Vasut
2019-05-03 20:40       ` Simon Goldschmidt
2019-05-03 20:43         ` Marek Vasut
2019-05-03 21:10           ` Simon Glass
2019-05-04 18:23             ` Simon Goldschmidt
2019-07-10 18:50               ` Simon Goldschmidt
2019-07-29 10:47                 ` Simon Goldschmidt
2019-08-01 22:45                   ` Simon Glass
2019-08-02  5:53                     ` Simon Goldschmidt
2019-08-02 14:41                       ` Simon Glass
2019-10-09 18:13                         ` Simon Goldschmidt

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.