1 /* 2 * Copyright (c) 2021, MediaTek Inc. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef MT_SPM_CONDIT_H 8 #define MT_SPM_CONDIT_H 9 10 #include <mt_lp_rm.h> 11 12 enum PLAT_SPM_COND { 13 PLAT_SPM_COND_MTCMOS1 = 0, 14 PLAT_SPM_COND_CG_INFRA_0, 15 PLAT_SPM_COND_CG_INFRA_1, 16 PLAT_SPM_COND_CG_INFRA_2, 17 PLAT_SPM_COND_CG_INFRA_3, 18 PLAT_SPM_COND_CG_INFRA_4, 19 PLAT_SPM_COND_CG_PERI_SW_0, 20 PLAT_SPM_COND_CG_VPPSYS0_SW_CG_0, 21 PLAT_SPM_COND_CG_VPPSYS0_SW_CG_1, 22 PLAT_SPM_COND_CG_VPPSYS0_SW_CG_2, 23 PLAT_SPM_COND_CG_VPPSYS1_SW_CG_0, 24 PLAT_SPM_COND_CG_VPPSYS1_SW_CG_1, 25 PLAT_SPM_COND_CG_VDOSYS0_SW_CG_0, 26 PLAT_SPM_COND_CG_VDOSYS0_SW_CG_1, 27 PLAT_SPM_COND_CG_VDOSYS1_SW_CG_0, 28 PLAT_SPM_COND_CG_VDOSYS1_SW_CG_1, 29 PLAT_SPM_COND_CG_VDOSYS1_SW_CG_2, 30 PLAT_SPM_COND_CG_I2C_SW_CG, 31 PLAT_SPM_COND_MAX, 32 }; 33 34 enum PLAT_SPM_COND_PLL { 35 PLAT_SPM_COND_PLL_UNIVPLL = 0, 36 PLAT_SPM_COND_PLL_MFGPLL, 37 PLAT_SPM_COND_PLL_MSDCPLL, 38 PLAT_SPM_COND_PLL_TVDPLL, 39 PLAT_SPM_COND_PLL_MMPLL, 40 PLAT_SPM_COND_PLL_MAX, 41 }; 42 43 #define PLL_BIT_MFGPLL BIT(PLAT_SPM_COND_PLL_MFGPLL) 44 #define PLL_BIT_MMPLL BIT(PLAT_SPM_COND_PLL_MMPLL) 45 #define PLL_BIT_UNIVPLL BIT(PLAT_SPM_COND_PLL_UNIVPLL) 46 #define PLL_BIT_MSDCPLL BIT(PLAT_SPM_COND_PLL_MSDCPLL) 47 #define PLL_BIT_TVDPLL BIT(PLAT_SPM_COND_PLL_TVDPLL) 48 49 /* Definition about SPM_COND_CHECK_BLOCKED 50 * bit [00 ~ 17]: cg blocking index 51 * bit [18 ~ 29]: pll blocking index 52 * bit [30] : pll blocking information 53 * bit [31] : idle condition check fail 54 */ 55 #define SPM_COND_BLOCKED_CG_IDX U(0) 56 #define SPM_COND_BLOCKED_PLL_IDX U(18) 57 #define SPM_COND_CHECK_BLOCKED_PLL BIT(30) 58 #define SPM_COND_CHECK_FAIL BIT(31) 59 60 struct mt_spm_cond_tables { 61 char *name; 62 unsigned int table_cg[PLAT_SPM_COND_MAX]; 63 unsigned int table_pll; 64 void *priv; 65 }; 66 67 extern unsigned int mt_spm_cond_check(int state_id, 68 const struct mt_spm_cond_tables *src, 69 const struct mt_spm_cond_tables *dest, 70 struct mt_spm_cond_tables *res); 71 extern int mt_spm_cond_update(struct mt_resource_constraint **con, 72 int stateid, void *priv); 73 #endif /* MT_SPM_CONDIT_H */ 74