blob: ffd5f3fe567c7449d5e43757b2e7054d1fbc8354 [file] [log] [blame]
developer5f735162021-01-04 00:02:34 +08001/*
developerfbc1ea92023-01-06 15:50:33 +08002 * Copyright (c) 2020-2023, MediaTek Inc. All rights reserved.
developer5f735162021-01-04 00:02:34 +08003 *
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
12enum 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_INFRA_5,
20 PLAT_SPM_COND_CG_MMSYS_0,
21 PLAT_SPM_COND_CG_MMSYS_1,
22 PLAT_SPM_COND_CG_MMSYS_2,
23 PLAT_SPM_COND_MAX,
24};
25
developera8cb6502021-06-24 15:17:48 +080026#define PLL_BIT_UNIVPLL BIT(0)
27#define PLL_BIT_MFGPLL BIT(1)
28#define PLL_BIT_MSDCPLL BIT(2)
29#define PLL_BIT_TVDPLL BIT(3)
30#define PLL_BIT_MMPLL BIT(4)
developer5f735162021-01-04 00:02:34 +080031
32/* Definition about SPM_COND_CHECK_BLOCKED
33 * bit [00 ~ 15]: cg blocking index
34 * bit [16 ~ 29]: pll blocking index
35 * bit [30] : pll blocking information
36 * bit [31] : idle condition check fail
37 */
38#define SPM_COND_BLOCKED_CG_IDX U(0)
39#define SPM_COND_BLOCKED_PLL_IDX U(16)
40#define SPM_COND_CHECK_BLOCKED_PLL BIT(30)
41#define SPM_COND_CHECK_FAIL BIT(31)
42
43struct mt_spm_cond_tables {
44 char *name;
45 unsigned int table_cg[PLAT_SPM_COND_MAX];
46 unsigned int table_pll;
47 void *priv;
48};
49
50extern unsigned int mt_spm_cond_check(int state_id,
51 const struct mt_spm_cond_tables *src,
52 const struct mt_spm_cond_tables *dest,
53 struct mt_spm_cond_tables *res);
developerfbc1ea92023-01-06 15:50:33 +080054extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
developer5f735162021-01-04 00:02:34 +080055 int stateid, void *priv);
56#endif /* MT_SPM_CONDIT_H */