xref: /rk3399_ARM-atf/plat/xilinx/zynqmp/pm_service/zynqmp_pm_defs.h (revision 9ef62bd88d84cf97968af740907dd229aa1eb975)
192f7de1eSJay Buddhabhatti /*
2619bc13eSMichal Simek  * Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved.
392f7de1eSJay Buddhabhatti  * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
492f7de1eSJay Buddhabhatti  *
592f7de1eSJay Buddhabhatti  * SPDX-License-Identifier: BSD-3-Clause
692f7de1eSJay Buddhabhatti  */
792f7de1eSJay Buddhabhatti 
892f7de1eSJay Buddhabhatti /* ZynqMP power management enums and defines */
992f7de1eSJay Buddhabhatti 
1092f7de1eSJay Buddhabhatti #ifndef ZYNQMP_PM_DEFS_H
1192f7de1eSJay Buddhabhatti #define ZYNQMP_PM_DEFS_H
1292f7de1eSJay Buddhabhatti 
1392f7de1eSJay Buddhabhatti /*********************************************************************
1492f7de1eSJay Buddhabhatti  * Macro definitions
1592f7de1eSJay Buddhabhatti  ********************************************************************/
1692f7de1eSJay Buddhabhatti 
1792f7de1eSJay Buddhabhatti /*
1892f7de1eSJay Buddhabhatti  * Version number is a 32bit value, like:
1992f7de1eSJay Buddhabhatti  * (PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR
2092f7de1eSJay Buddhabhatti  */
2192f7de1eSJay Buddhabhatti #define PM_VERSION_MAJOR	1U
2292f7de1eSJay Buddhabhatti #define PM_VERSION_MINOR	1U
2392f7de1eSJay Buddhabhatti 
2492f7de1eSJay Buddhabhatti #define PM_VERSION	((PM_VERSION_MAJOR << 16U) | PM_VERSION_MINOR)
2592f7de1eSJay Buddhabhatti 
26de7ed953SPrasad Kummari /*
2792f7de1eSJay Buddhabhatti  * PM API versions
2892f7de1eSJay Buddhabhatti  */
29de7ed953SPrasad Kummari 
3092f7de1eSJay Buddhabhatti /* Expected version of firmware APIs */
3192f7de1eSJay Buddhabhatti #define FW_API_BASE_VERSION		(1U)
3292f7de1eSJay Buddhabhatti /* Expected version of firmware API for feature check */
3392f7de1eSJay Buddhabhatti #define FW_API_VERSION_2		(2U)
34c8be2240SPrasad Kummari /* Version of APIs implemented in TF-A */
35c8be2240SPrasad Kummari #define TFA_API_BASE_VERSION		(1U)
3692f7de1eSJay Buddhabhatti /* Updating the QUERY_DATA API versioning as the bitmask functionality
3792f7de1eSJay Buddhabhatti  * support is added in the v2.*/
3892f7de1eSJay Buddhabhatti #define TFA_API_QUERY_DATA_VERSION	(2U)
3992f7de1eSJay Buddhabhatti 
4092f7de1eSJay Buddhabhatti /* Capabilities for RAM */
4192f7de1eSJay Buddhabhatti #define PM_CAP_ACCESS	0x1U
4292f7de1eSJay Buddhabhatti #define PM_CAP_CONTEXT	0x2U
4392f7de1eSJay Buddhabhatti 
4492f7de1eSJay Buddhabhatti /* APU processor states */
4592f7de1eSJay Buddhabhatti #define PM_PROC_STATE_FORCEDOFF		0U
4692f7de1eSJay Buddhabhatti #define PM_PROC_STATE_ACTIVE		1U
4792f7de1eSJay Buddhabhatti #define PM_PROC_STATE_SLEEP		2U
4892f7de1eSJay Buddhabhatti #define PM_PROC_STATE_SUSPENDING	3U
4992f7de1eSJay Buddhabhatti 
5092f7de1eSJay Buddhabhatti #define PM_SET_SUSPEND_MODE		0xa02
5192f7de1eSJay Buddhabhatti 
5292f7de1eSJay Buddhabhatti /*********************************************************************
5392f7de1eSJay Buddhabhatti  * Enum definitions
5492f7de1eSJay Buddhabhatti  ********************************************************************/
5592f7de1eSJay Buddhabhatti 
5692f7de1eSJay Buddhabhatti enum pm_node_id {
5792f7de1eSJay Buddhabhatti 	NODE_UNKNOWN = 0,
5892f7de1eSJay Buddhabhatti 	NODE_APU,
5992f7de1eSJay Buddhabhatti 	NODE_APU_0,
6092f7de1eSJay Buddhabhatti 	NODE_APU_1,
6192f7de1eSJay Buddhabhatti 	NODE_APU_2,
6292f7de1eSJay Buddhabhatti 	NODE_APU_3,
6392f7de1eSJay Buddhabhatti 	NODE_RPU,
6492f7de1eSJay Buddhabhatti 	NODE_RPU_0,
6592f7de1eSJay Buddhabhatti 	NODE_RPU_1,
6692f7de1eSJay Buddhabhatti 	NODE_PLD,
6792f7de1eSJay Buddhabhatti 	NODE_FPD,
6892f7de1eSJay Buddhabhatti 	NODE_OCM_BANK_0,
6992f7de1eSJay Buddhabhatti 	NODE_OCM_BANK_1,
7092f7de1eSJay Buddhabhatti 	NODE_OCM_BANK_2,
7192f7de1eSJay Buddhabhatti 	NODE_OCM_BANK_3,
7292f7de1eSJay Buddhabhatti 	NODE_TCM_0_A,
7392f7de1eSJay Buddhabhatti 	NODE_TCM_0_B,
7492f7de1eSJay Buddhabhatti 	NODE_TCM_1_A,
7592f7de1eSJay Buddhabhatti 	NODE_TCM_1_B,
7692f7de1eSJay Buddhabhatti 	NODE_L2,
7792f7de1eSJay Buddhabhatti 	NODE_GPU_PP_0,
7892f7de1eSJay Buddhabhatti 	NODE_GPU_PP_1,
7992f7de1eSJay Buddhabhatti 	NODE_USB_0,
8092f7de1eSJay Buddhabhatti 	NODE_USB_1,
8192f7de1eSJay Buddhabhatti 	NODE_TTC_0,
8292f7de1eSJay Buddhabhatti 	NODE_TTC_1,
8392f7de1eSJay Buddhabhatti 	NODE_TTC_2,
8492f7de1eSJay Buddhabhatti 	NODE_TTC_3,
8592f7de1eSJay Buddhabhatti 	NODE_SATA,
8692f7de1eSJay Buddhabhatti 	NODE_ETH_0,
8792f7de1eSJay Buddhabhatti 	NODE_ETH_1,
8892f7de1eSJay Buddhabhatti 	NODE_ETH_2,
8992f7de1eSJay Buddhabhatti 	NODE_ETH_3,
9092f7de1eSJay Buddhabhatti 	NODE_UART_0,
9192f7de1eSJay Buddhabhatti 	NODE_UART_1,
9292f7de1eSJay Buddhabhatti 	NODE_SPI_0,
9392f7de1eSJay Buddhabhatti 	NODE_SPI_1,
9492f7de1eSJay Buddhabhatti 	NODE_I2C_0,
9592f7de1eSJay Buddhabhatti 	NODE_I2C_1,
9692f7de1eSJay Buddhabhatti 	NODE_SD_0,
9792f7de1eSJay Buddhabhatti 	NODE_SD_1,
9892f7de1eSJay Buddhabhatti 	NODE_DP,
9992f7de1eSJay Buddhabhatti 	NODE_GDMA,
10092f7de1eSJay Buddhabhatti 	NODE_ADMA,
10192f7de1eSJay Buddhabhatti 	NODE_NAND,
10292f7de1eSJay Buddhabhatti 	NODE_QSPI,
10392f7de1eSJay Buddhabhatti 	NODE_GPIO,
10492f7de1eSJay Buddhabhatti 	NODE_CAN_0,
10592f7de1eSJay Buddhabhatti 	NODE_CAN_1,
10692f7de1eSJay Buddhabhatti 	NODE_EXTERN,
10792f7de1eSJay Buddhabhatti 	NODE_APLL,
10892f7de1eSJay Buddhabhatti 	NODE_VPLL,
10992f7de1eSJay Buddhabhatti 	NODE_DPLL,
11092f7de1eSJay Buddhabhatti 	NODE_RPLL,
11192f7de1eSJay Buddhabhatti 	NODE_IOPLL,
11292f7de1eSJay Buddhabhatti 	NODE_DDR,
11392f7de1eSJay Buddhabhatti 	NODE_IPI_APU,
11492f7de1eSJay Buddhabhatti 	NODE_IPI_RPU_0,
11592f7de1eSJay Buddhabhatti 	NODE_GPU,
11692f7de1eSJay Buddhabhatti 	NODE_PCIE,
11792f7de1eSJay Buddhabhatti 	NODE_PCAP,
11892f7de1eSJay Buddhabhatti 	NODE_RTC,
11992f7de1eSJay Buddhabhatti 	NODE_LPD,
12092f7de1eSJay Buddhabhatti 	NODE_VCU,
12192f7de1eSJay Buddhabhatti 	NODE_IPI_RPU_1,
12292f7de1eSJay Buddhabhatti 	NODE_IPI_PL_0,
12392f7de1eSJay Buddhabhatti 	NODE_IPI_PL_1,
12492f7de1eSJay Buddhabhatti 	NODE_IPI_PL_2,
12592f7de1eSJay Buddhabhatti 	NODE_IPI_PL_3,
12692f7de1eSJay Buddhabhatti 	NODE_PL,
12792f7de1eSJay Buddhabhatti 	NODE_GEM_TSU,
12892f7de1eSJay Buddhabhatti 	NODE_SWDT_0,
12992f7de1eSJay Buddhabhatti 	NODE_SWDT_1,
13092f7de1eSJay Buddhabhatti 	NODE_CSU,
13192f7de1eSJay Buddhabhatti 	NODE_PJTAG,
13292f7de1eSJay Buddhabhatti 	NODE_TRACE,
13392f7de1eSJay Buddhabhatti 	NODE_TESTSCAN,
13492f7de1eSJay Buddhabhatti 	NODE_PMU,
13592f7de1eSJay Buddhabhatti 	NODE_MAX,
13692f7de1eSJay Buddhabhatti };
13792f7de1eSJay Buddhabhatti 
13892f7de1eSJay Buddhabhatti enum pm_request_ack {
13992f7de1eSJay Buddhabhatti 	REQ_ACK_NO = 1,
14092f7de1eSJay Buddhabhatti 	REQ_ACK_BLOCKING,
14192f7de1eSJay Buddhabhatti 	REQ_ACK_NON_BLOCKING,
14292f7de1eSJay Buddhabhatti };
14392f7de1eSJay Buddhabhatti 
14492f7de1eSJay Buddhabhatti enum pm_suspend_reason {
14592f7de1eSJay Buddhabhatti 	SUSPEND_REASON_PU_REQ = 201,
14692f7de1eSJay Buddhabhatti 	SUSPEND_REASON_ALERT,
14792f7de1eSJay Buddhabhatti 	SUSPEND_REASON_SYS_SHUTDOWN,
14892f7de1eSJay Buddhabhatti };
14992f7de1eSJay Buddhabhatti 
15092f7de1eSJay Buddhabhatti enum pm_ram_state {
15192f7de1eSJay Buddhabhatti 	PM_RAM_STATE_OFF = 1,
15292f7de1eSJay Buddhabhatti 	PM_RAM_STATE_RETENTION,
15392f7de1eSJay Buddhabhatti 	PM_RAM_STATE_ON,
15492f7de1eSJay Buddhabhatti };
15592f7de1eSJay Buddhabhatti 
15692f7de1eSJay Buddhabhatti /**
157de7ed953SPrasad Kummari  * enum pm_boot_status - enum represents the boot status of the PM.
158de7ed953SPrasad Kummari  * @PM_INITIAL_BOOT: boot is a fresh system startup.
159de7ed953SPrasad Kummari  * @PM_RESUME: boot is a resume.
160de7ed953SPrasad Kummari  * @PM_BOOT_ERROR: error, boot cause cannot be identified.
161de7ed953SPrasad Kummari  *
16292f7de1eSJay Buddhabhatti  */
16392f7de1eSJay Buddhabhatti enum pm_boot_status {
16492f7de1eSJay Buddhabhatti 	PM_INITIAL_BOOT,
16592f7de1eSJay Buddhabhatti 	PM_RESUME,
16692f7de1eSJay Buddhabhatti 	PM_BOOT_ERROR,
16792f7de1eSJay Buddhabhatti };
16892f7de1eSJay Buddhabhatti 
16992f7de1eSJay Buddhabhatti /**
170de7ed953SPrasad Kummari  * enum pm_shutdown_type - enum represents the shutdown type of the PM.
171de7ed953SPrasad Kummari  * @PMF_SHUTDOWN_TYPE_SHUTDOWN: shutdown.
172de7ed953SPrasad Kummari  * @PMF_SHUTDOWN_TYPE_RESET: reset/reboot.
173de7ed953SPrasad Kummari  * @PMF_SHUTDOWN_TYPE_SETSCOPE_ONLY: set the shutdown/reboot scope.
174de7ed953SPrasad Kummari  *
17592f7de1eSJay Buddhabhatti  */
17692f7de1eSJay Buddhabhatti enum pm_shutdown_type {
17792f7de1eSJay Buddhabhatti 	PMF_SHUTDOWN_TYPE_SHUTDOWN,
17892f7de1eSJay Buddhabhatti 	PMF_SHUTDOWN_TYPE_RESET,
17992f7de1eSJay Buddhabhatti 	PMF_SHUTDOWN_TYPE_SETSCOPE_ONLY,
18092f7de1eSJay Buddhabhatti };
18192f7de1eSJay Buddhabhatti 
18292f7de1eSJay Buddhabhatti /**
183de7ed953SPrasad Kummari  * enum pm_shutdown_subtype - enum represents the shutdown subtype of the PM.
184de7ed953SPrasad Kummari  * @PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM: shutdown/reboot APU subsystem only.
185de7ed953SPrasad Kummari  * @PMF_SHUTDOWN_SUBTYPE_PS_ONLY: shutdown/reboot entire PS (but not PL).
186de7ed953SPrasad Kummari  * @PMF_SHUTDOWN_SUBTYPE_SYSTEM: shutdown/reboot entire system.
187de7ed953SPrasad Kummari  *
18892f7de1eSJay Buddhabhatti  */
18992f7de1eSJay Buddhabhatti enum pm_shutdown_subtype {
190*6ae95624SMaheedhar Bollapalli 	PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM  = (0U),
191*6ae95624SMaheedhar Bollapalli 	PMF_SHUTDOWN_SUBTYPE_PS_ONLY = (1U),
192*6ae95624SMaheedhar Bollapalli 	PMF_SHUTDOWN_SUBTYPE_SYSTEM = (2U),
19392f7de1eSJay Buddhabhatti };
19492f7de1eSJay Buddhabhatti 
19592f7de1eSJay Buddhabhatti /**
196de7ed953SPrasad Kummari  * enum pm_pll_mode - enum represents the mode of the PLL.
197de7ed953SPrasad Kummari  * @PM_PLL_MODE_RESET: PLL is in reset (not locked).
198de7ed953SPrasad Kummari  * @PM_PLL_MODE_INTEGER: PLL is locked in integer mode.
199de7ed953SPrasad Kummari  * @PM_PLL_MODE_FRACTIONAL: PLL is locked in fractional mode.
200de7ed953SPrasad Kummari  * @PM_PLL_MODE_MAX: Represents the maximum mode value for the PLL.
20192f7de1eSJay Buddhabhatti  */
20292f7de1eSJay Buddhabhatti enum pm_pll_mode {
20392f7de1eSJay Buddhabhatti 	PM_PLL_MODE_RESET,
20492f7de1eSJay Buddhabhatti 	PM_PLL_MODE_INTEGER,
20592f7de1eSJay Buddhabhatti 	PM_PLL_MODE_FRACTIONAL,
20692f7de1eSJay Buddhabhatti 	PM_PLL_MODE_MAX,
20792f7de1eSJay Buddhabhatti };
20892f7de1eSJay Buddhabhatti 
20992f7de1eSJay Buddhabhatti /**
210de7ed953SPrasad Kummari  * enum pm_clock_div_id - enum represents the clock division identifiers in the
211de7ed953SPrasad Kummari  *                        PM.
212de7ed953SPrasad Kummari  * @PM_CLOCK_DIV0_ID: Clock divider 0.
213de7ed953SPrasad Kummari  * @PM_CLOCK_DIV1_ID: Clock divider 1.
21492f7de1eSJay Buddhabhatti  */
21592f7de1eSJay Buddhabhatti enum pm_clock_div_id {
21692f7de1eSJay Buddhabhatti 	PM_CLOCK_DIV0_ID,
21792f7de1eSJay Buddhabhatti 	PM_CLOCK_DIV1_ID,
21892f7de1eSJay Buddhabhatti };
21992f7de1eSJay Buddhabhatti 
22092f7de1eSJay Buddhabhatti #endif /* ZYNQMP_PM_DEFS_H */
221