sandbox: Use the reset driver to handle reset
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>
This commit is contained in:
parent
b9d33fa06c
commit
5010d98f02
|
@ -20,7 +20,7 @@ static struct udevice *map_dev;
|
||||||
unsigned long map_len;
|
unsigned long map_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void reset_cpu(ulong ignored)
|
void sandbox_exit(void)
|
||||||
{
|
{
|
||||||
/* Do this here while it still has an effect */
|
/* Do this here while it still has an effect */
|
||||||
os_fd_restore();
|
os_fd_restore();
|
||||||
|
@ -34,13 +34,6 @@ void reset_cpu(ulong ignored)
|
||||||
os_exit(0);
|
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 */
|
/* delay x useconds */
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,6 +196,14 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
reset@0 {
|
||||||
|
compatible = "sandbox,warm-reset";
|
||||||
|
};
|
||||||
|
|
||||||
|
reset@1 {
|
||||||
|
compatible = "sandbox,reset";
|
||||||
|
};
|
||||||
|
|
||||||
spi@0 {
|
spi@0 {
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
|
|
|
@ -83,4 +83,7 @@ void sandbox_set_enable_pci_map(int enable);
|
||||||
*/
|
*/
|
||||||
int sandbox_read_fdt_from_file(void);
|
int sandbox_read_fdt_from_file(void);
|
||||||
|
|
||||||
|
/* Exit sandbox (quit U-Boot) */
|
||||||
|
void sandbox_exit(void);
|
||||||
|
|
||||||
#endif /* _U_BOOT_SANDBOX_H_ */
|
#endif /* _U_BOOT_SANDBOX_H_ */
|
||||||
|
|
|
@ -46,3 +46,4 @@ CONFIG_UT_TIME=y
|
||||||
CONFIG_UT_DM=y
|
CONFIG_UT_DM=y
|
||||||
CONFIG_UT_ENV=y
|
CONFIG_UT_ENV=y
|
||||||
CONFIG_CLK=y
|
CONFIG_CLK=y
|
||||||
|
CONFIG_RESET=y
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int sandbox_reset_request(struct udevice *dev, enum reset_t type)
|
||||||
state->last_reset = type;
|
state->last_reset = type;
|
||||||
if (!state->reset_allowed[type])
|
if (!state->reset_allowed[type])
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
/* TODO: sandbox_exit(); */
|
sandbox_exit();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
Loading…
Reference in New Issue