1*91f16700Schasinglulu /* 2*91f16700Schasinglulu * Copyright (c) 2019, MediaTek Inc. All rights reserved. 3*91f16700Schasinglulu * 4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu */ 6*91f16700Schasinglulu 7*91f16700Schasinglulu #ifndef MTSPMC_H 8*91f16700Schasinglulu #define MTSPMC_H 9*91f16700Schasinglulu 10*91f16700Schasinglulu /* 11*91f16700Schasinglulu * CONFIG_SPMC_MODE: Select CPU power control mode. 12*91f16700Schasinglulu * 13*91f16700Schasinglulu * 0: Legacy 14*91f16700Schasinglulu * Control power flow from SW through SPM register (MP*_PWR_CON). 15*91f16700Schasinglulu * 1: HW 16*91f16700Schasinglulu * Control power flow from SPMC. Most control flow and timing are handled 17*91f16700Schasinglulu * by SPMC. 18*91f16700Schasinglulu */ 19*91f16700Schasinglulu #define SPMC_MODE 1 20*91f16700Schasinglulu 21*91f16700Schasinglulu int spmc_init(void); 22*91f16700Schasinglulu 23*91f16700Schasinglulu void spm_poweron_cpu(int cluster, int cpu); 24*91f16700Schasinglulu void spm_poweroff_cpu(int cluster, int cpu); 25*91f16700Schasinglulu 26*91f16700Schasinglulu void spm_poweroff_cluster(int cluster); 27*91f16700Schasinglulu void spm_poweron_cluster(int cluster); 28*91f16700Schasinglulu 29*91f16700Schasinglulu int spm_get_cpu_powerstate(int cluster, int cpu); 30*91f16700Schasinglulu int spm_get_cluster_powerstate(int cluster); 31*91f16700Schasinglulu int spm_get_powerstate(uint32_t mask); 32*91f16700Schasinglulu 33*91f16700Schasinglulu void spm_enable_cpu_auto_off(int cluster, int cpu); 34*91f16700Schasinglulu void spm_disable_cpu_auto_off(int cluster, int cpu); 35*91f16700Schasinglulu void spm_set_cpu_power_off(int cluster, int cpu); 36*91f16700Schasinglulu void spm_enable_cluster_auto_off(int cluster); 37*91f16700Schasinglulu 38*91f16700Schasinglulu void mcucfg_init_archstate(int cluster, int cpu, int arm64); 39*91f16700Schasinglulu void mcucfg_set_bootaddr(int cluster, int cpu, uintptr_t bootaddr); 40*91f16700Schasinglulu uintptr_t mcucfg_get_bootaddr(int cluster, int cpu); 41*91f16700Schasinglulu 42*91f16700Schasinglulu #endif /* MTSPMC_H */ 43