1 /* 2 * Copyright (c) 2023, MediaTek Inc. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef MT_SPM_RC_INTERNAL_H 8 #define MT_SPM_RC_INTERNAL_H 9 10 #ifdef MTK_PLAT_SPM_SRAM_SLP_UNSUPPORT 11 #define SPM_FLAG_SRAM_SLEEP_CTRL (SPM_FLAG_DISABLE_DRAMC_MCU_SRAM_SLEEP) 12 #define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0) 13 #else 14 #define SPM_FLAG_SRAM_SLEEP_CTRL (0) 15 #define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0) 16 #endif 17 18 #define SPM_RC_UPDATE_COND_ID_MASK (0xffff) 19 #define SPM_RC_UPDATE_COND_RC_ID_MASK (0xffff) 20 #define SPM_RC_UPDATE_COND_RC_ID_SHIFT (16) 21 22 #define SPM_RC_UPDATE_COND_RC_ID_GET(val) \ 23 ((val >> SPM_RC_UPDATE_COND_RC_ID_SHIFT) & SPM_RC_UPDATE_COND_RC_ID_MASK) 24 25 #define SPM_RC_UPDATE_COND_ID_GET(val) (val & SPM_RC_UPDATE_COND_ID_MASK) 26 27 /* cpu buck/ldo constraint function */ 28 bool spm_is_valid_rc_cpu_buck_ldo(unsigned int cpu, int state_id); 29 int spm_update_rc_cpu_buck_ldo(int state_id, int type, const void *val); 30 unsigned int spm_allow_rc_cpu_buck_ldo(int state_id); 31 int spm_run_rc_cpu_buck_ldo(unsigned int cpu, int state_id); 32 int spm_reset_rc_cpu_buck_ldo(unsigned int cpu, int state_id); 33 int spm_get_status_rc_cpu_buck_ldo(unsigned int type, void *priv); 34 35 /* spm resource dram constraint function */ 36 bool spm_is_valid_rc_dram(unsigned int cpu, int state_id); 37 int spm_update_rc_dram(int state_id, int type, const void *val); 38 unsigned int spm_allow_rc_dram(int state_id); 39 int spm_run_rc_dram(unsigned int cpu, int state_id); 40 int spm_reset_rc_dram(unsigned int cpu, int state_id); 41 int spm_get_status_rc_dram(unsigned int type, void *priv); 42 43 /* spm resource syspll constraint function */ 44 bool spm_is_valid_rc_syspll(unsigned int cpu, int state_id); 45 int spm_update_rc_syspll(int state_id, int type, const void *val); 46 unsigned int spm_allow_rc_syspll(int state_id); 47 int spm_run_rc_syspll(unsigned int cpu, int state_id); 48 int spm_reset_rc_syspll(unsigned int cpu, int state_id); 49 int spm_get_status_rc_syspll(unsigned int type, void *priv); 50 51 /* spm resource bus26m constraint function */ 52 bool spm_is_valid_rc_bus26m(unsigned int cpu, int state_id); 53 int spm_update_rc_bus26m(int state_id, int type, const void *val); 54 unsigned int spm_allow_rc_bus26m(int state_id); 55 int spm_run_rc_bus26m(unsigned int cpu, int state_id); 56 int spm_reset_rc_bus26m(unsigned int cpu, int state_id); 57 int spm_get_status_rc_bus26m(unsigned int type, void *priv); 58 59 #endif 60