blob: 77631525edb88812f310321718b056ad727cff46 [file] [log] [blame]
developer451d49d2022-11-16 21:52:21 +08001/*
2 * Copyright (c) 2023, 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#ifdef MTK_PLAT_SPM_SRAM_SLP_UNSUPPORT
11#define SPM_FLAG_SRAM_SLEEP_CTRL (SPM_FLAG_DISABLE_DRAMC_MCU_SRAM_SLEEP)
12#define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0)
13#else
14#define SPM_FLAG_SRAM_SLEEP_CTRL (0)
15#define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0)
16#endif
17
18#define SPM_RC_UPDATE_COND_ID_MASK (0xffff)
19#define SPM_RC_UPDATE_COND_RC_ID_MASK (0xffff)
20#define SPM_RC_UPDATE_COND_RC_ID_SHIFT (16)
21
22#define SPM_RC_UPDATE_COND_RC_ID_GET(val) \
23 ((val >> SPM_RC_UPDATE_COND_RC_ID_SHIFT) & SPM_RC_UPDATE_COND_RC_ID_MASK)
24
25#define SPM_RC_UPDATE_COND_ID_GET(val) (val & SPM_RC_UPDATE_COND_ID_MASK)
26
27/* cpu buck/ldo constraint function */
28bool spm_is_valid_rc_cpu_buck_ldo(unsigned int cpu, int state_id);
29int spm_update_rc_cpu_buck_ldo(int state_id, int type, const void *val);
30unsigned int spm_allow_rc_cpu_buck_ldo(int state_id);
31int spm_run_rc_cpu_buck_ldo(unsigned int cpu, int state_id);
32int spm_reset_rc_cpu_buck_ldo(unsigned int cpu, int state_id);
33int spm_get_status_rc_cpu_buck_ldo(unsigned int type, void *priv);
34
35/* spm resource dram constraint function */
36bool spm_is_valid_rc_dram(unsigned int cpu, int state_id);
37int spm_update_rc_dram(int state_id, int type, const void *val);
38unsigned int spm_allow_rc_dram(int state_id);
39int spm_run_rc_dram(unsigned int cpu, int state_id);
40int spm_reset_rc_dram(unsigned int cpu, int state_id);
41int spm_get_status_rc_dram(unsigned int type, void *priv);
42
43/* spm resource syspll constraint function */
44bool spm_is_valid_rc_syspll(unsigned int cpu, int state_id);
45int spm_update_rc_syspll(int state_id, int type, const void *val);
46unsigned int spm_allow_rc_syspll(int state_id);
47int spm_run_rc_syspll(unsigned int cpu, int state_id);
48int spm_reset_rc_syspll(unsigned int cpu, int state_id);
49int spm_get_status_rc_syspll(unsigned int type, void *priv);
50
51/* spm resource bus26m constraint function */
52bool spm_is_valid_rc_bus26m(unsigned int cpu, int state_id);
53int spm_update_rc_bus26m(int state_id, int type, const void *val);
54unsigned int spm_allow_rc_bus26m(int state_id);
55int spm_run_rc_bus26m(unsigned int cpu, int state_id);
56int spm_reset_rc_bus26m(unsigned int cpu, int state_id);
57int spm_get_status_rc_bus26m(unsigned int type, void *priv);
58
59#endif