mt_spm_cond.h 1.71 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Copyright (c) 2020, MediaTek Inc. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef MT_SPM_CONDIT_H
#define MT_SPM_CONDIT_H

#include <mt_lp_rm.h>

enum PLAT_SPM_COND {
	PLAT_SPM_COND_MTCMOS1 = 0,
	PLAT_SPM_COND_CG_INFRA_0,
	PLAT_SPM_COND_CG_INFRA_1,
	PLAT_SPM_COND_CG_INFRA_2,
	PLAT_SPM_COND_CG_INFRA_3,
	PLAT_SPM_COND_CG_INFRA_4,
	PLAT_SPM_COND_CG_INFRA_5,
	PLAT_SPM_COND_CG_MMSYS_0,
	PLAT_SPM_COND_CG_MMSYS_1,
	PLAT_SPM_COND_CG_MMSYS_2,
	PLAT_SPM_COND_MAX,
};

enum PLAT_SPM_COND_PLL {
	PLAT_SPM_COND_PLL_UNIVPLL = 0,
	PLAT_SPM_COND_PLL_MFGPLL,
	PLAT_SPM_COND_PLL_MSDCPLL,
	PLAT_SPM_COND_PLL_TVDPLL,
	PLAT_SPM_COND_PLL_MMPLL,
	PLAT_SPM_COND_PLL_MAX,
};

#define PLL_BIT_MFGPLL	(PLAT_SPM_COND_PLL_MFGPLL)
#define PLL_BIT_MMPLL	(PLAT_SPM_COND_PLL_MMPLL)
#define PLL_BIT_UNIVPLL	(PLAT_SPM_COND_PLL_UNIVPLL)
#define PLL_BIT_MSDCPLL	(PLAT_SPM_COND_PLL_MSDCPLL)
#define PLL_BIT_TVDPLL	(PLAT_SPM_COND_PLL_TVDPLL)

/* Definition about SPM_COND_CHECK_BLOCKED
 * bit [00 ~ 15]: cg blocking index
 * bit [16 ~ 29]: pll blocking index
 * bit [30]     : pll blocking information
 * bit [31]	: idle condition check fail
 */
#define SPM_COND_BLOCKED_CG_IDX		U(0)
#define SPM_COND_BLOCKED_PLL_IDX	U(16)
#define SPM_COND_CHECK_BLOCKED_PLL	BIT(30)
#define SPM_COND_CHECK_FAIL		BIT(31)

struct mt_spm_cond_tables {
	char *name;
	unsigned int table_cg[PLAT_SPM_COND_MAX];
	unsigned int table_pll;
	void *priv;
};

extern unsigned int mt_spm_cond_check(int state_id,
				      const struct mt_spm_cond_tables *src,
				      const struct mt_spm_cond_tables *dest,
				      struct mt_spm_cond_tables *res);
extern int mt_spm_cond_update(struct mt_resource_constraint **con,
			      int stateid, void *priv);
#endif /* MT_SPM_CONDIT_H */