1 /* 2 * Copyright (c) 2025, 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 #define SPM_SRAM_SLEEP_DEFAULT_FLAG (SPM_FLAG_DISABLE_SSPM_SRAM_SLEEP) 11 12 #ifdef MTK_PLAT_SPM_SRAM_SLP_UNSUPPORT 13 #define SPM_FLAG_SRAM_SLEEP_CTRL \ 14 (SPM_FLAG_DISABLE_SSPM_SRAM_SLEEP | SPM_FLAG_DISABLE_SYSRAM_SLEEP) 15 16 #define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0) 17 #else 18 #define SPM_FLAG_SRAM_SLEEP_CTRL (SPM_SRAM_SLEEP_DEFAULT_FLAG) 19 #define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0) 20 #endif 21 22 #define SPM_RC_UPDATE_COND_ID_MASK 0xffff 23 #define SPM_RC_UPDATE_COND_RC_ID_MASK 0xffff 24 #define SPM_RC_UPDATE_COND_RC_ID_SHIFT (16) 25 26 #define SPM_RC_UPDATE_COND_RC_ID_GET(val) \ 27 ((val >> SPM_RC_UPDATE_COND_RC_ID_SHIFT) & \ 28 SPM_RC_UPDATE_COND_RC_ID_MASK) 29 30 #define SPM_RC_UPDATE_COND_ID_GET(val) (val & SPM_RC_UPDATE_COND_ID_MASK) 31 32 /* cpu buck/ldo constraint function */ 33 bool spm_is_valid_rc_cpu_buck_ldo(unsigned int cpu, int state_id); 34 int spm_update_rc_cpu_buck_ldo(int state_id, int type, const void *val); 35 unsigned int spm_allow_rc_cpu_buck_ldo(int state_id); 36 int spm_run_rc_cpu_buck_ldo(unsigned int cpu, int state_id); 37 int spm_reset_rc_cpu_buck_ldo(unsigned int cpu, int state_id); 38 int spm_get_status_rc_cpu_buck_ldo(unsigned int type, void *priv); 39 40 /* spm resource syspll constraint function */ 41 bool spm_is_valid_rc_syspll(unsigned int cpu, int state_id); 42 int spm_update_rc_syspll(int state_id, int type, const void *val); 43 unsigned int spm_allow_rc_syspll(int state_id); 44 int spm_run_rc_syspll(unsigned int cpu, int state_id); 45 int spm_reset_rc_syspll(unsigned int cpu, int state_id); 46 int spm_get_status_rc_syspll(unsigned int type, void *priv); 47 48 /* spm resource bus26m constraint function */ 49 bool spm_is_valid_rc_bus26m(unsigned int cpu, int state_id); 50 int spm_update_rc_bus26m(int state_id, int type, const void *val); 51 unsigned int spm_allow_rc_bus26m(int state_id); 52 int spm_run_rc_bus26m(unsigned int cpu, int state_id); 53 int spm_reset_rc_bus26m(unsigned int cpu, int state_id); 54 int spm_get_status_rc_bus26m(unsigned int type, void *priv); 55 56 /* spm resource vcore constraint function */ 57 bool spm_is_valid_rc_vcore(unsigned int cpu, int state_id); 58 int spm_update_rc_vcore(int state_id, int type, const void *val); 59 int spm_run_rc_vcore(unsigned int cpu, int state_id); 60 int spm_reset_rc_vcore(unsigned int cpu, int state_id); 61 int spm_get_status_rc_vcore(unsigned int type, void *priv); 62 63 #endif 64