ARMv8: Add support for poweroff via PSCI
authorMichal Simek <michal.simek@xilinx.com>
Mon, 29 May 2017 07:11:32 +0000 (09:11 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 5 Jun 2017 18:13:12 +0000 (14:13 -0400)
Add support for calling poweroff in case of psci is wired.
Based on the same solution as is used for reset.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Move all logic in to fwcall.c as other ARMs implement poweroff
via PMIC]
Signed-off-by: Tom Rini <trini@konsulko.com>
arch/arm/cpu/armv8/fwcall.c

index 7dfd27002916ffa2d27e02a4d737d486bd102652..c2202675366f37d3853f1ef3e5d4d11d2b4a3e08 100644 (file)
@@ -1,5 +1,6 @@
 /**
  * (C) Copyright 2014, Cavium Inc.
+ * (C) Copyright 2017, Xilinx Inc.
  *
  * SPDX-License-Identifier:    GPL-2.0+
 **/
@@ -114,6 +115,22 @@ void __noreturn __efi_runtime psci_system_off(void)
                ;
 }
 
+#ifdef CONFIG_CMD_POWEROFF
+int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       puts("poweroff ...\n");
+
+       udelay(50000); /* wait 50 ms */
+
+       disable_interrupts();
+
+       psci_system_off();
+
+       /*NOTREACHED*/
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_PSCI_RESET
 void reset_misc(void)
 {