xref: /rk3399_ARM-atf/plat/mediatek/drivers/mtcmos/mt8189/mtcmos.h (revision b67e984664a8644d6cfd1812cabaa02cf24f09c9)
1 /*
2  * Copyright (c) 2025, MediaTek Inc. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef PLAT_MEDIATEK_DRIVERS_MTCMOS_MT8189_MTCMOS_H_
8 #define PLAT_MEDIATEK_DRIVERS_MTCMOS_MT8189_MTCMOS_H_
9 
10 #include <lib/utils_def.h>
11 #include <mtcmos_common.h>
12 #include <platform_def.h>
13 
14 #define RTFF_SAVE	BIT(24)
15 #define RTFF_NRESTORE	BIT(25)
16 #define RTFF_CLK_DIS	BIT(28)
17 
18 #define VLPCFG_REG_BASE				(0x1C00C000)
19 #define POWERON_CONFIG_EN			(SPM_BASE + 0x0)
20 #define UFS0_PWR_CON				(SPM_BASE + 0x0E10)
21 #define UFS0_PHY_PWR_CON			(SPM_BASE + 0x0E14)
22 
23 #define PERISYS_PROTECT_EN_STA_0		(INFRACFG_AO_BASE + 0x0C80)
24 #define PERISYS_PROTECT_EN_STA_0_SET		(INFRACFG_AO_BASE + 0x0C84)
25 #define PERISYS_PROTECT_EN_STA_0_CLR		(INFRACFG_AO_BASE + 0x0C88)
26 #define PERISYS_PROTECT_RDY_STA_0		(INFRACFG_AO_BASE + 0x0C8C)
27 #define VLP_TOPAXI_PROTECTEN			(VLPCFG_REG_BASE + 0x0210)
28 #define VLP_TOPAXI_PROTECTEN_SET		(VLPCFG_REG_BASE + 0x0214)
29 #define VLP_TOPAXI_PROTECTEN_CLR		(VLPCFG_REG_BASE + 0x0218)
30 #define VLP_TOPAXI_PROTECTEN_STA1		(VLPCFG_REG_BASE + 0x0220)
31 
32 #define UFS0_PROT_STEP1_0_MASK		BIT(5)
33 #define UFS0_PROT_STEP2_0_MASK		BIT(4)
34 #define UFS0_PROT_STEP3_0_MASK		BIT(6)
35 
36 static const struct bus_protect ufs0_bus_prot_set_table[] = {
37 	{VLP_TOPAXI_PROTECTEN_SET, VLP_TOPAXI_PROTECTEN_STA1, UFS0_PROT_STEP1_0_MASK},
38 	{PERISYS_PROTECT_EN_STA_0_SET, PERISYS_PROTECT_RDY_STA_0, UFS0_PROT_STEP2_0_MASK},
39 	{VLP_TOPAXI_PROTECTEN_SET, VLP_TOPAXI_PROTECTEN_STA1, UFS0_PROT_STEP3_0_MASK},
40 };
41 
42 static const struct bus_protect ufs0_bus_prot_clr_table[] = {
43 	{VLP_TOPAXI_PROTECTEN_CLR, 0x0, UFS0_PROT_STEP3_0_MASK},
44 	{PERISYS_PROTECT_EN_STA_0_CLR, 0x0, UFS0_PROT_STEP2_0_MASK},
45 	{VLP_TOPAXI_PROTECTEN_CLR, 0x0, UFS0_PROT_STEP1_0_MASK},
46 };
47 
48 static const struct bus_protect ufs0_phy_bus_prot_set_table[] = {};
49 static const struct bus_protect ufs0_phy_bus_prot_clr_table[] = {};
50 
51 #endif /* PLAT_MEDIATEK_DRIVERS_MTCMOS_MT8189_MTCMOS_H_ */
52