Patrick Delaunay | c16cc4f | 2019-04-12 11:55:46 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | /* |
| 3 | * Copyright (C) 2019, STMicroelectronics - All Rights Reserved |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <command.h> |
| 8 | #include <sysreset.h> |
| 9 | |
| 10 | int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 11 | { |
| 12 | int ret; |
| 13 | |
| 14 | puts("poweroff ...\n"); |
| 15 | mdelay(100); |
| 16 | |
| 17 | ret = sysreset_walk(SYSRESET_POWER); |
| 18 | |
| 19 | if (ret == -EINPROGRESS) |
| 20 | mdelay(1000); |
| 21 | |
| 22 | /*NOTREACHED when power off*/ |
| 23 | return CMD_RET_FAILURE; |
| 24 | } |