[U-Boot] [PATCHv2] ARMv8: Add support for poweroff via PSCI

Michal Simek michal.simek at xilinx.com
Mon Jun 5 15:47:11 UTC 2017


On 5.6.2017 17:43, Tom Rini wrote:
> From: Michal Simek <michal.simek at xilinx.com>
> 
> 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 at xilinx.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> [trini: Move all logic in to fwcall.c as other ARMs implement poweroff
> via PMIC]
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>  arch/arm/cpu/armv8/fwcall.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
> index 7dfd27002916..c2202675366f 100644
> --- a/arch/arm/cpu/armv8/fwcall.c
> +++ b/arch/arm/cpu/armv8/fwcall.c
> @@ -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)
>  {
> 

Looks good to me.
BTW: there was a question from Simon if we should use puts or printf.

Thanks,
Michal








More information about the U-Boot mailing list