[U-Boot] [PATCH v4 00/11] sunxi: sun5/7i: add the psci suspend function

Antoine Tenart antoine.tenart at free-electrons.com
Sun Apr 30 13:29:45 UTC 2017


Hi all,

Respin this series that was sent in October 2016, with comments and new
psci aware SoC taken into account.

This series adds an implementation of the psci suspend function for both
sun5i and sun7i. This was tested on Nextthing's CHIP, using cpuidle in
Linux.

As the sun5i does not have a GIC, I needed to remove some code from the
generic psci code. To do this I added an ARM_GIC Kconfig option which
needs to be selected by each SoC having a GIC. I already added the
relevant lines for SoCs selecting ARCH_SUPPORT_PSCI. As this Kconfig
option is currently only used in the psci code, it should be safe to add
it even if all the SoCs having a GIC do not select it, as long as they
don't have psci functions.

On multi-core systems, we need to ensure all CPU are in psci suspend
function to switch the cpu clk source. Likewise, the first CPU to exit
the psci suspend function should restore the cpu clk source; and only
the first one. This series adds a few atomic operation (with return
support) in order to solve this problem. I used the Linux
implementation.

This series is based on sunxi/master (6e39de1b337e) and can be found on:
https://github.com/atenart/u-boot sunxi/psci-suspend

Thanks!

Antoine

Since v3:
  - Reworked the atomic functions with return support, based on the Linux
    implementation.
  - Do not disable LDO anymore.
  - Added some comments.
  - Poll the pll1 lock bit before switching to it.
  - Select CONFIG_ARM_GIC directly in CONFIG_TEGRA_COMMON.
  - Select ARM_GIC for mx7 and uniphier as well.

Since v2:
  - Stopped putting the dram into self-refresh.
  - Removed pll2-7 disabling.
  - Added an atomic variable to only change the cpuclk source when all
    CPUs are in idle.
  - Did a similar implementation to be sure the first CPU to leave the
    idle mode switches back the cpuclk source to pll1.
  - Rebased on the latest master and updated the patches.

Since v1:
  - Rebased on the latest master and updated the patches.
  - Fixed a compile warning I introduced in virt-v7.c
  - Added the missing ARM_GIC Kconfig options.
  - Fixed a commit message (removed 'HYP').

Antoine Tenart (11):
  arm: add atomic functions with return support
  arm: add the ARM_GIC configuration option
  sunxi: select ARM_GIC for sun[6789]i
  arm: select ARM_GIC for SoCs having a psci implementation
  tegra: select ARM_GIC for Tegra SoCs
  mx7: select ARM_GIC
  uniphier: select ARM_GIC
  arm: psci: protect GIC specific code with ARM_GIC
  sun5/7i: add an implementation of the psci suspend function
  sun5i: add defines used by the PSCI code
  sun5i: boot in non-secure mode by default

 arch/arm/Kconfig                              |  13 ++++
 arch/arm/cpu/armv7/mx7/Kconfig                |   1 +
 arch/arm/cpu/armv7/nonsec_virt.S              |   6 ++
 arch/arm/cpu/armv7/sunxi/Makefile             |   9 ++-
 arch/arm/cpu/armv7/sunxi/psci.c               |  40 +---------
 arch/arm/cpu/armv7/sunxi/psci.h               |  58 ++++++++++++++
 arch/arm/cpu/armv7/sunxi/psci_suspend.c       | 108 ++++++++++++++++++++++++++
 arch/arm/cpu/armv7/virt-v7.c                  |  42 ++++++----
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |   2 +
 arch/arm/include/asm/atomic.h                 |  36 +++++++++
 arch/arm/mach-tegra/Kconfig                   |   1 +
 arch/arm/mach-uniphier/Kconfig                |   1 +
 board/sunxi/Kconfig                           |  12 +++
 include/configs/sun5i.h                       |   2 +
 14 files changed, 278 insertions(+), 53 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/psci.h
 create mode 100644 arch/arm/cpu/armv7/sunxi/psci_suspend.c

-- 
2.11.0



More information about the U-Boot mailing list