mt8173: support big/Little cluster power off for CPU idle(C2 state)
1. add power control for both big and Little cluster in MCDI
2. fix incorrect PCM_HOTPLUG_VALID_MASK in spm_hotplug.c
3. check the power status of cpus in cluster before setting the cputop
power control
Change-Id: Ifa85306a8bc218098667247904d281494c2f7bfe
Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
diff --git a/plat/mediatek/mt8173/plat_pm.c b/plat/mediatek/mt8173/plat_pm.c
index a84d031..f28f8ed 100644
--- a/plat/mediatek/mt8173/plat_pm.c
+++ b/plat/mediatek/mt8173/plat_pm.c
@@ -380,8 +380,8 @@
mmio_write_32(rv, sec_entrypoint);
- if (afflvl == MPIDR_AFFLVL0)
- spm_mcdi_prepare(mpidr);
+ if (afflvl < MPIDR_AFFLVL2)
+ spm_mcdi_prepare_for_off_state(mpidr, afflvl);
if (afflvl >= MPIDR_AFFLVL0)
mt_platform_save_context(mpidr);
@@ -390,12 +390,10 @@
if (afflvl >= MPIDR_AFFLVL1) {
/* Disable coherency if this cluster is to be turned off */
plat_cci_disable();
- disable_scu(mpidr);
-
- trace_power_flow(mpidr, CLUSTER_SUSPEND);
}
if (afflvl >= MPIDR_AFFLVL2) {
+ disable_scu(mpidr);
generic_timer_backup();
spm_system_suspend();
/* Prevent interrupts from spuriously waking up this cpu */
@@ -420,8 +418,6 @@
/* Perform the common cluster specific operations */
if (afflvl >= MPIDR_AFFLVL1) {
- enable_scu(mpidr);
-
/* Enable coherency if this cluster was off */
plat_cci_enable();
trace_power_flow(mpidr, CLUSTER_UP);
@@ -451,22 +447,20 @@
arm_gic_setup();
arm_gic_cpuif_setup();
spm_system_suspend_finish();
+ enable_scu(mpidr);
}
/* Perform the common cluster specific operations */
if (afflvl >= MPIDR_AFFLVL1) {
- enable_scu(mpidr);
-
/* Enable coherency if this cluster was off */
plat_cci_enable();
- trace_power_flow(mpidr, CLUSTER_UP);
}
if (afflvl >= MPIDR_AFFLVL0)
mt_platform_restore_context(mpidr);
- if (afflvl == MPIDR_AFFLVL0)
- spm_mcdi_finish(mpidr);
+ if (afflvl < MPIDR_AFFLVL2)
+ spm_mcdi_finish_for_on_state(mpidr, afflvl);
arm_gic_pcpu_distif_setup();
}