sandbox: Use the reset driver to handle reset
authorSimon Glass <sjg@chromium.org>
Mon, 6 Jul 2015 18:54:29 +0000 (12:54 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 21 Jul 2015 23:39:31 +0000 (17:39 -0600)
Move sandbox over to use the reset uclass for reset, instead of a direct
call to do_reset(). This allows us to add tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/cpu.c
arch/sandbox/dts/test.dts
arch/sandbox/include/asm/u-boot-sandbox.h
configs/sandbox_defconfig
drivers/misc/reset_sandbox.c

index e6ddb17a140381b59abd7d8b0c597eff8a18a57e..3a7f5a004b0fa341dfec557f20fa087d41674327 100644 (file)
@@ -20,7 +20,7 @@ static struct udevice *map_dev;
 unsigned long map_len;
 #endif
 
-void reset_cpu(ulong ignored)
+void sandbox_exit(void)
 {
        /* Do this here while it still has an effect */
        os_fd_restore();
@@ -34,13 +34,6 @@ void reset_cpu(ulong ignored)
        os_exit(0);
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-       reset_cpu(0);
-
-       return 0;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
index 3c9abb303fcfad88b1599832d9c44984cb49781e..79b017598cb236ff94ec38b290b8c796e222971f 100644 (file)
                };
        };
 
+       reset@0 {
+               compatible = "sandbox,warm-reset";
+       };
+
+       reset@1 {
+               compatible = "sandbox,reset";
+       };
+
        spi@0 {
                #address-cells = <1>;
                #size-cells = <0>;
index da87cc304067f85ac4e829ef3111901d49de1999..2f3c3f90f2aa814c17bbcd9eb78661e03f1f17cf 100644 (file)
@@ -83,4 +83,7 @@ void sandbox_set_enable_pci_map(int enable);
  */
 int sandbox_read_fdt_from_file(void);
 
+/* Exit sandbox (quit U-Boot) */
+void sandbox_exit(void);
+
 #endif /* _U_BOOT_SANDBOX_H_ */
index 29e7b5b7058fb95ddcdba3042c4f6a0141bca58d..907554f7386985f770e126160c4c701c762e0736 100644 (file)
@@ -46,3 +46,4 @@ CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
 CONFIG_UT_ENV=y
 CONFIG_CLK=y
+CONFIG_RESET=y
index 3cc61ede2a09503c6bc0859b24eb761e21f9ec6d..917121bc5e80777d7ad1da8ff795544ce6ca1c69 100644 (file)
@@ -51,7 +51,7 @@ static int sandbox_reset_request(struct udevice *dev, enum reset_t type)
                state->last_reset = type;
                if (!state->reset_allowed[type])
                        return -EACCES;
-               /* TODO: sandbox_exit(); */
+               sandbox_exit();
                break;
        default:
                return -ENOSYS;