]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sysreset: provide type of reset in do_reset cmd
authorIgor Opaniuk <igor.opaniuk@foundries.io>
Wed, 31 Mar 2021 23:01:55 +0000 (02:01 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 20 Apr 2021 11:31:12 +0000 (07:31 -0400)
Add additional param for reset cmd, which provides type of reset.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
cmd/boot.c
drivers/sysreset/sysreset-uclass.c

index 36aba22b301b57fcdc60b896c4144595cd39fd66..b84c0ed89ec23843ec3f282bdc3a206370853387 100644 (file)
@@ -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",
        ""
 );
index 9512f6881fca5b58607ad82c9295c0a329b78fca..279b087d16defe9107c0510877db5653d2dc0582 100644 (file)
@@ -122,10 +122,19 @@ void reset_cpu(void)
 #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;
 }