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

Tom Rini trini at konsulko.com
Mon Jun 5 16:35:29 UTC 2017


On Mon, Jun 05, 2017 at 05:47:11PM +0200, Michal Simek wrote:
> 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.

puts or printf, either way is fine.  In very-much-theory we could get
away with using only printf, I think, and save a tiny amount of space.
Maybe.  I know long ago I was pushing puts vs printf, but then it turns
out to not matter, so I stopped pushing that.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170605/0afbf851/attachment.sig>


More information about the U-Boot mailing list