Lines Matching refs:cluster
112 #define CPU_IDX(cluster, cpu) ((cluster << 2) + cpu) argument
136 static bool clst_single_pwr(int cluster, int cpu) in clst_single_pwr() argument
140 int my_idx = (cluster << 2) + cpu; in clst_single_pwr()
143 return !(pwr_stat & (cpu_mask[cluster] & ~BIT(cpu_pwr_bit[my_idx]))); in clst_single_pwr()
146 static bool clst_single_on(int cluster, int cpu) in clst_single_on() argument
149 int my_idx = (cluster << 2) + cpu; in clst_single_on()
152 return !(on_stat & (cpu_mask[cluster] & ~BIT(my_idx))); in clst_single_on()
170 static void plat_cluster_pwrdwn_common(uint64_t mpidr, int cluster) in plat_cluster_pwrdwn_common() argument
172 if (cluster > 0) in plat_cluster_pwrdwn_common()
180 static void plat_cluster_pwron_common(uint64_t mpidr, int cluster) in plat_cluster_pwron_common() argument
182 if (cluster > 0) { in plat_cluster_pwron_common()
212 static void mcdi_ctrl_before_hotplug_on(int cluster, int cpu) in mcdi_ctrl_before_hotplug_on() argument
215 mcdi_pause_clr(cluster, CPU_IDX(cluster, cpu), OFF); in mcdi_ctrl_before_hotplug_on()
216 mcdi_pause_set(cluster, CPU_IDX(cluster, cpu), ON); in mcdi_ctrl_before_hotplug_on()
220 static void mcdi_ctrl_before_hotplug_off(int cluster, int cpu, bool cluster_off) in mcdi_ctrl_before_hotplug_off() argument
223 mcdi_pause_set(cluster_off ? cluster : -1, in mcdi_ctrl_before_hotplug_off()
224 CPU_IDX(cluster, cpu), OFF); in mcdi_ctrl_before_hotplug_off()
227 static void mcdi_ctrl_cluster_cpu_off(int cluster, int cpu, bool cluster_off) in mcdi_ctrl_cluster_cpu_off() argument
232 sspm_standbywfi_irq_enable(CPU_IDX(cluster, cpu)); in mcdi_ctrl_cluster_cpu_off()
235 sspm_cluster_pwr_off_notify(cluster); in mcdi_ctrl_cluster_cpu_off()
237 sspm_cluster_pwr_on_notify(cluster); in mcdi_ctrl_cluster_cpu_off()
253 static void hotplug_ctrl_cluster_on(int cluster, int cpu) in hotplug_ctrl_cluster_on() argument
256 mcdi_hotplug_clr(cluster, CPU_IDX(cluster, cpu), OFF); in hotplug_ctrl_cluster_on()
257 mcdi_hotplug_set(cluster, -1, ON); in hotplug_ctrl_cluster_on()
258 mcdi_hotplug_wait_ack(cluster, -1, ON); in hotplug_ctrl_cluster_on()
261 if (!spm_get_cluster_powerstate(cluster)) in hotplug_ctrl_cluster_on()
262 spm_poweron_cluster(cluster); in hotplug_ctrl_cluster_on()
266 static void hotplug_ctrl_cpu_on(int cluster, int cpu) in hotplug_ctrl_cpu_on() argument
269 mcdi_hotplug_set(cluster, CPU_IDX(cluster, cpu), ON); in hotplug_ctrl_cpu_on()
271 spm_poweron_cpu(cluster, cpu); in hotplug_ctrl_cpu_on()
274 static void hotplug_ctrl_cpu_on_finish(int cluster, int cpu) in hotplug_ctrl_cpu_on_finish() argument
276 spm_disable_cpu_auto_off(cluster, cpu); in hotplug_ctrl_cpu_on_finish()
279 mcdi_hotplug_clr(cluster, CPU_IDX(cluster, cpu), ON); in hotplug_ctrl_cpu_on_finish()
281 mcdi_pause_clr(cluster, CPU_IDX(cluster, cpu), ON); in hotplug_ctrl_cpu_on_finish()
283 mcdi_avail_cpu_mask_set(BIT(CPU_IDX(cluster, cpu))); in hotplug_ctrl_cpu_on_finish()
286 static void hotplug_ctrl_cluster_cpu_off(int cluster, int cpu, bool cluster_off) in hotplug_ctrl_cluster_cpu_off() argument
288 mcdi_avail_cpu_mask_clr(BIT(CPU_IDX(cluster, cpu))); in hotplug_ctrl_cluster_cpu_off()
291 mcdi_hotplug_set(cluster_off ? cluster : -1, in hotplug_ctrl_cluster_cpu_off()
292 CPU_IDX(cluster, cpu), OFF); in hotplug_ctrl_cluster_cpu_off()
294 spm_enable_cpu_auto_off(cluster, cpu); in hotplug_ctrl_cluster_cpu_off()
297 spm_enable_cluster_auto_off(cluster); in hotplug_ctrl_cluster_cpu_off()
299 spm_set_cpu_power_off(cluster, cpu); in hotplug_ctrl_cluster_cpu_off()
306 int cluster = MPIDR_AFFLVL1_VAL(mpidr); in plat_mtk_power_domain_on() local
307 int clst_pwr = spm_get_cluster_powerstate(cluster); in plat_mtk_power_domain_on()
310 mcdi_ctrl_before_hotplug_on(cluster, cpu); in plat_mtk_power_domain_on()
311 hotplug_ctrl_cluster_on(cluster, cpu); in plat_mtk_power_domain_on()
316 mcucfg_init_archstate(cluster, i, 1); in plat_mtk_power_domain_on()
317 mcucfg_set_bootaddr(cluster, i, secure_entrypoint); in plat_mtk_power_domain_on()
321 hotplug_ctrl_cpu_on(cluster, cpu); in plat_mtk_power_domain_on()
330 int cluster = MPIDR_AFFLVL1_VAL(mpidr); in plat_mtk_power_domain_off() local
334 clst_single_on(cluster, cpu)); in plat_mtk_power_domain_off()
339 plat_cluster_pwrdwn_common(mpidr, cluster); in plat_mtk_power_domain_off()
341 mcdi_ctrl_before_hotplug_off(cluster, cpu, cluster_off); in plat_mtk_power_domain_off()
342 hotplug_ctrl_cluster_cpu_off(cluster, cpu, cluster_off); in plat_mtk_power_domain_off()
349 int cluster = MPIDR_AFFLVL1_VAL(mpidr); in plat_mtk_power_domain_on_finish() local
354 plat_cluster_pwron_common(mpidr, cluster); in plat_mtk_power_domain_on_finish()
358 hotplug_ctrl_cpu_on_finish(cluster, cpu); in plat_mtk_power_domain_on_finish()
365 int cluster = MPIDR_AFFLVL1_VAL(mpidr); in plat_mtk_power_domain_suspend() local
369 bool cluster_off = MCDI_C2 && afflvl1 && clst_single_pwr(cluster, cpu); in plat_mtk_power_domain_suspend()
376 plat_cluster_pwrdwn_common(mpidr, cluster); in plat_mtk_power_domain_suspend()
398 mcdi_ctrl_cluster_cpu_off(cluster, cpu, cluster_off); in plat_mtk_power_domain_suspend()
405 int cluster = MPIDR_AFFLVL1_VAL(mpidr); in plat_mtk_power_domain_suspend_finish() local
434 plat_cluster_pwron_common(mpidr, cluster); in plat_mtk_power_domain_suspend_finish()