jason-ch chen | fa82b9b | 2021-11-16 09:48:20 +0800 | [diff] [blame] | 1 | /* |
developer | fbc1ea9 | 2023-01-06 15:50:33 +0800 | [diff] [blame] | 2 | * Copyright (c) 2022-2023, MediaTek Inc. All rights reserved. |
jason-ch chen | fa82b9b | 2021-11-16 09:48:20 +0800 | [diff] [blame] | 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 = 1, |
| 15 | PLAT_SPM_COND_CG_INFRA_1 = 2, |
| 16 | PLAT_SPM_COND_CG_INFRA_2 = 3, |
| 17 | PLAT_SPM_COND_CG_INFRA_3 = 4, |
| 18 | PLAT_SPM_COND_CG_INFRA_4 = 5, |
| 19 | PLAT_SPM_COND_CG_INFRA_5 = 6, |
| 20 | PLAT_SPM_COND_CG_MMSYS_0 = 7, |
| 21 | PLAT_SPM_COND_CG_MMSYS_1 = 8, |
| 22 | PLAT_SPM_COND_CG_MMSYS_2 = 9, |
| 23 | PLAT_SPM_COND_CG_MMSYS_3 = 10, |
| 24 | PLAT_SPM_COND_MAX = 11, |
| 25 | }; |
| 26 | |
| 27 | #define PLL_BIT_UNIVPLL BIT(0) |
| 28 | #define PLL_BIT_MFGPLL BIT(1) |
| 29 | #define PLL_BIT_MSDCPLL BIT(2) |
| 30 | #define PLL_BIT_TVDPLL BIT(3) |
| 31 | #define PLL_BIT_MMPLL BIT(4) |
| 32 | |
| 33 | /* |
| 34 | * Definition about SPM_COND_CHECK_BLOCKED |
| 35 | * bit [00 ~ 15]: cg blocking index |
| 36 | * bit [16 ~ 29]: pll blocking index |
| 37 | * bit [30] : pll blocking information |
| 38 | * bit [31] : idle condition check fail |
| 39 | */ |
| 40 | #define SPM_COND_BLOCKED_CG_IDX U(0) |
| 41 | #define SPM_COND_BLOCKED_PLL_IDX U(16) |
| 42 | #define SPM_COND_CHECK_BLOCKED_PLL BIT(30) |
| 43 | #define SPM_COND_CHECK_FAIL BIT(31) |
| 44 | |
| 45 | struct mt_spm_cond_tables { |
| 46 | char *name; |
| 47 | unsigned int table_cg[PLAT_SPM_COND_MAX]; |
| 48 | unsigned int table_pll; |
| 49 | void *priv; |
| 50 | }; |
| 51 | |
| 52 | extern unsigned int mt_spm_cond_check(int state_id, |
| 53 | const struct mt_spm_cond_tables *src, |
| 54 | const struct mt_spm_cond_tables *dest, |
| 55 | struct mt_spm_cond_tables *res); |
| 56 | |
developer | fbc1ea9 | 2023-01-06 15:50:33 +0800 | [diff] [blame] | 57 | extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num, |
jason-ch chen | fa82b9b | 2021-11-16 09:48:20 +0800 | [diff] [blame] | 58 | int stateid, void *priv); |
| 59 | |
| 60 | #endif /* MT_SPM_CONDIT_H */ |