Skip to content
Permalink
Browse files

sunxi: use late core_power_down_wfi()

As we do not use the management processor, the cores have to turn their
own power off when requested.
Use the newly introduced late-power-off callback to disable the core's
power gate, which will make the core stopping execution immediately.
This fixes bringing a CPU back online after it has been offlined before.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
  • Loading branch information
Andre-ARM committed Oct 17, 2017
1 parent 8d3f98e commit 91f2402d941036a0db092d5375d0535c270b9121
Showing with 10 additions and 4 deletions.
  1. +10 −4 plat/sun50iw1p1/plat_pm.c
@@ -169,17 +169,22 @@ int sunxi_affinst_standby(unsigned int power_state)
static int32_t sunxi_power_down_common(uint32_t afflvl, uint64_t mpidr,
uint64_t sec_entrypoint)
{
int cpu_nr = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK;
int cluster_nr = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;

/* Prevent interrupts from spuriously waking up this cpu */
arm_gic_cpuif_deactivate();

sun50i_cpu_power_down(cluster_nr, cpu_nr);
/* We can't turn ourselves off at this point, do this later. */

return PSCI_E_SUCCESS;
}

static void sunxi_core_power_down_wfi(uint64_t mpidr)
{
int cpu_nr = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK;
int cluster_nr = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;

sun50i_cpu_power_down(cluster_nr, cpu_nr);
}

/*******************************************************************************
* Handler called when an affinity instance is about to be turned off. The
* level and mpidr determine the affinity instance. The 'state' arg. allows the
@@ -282,6 +287,7 @@ static const plat_pm_ops_t sunxi_ops = {
.affinst_off = sunxi_affinst_off,
.affinst_suspend = sunxi_affinst_suspend,
.affinst_suspend_finish = sunxi_affinst_suspend_finish,
.core_power_down_wfi = sunxi_core_power_down_wfi,
.system_off = sunxi_system_off,
.system_reset = sunxi_system_reset
};

0 comments on commit 91f2402

Please sign in to comment.
You can’t perform that action at this time.