blob: 92061208b9bf48192c90bc6d5cbcbebc7b4a1e25 [file] [log] [blame]
Tejas Patel354fe572018-12-14 00:55:37 -08001/*
Tanmay Shahff34daa2021-08-09 11:00:41 -07002 * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
Tejas Patel354fe572018-12-14 00:55:37 -08003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/* Versal power management enums and defines */
8
9#ifndef PM_DEFS_H
10#define PM_DEFS_H
11
12#include "pm_node.h"
13
14/*********************************************************************
15 * Macro definitions
16 ********************************************************************/
17
Tejas Patel54d13192019-02-27 18:44:55 +053018/* State arguments of the self suspend */
19#define PM_STATE_CPU_IDLE 0x0U
20#define PM_STATE_SUSPEND_TO_RAM 0xFU
21
22#define MAX_LATENCY (~0U)
23#define MAX_QOS 100U
24
Tejas Patel354fe572018-12-14 00:55:37 -080025/* Processor core device IDs */
26#define APU_DEVID(IDX) NODEID(XPM_NODECLASS_DEVICE, XPM_NODESUBCL_DEV_CORE, \
27 XPM_NODETYPE_DEV_CORE_APU, (IDX))
28
29#define XPM_DEVID_ACPU_0 APU_DEVID(XPM_NODEIDX_DEV_ACPU_0)
30#define XPM_DEVID_ACPU_1 APU_DEVID(XPM_NODEIDX_DEV_ACPU_1)
31
Tejas Patelfcb7c162019-02-27 18:44:56 +053032#define PERIPH_DEVID(IDX) NODEID(XPM_NODECLASS_DEVICE, \
33 XPM_NODESUBCL_DEV_PERIPH, \
34 XPM_NODETYPE_DEV_PERIPH, (IDX))
35
Abhyuday Godhasaraedc38ae2021-08-04 23:58:46 -070036#define PM_GET_CALLBACK_DATA 0xa01U
37#define PM_GET_TRUSTZONE_VERSION 0xa03U
Tanmay Shah0dde16c2021-12-14 04:53:40 -080038#define TF_A_PM_REGISTER_SGI 0xa04U
Ravi Patel22b0b492019-03-06 12:34:46 +053039
40/* PM API Versions */
41#define PM_API_BASE_VERSION 1U
Ronak Jain70d1c582022-02-04 00:42:55 -080042#define PM_API_VERSION_2 2U
Ravi Patel22b0b492019-03-06 12:34:46 +053043
Rajan Vaja030620d2020-11-23 04:13:54 -080044#define PM_API_QUERY_DATA_VERSION 2U
45
Tejas Patel9d09ff92019-01-08 01:46:35 -080046/* PM API ids */
Tejas Patel42015552020-11-25 01:56:57 -080047#define PM_REGISTER_NOTIFIER 5U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080048#define PM_REQ_SUSPEND 6U
49#define PM_SELF_SUSPEND 7U
Tejas Patel6b282252019-01-10 03:03:47 -080050#define PM_FORCE_POWERDOWN 8U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080051#define PM_ABORT_SUSPEND 9U
Tejas Patel49cd8712019-01-23 14:18:51 +053052#define PM_REQ_WAKEUP 10U
Tejas Pateldb812052019-01-23 14:18:53 +053053#define PM_SET_WAKEUP_SOURCE 11U
Tejas Patel6b282252019-01-10 03:03:47 -080054#define PM_SYSTEM_SHUTDOWN 12U
Tejas Patel9141f442019-01-10 03:03:48 -080055#define PM_IOCTL 34U
Tejas Patela3e34ad2019-02-01 17:25:19 +053056#define PM_QUERY_DATA 35U
Tejas Patel023116d2019-01-08 01:46:41 -080057#define PM_PLL_SET_PARAMETER 48U
58#define PM_PLL_GET_PARAMETER 49U
59#define PM_PLL_SET_MODE 50U
60#define PM_PLL_GET_MODE 51U
Ravi Patel22b0b492019-03-06 12:34:46 +053061#define PM_FEATURE_CHECK 63U
Tejas Patel9d09ff92019-01-08 01:46:35 -080062
Jolly Shahed05a712019-03-22 05:33:39 +053063/* Loader API ids */
64#define PM_LOAD_PDI 0x701U
65
Tejas Patel9141f442019-01-10 03:03:48 -080066/* IOCTL IDs for clock driver */
Abhyuday Godhasaraedc38ae2021-08-04 23:58:46 -070067#define IOCTL_SET_PLL_FRAC_MODE 8U
68#define IOCTL_GET_PLL_FRAC_MODE 9U
69#define IOCTL_SET_PLL_FRAC_DATA 10U
70#define IOCTL_GET_PLL_FRAC_DATA 11U
71#define IOCTL_SET_SGI 25U
Tejas Patel9141f442019-01-10 03:03:48 -080072
73/* Parameter ID for PLL IOCTLs */
74/* Fractional data portion for PLL */
75#define PM_PLL_PARAM_DATA 2
76
Saeed Nowshadic5a1bda2019-12-08 23:35:35 -080077/* System shutdown macros */
78#define XPM_SHUTDOWN_TYPE_SHUTDOWN 0U
79#define XPM_SHUTDOWN_TYPE_RESET 1U
80#define XPM_SHUTDOWN_TYPE_SETSCOPE_ONLY 2U
81
82#define XPM_SHUTDOWN_SUBTYPE_RST_SUBSYSTEM 0U
83#define XPM_SHUTDOWN_SUBTYPE_RST_PS_ONLY 1U
84#define XPM_SHUTDOWN_SUBTYPE_RST_SYSTEM 2U
85
Tejas Patel354fe572018-12-14 00:55:37 -080086/*********************************************************************
87 * Enum definitions
88 ********************************************************************/
89
Tejas Patelfe0e10a2019-12-08 23:29:44 -080090enum pm_abort_reason {
91 ABORT_REASON_WKUP_EVENT = 100,
92 ABORT_REASON_PU_BUSY,
93 ABORT_REASON_NO_PWRDN,
94 ABORT_REASON_UNKNOWN,
95};
96
Saeed Nowshadi2294b422019-06-03 10:22:35 -070097enum pm_opchar_type {
98 PM_OPCHAR_TYPE_POWER = 1,
99 PM_OPCHAR_TYPE_TEMP,
100 PM_OPCHAR_TYPE_LATENCY,
101};
102
Tejas Patel354fe572018-12-14 00:55:37 -0800103/**
Tejas Patel41f3e0b2019-01-08 01:46:37 -0800104 * Subsystem IDs
105 */
106typedef enum {
107 XPM_SUBSYSID_PMC,
108 XPM_SUBSYSID_PSM,
109 XPM_SUBSYSID_APU,
110 XPM_SUBSYSID_RPU0_LOCK,
111 XPM_SUBSYSID_RPU0_0,
112 XPM_SUBSYSID_RPU0_1,
113 XPM_SUBSYSID_DDR0,
114 XPM_SUBSYSID_ME,
115 XPM_SUBSYSID_PL,
116 XPM_SUBSYSID_MAX,
117} XPm_SubsystemId;
118
119/**
Tejas Patel354fe572018-12-14 00:55:37 -0800120 * @PM_RET_SUCCESS: success
121 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
122 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated)
Ravi Patel22b0b492019-03-06 12:34:46 +0530123 * @PM_RET_ERROR_NOFEATURE: feature is not available
Tejas Patel354fe572018-12-14 00:55:37 -0800124 * @PM_RET_ERROR_INTERNAL: internal error
125 * @PM_RET_ERROR_CONFLICT: conflict
126 * @PM_RET_ERROR_ACCESS: access rights violation
127 * @PM_RET_ERROR_INVALID_NODE: invalid node
128 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node
129 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted
130 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU
131 * @PM_RET_ERROR_NODE_USED: node is already in use
132 */
133enum pm_ret_status {
134 PM_RET_SUCCESS,
135 PM_RET_ERROR_ARGS = 1,
136 PM_RET_ERROR_NOTSUPPORTED = 4,
Ravi Patel22b0b492019-03-06 12:34:46 +0530137 PM_RET_ERROR_NOFEATURE = 19,
Tejas Patel354fe572018-12-14 00:55:37 -0800138 PM_RET_ERROR_INTERNAL = 2000,
139 PM_RET_ERROR_CONFLICT = 2001,
140 PM_RET_ERROR_ACCESS = 2002,
141 PM_RET_ERROR_INVALID_NODE = 2003,
142 PM_RET_ERROR_DOUBLE_REQ = 2004,
143 PM_RET_ERROR_ABORT_SUSPEND = 2005,
144 PM_RET_ERROR_TIMEOUT = 2006,
145 PM_RET_ERROR_NODE_USED = 2007
146};
Rajan Vaja030620d2020-11-23 04:13:54 -0800147
148/**
149 * Qids
150 */
151enum pm_query_id {
152 XPM_QID_INVALID,
153 XPM_QID_CLOCK_GET_NAME,
154 XPM_QID_CLOCK_GET_TOPOLOGY,
155 XPM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS,
156 XPM_QID_CLOCK_GET_MUXSOURCES,
157 XPM_QID_CLOCK_GET_ATTRIBUTES,
158 XPM_QID_PINCTRL_GET_NUM_PINS,
159 XPM_QID_PINCTRL_GET_NUM_FUNCTIONS,
160 XPM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS,
161 XPM_QID_PINCTRL_GET_FUNCTION_NAME,
162 XPM_QID_PINCTRL_GET_FUNCTION_GROUPS,
163 XPM_QID_PINCTRL_GET_PIN_GROUPS,
164 XPM_QID_CLOCK_GET_NUM_CLOCKS,
165 XPM_QID_CLOCK_GET_MAX_DIVISOR,
166 XPM_QID_PLD_GET_PARENT,
167};
Tejas Patel354fe572018-12-14 00:55:37 -0800168#endif /* PM_DEFS_H */