diff mbox

[U-Boot,v2,resend] cmd_boot: Add a poweroff command

Message ID 1452709877-31882-2-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Hans de Goede Jan. 13, 2016, 6:31 p.m. UTC
From: Michael van Slingerland <michael@deviousops.nl>

Add a 'poweroff' command to boot commands, this only gets enabled if the
board Kconfig does a "select CMD_POWEROFF".

Signed-off-by: Michael van Slingerland <michael@deviousops.nl>
[hdegoede@redhat.com: Make the cmd conditional on a CMD_POWEROFF Kconfig]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Improve poweroff help text
-Remove unnecessary #ifdef from command.h
---
 common/Kconfig    | 3 +++
 common/cmd_boot.c | 8 ++++++++
 include/command.h | 1 +
 3 files changed, 12 insertions(+)

Comments

Tom Rini Jan. 14, 2016, 1:22 p.m. UTC | #1
On Wed, Jan 13, 2016 at 07:31:17PM +0100, Hans de Goede wrote:

> From: Michael van Slingerland <michael@deviousops.nl>
> 
> Add a 'poweroff' command to boot commands, this only gets enabled if the
> board Kconfig does a "select CMD_POWEROFF".
> 
> Signed-off-by: Michael van Slingerland <michael@deviousops.nl>
> [hdegoede@redhat.com: Make the cmd conditional on a CMD_POWEROFF Kconfig]
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/Kconfig b/common/Kconfig
index ccf5475..9d446bf 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -184,6 +184,9 @@  config CMD_XIMG
 	help
 	  Extract a part of a multi-image.
 
+config CMD_POWEROFF
+	bool
+
 endmenu
 
 menu "Environment commands"
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index 8f2e070..72f2cf3 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -61,3 +61,11 @@  U_BOOT_CMD(
 	"Perform RESET of the CPU",
 	""
 );
+
+#ifdef CONFIG_CMD_POWEROFF
+U_BOOT_CMD(
+	poweroff, 1, 0,	do_poweroff,
+	"Perform POWEROFF of the device",
+	""
+);
+#endif
diff --git a/include/command.h b/include/command.h
index 2ae9b6c..0524c0b 100644
--- a/include/command.h
+++ b/include/command.h
@@ -110,6 +110,7 @@  extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
 			   char *const argv[]);
 
 extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
 /*
  * Error codes that commands return to cmd_process(). We use the standard 0