diff options
author | Urja Rannikko <urjaman@gmail.com> | 2019-05-17 00:48:42 +0300 |
---|---|---|
committer | Kever Yang <kever.yang@rock-chips.com> | 2019-08-19 07:43:26 +0300 |
commit | b8050511c6ee4ab60ef4248dff42aff187696249 (patch) | |
tree | 01e451f3b985b4b14b79c4b45b94b26845eb3dc9 /drivers/sysreset/sysreset-uclass.c | |
parent | 857f39d7b09804566b23e0f20fcb04601f2ecb52 (diff) | |
download | u-boot-b8050511c6ee4ab60ef4248dff42aff187696249.tar.xz |
sysreset: move stm32mp sysreset poweroff implementation to sysreset uclass
This is a generic implementation. Add CONFIG_SYSRESET_CMD_POWEROFF
to signal when we need it. Enable it from the STPMIC1 config and in
sandbox.
The config flag is transitionary, that is it can be removed after all
poweroff implementations use sysreset, and just have CMD_POWEROFF depend
on sysreset.
Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'drivers/sysreset/sysreset-uclass.c')
-rw-r--r-- | drivers/sysreset/sysreset-uclass.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index ad831c703a..39202588ae 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -118,6 +118,24 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +#if IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF) +int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int ret; + + puts("poweroff ...\n"); + mdelay(100); + + ret = sysreset_walk(SYSRESET_POWER_OFF); + + if (ret == -EINPROGRESS) + mdelay(1000); + + /*NOTREACHED when power off*/ + return CMD_RET_FAILURE; +} +#endif + static int sysreset_post_bind(struct udevice *dev) { #if defined(CONFIG_NEEDS_MANUAL_RELOC) |