blob: 3324431ddd9effe0ae4d8985fc8cf58659c28a10 [file] [log] [blame]
Soren Brinkmann76fcae32016-03-06 20:16:27 -08001/*
Kalyani Akula6ebe4832020-11-22 22:42:10 -08002 * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
Soren Brinkmann76fcae32016-03-06 20:16:27 -08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soren Brinkmann76fcae32016-03-06 20:16:27 -08005 */
6
7/* ZynqMP power management enums and defines */
8
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00009#ifndef PM_DEFS_H
10#define PM_DEFS_H
Soren Brinkmann76fcae32016-03-06 20:16:27 -080011
12/*********************************************************************
13 * Macro definitions
14 ********************************************************************/
15
16/*
17 * Version number is a 32bit value, like:
18 * (PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR
19 */
Jolly Shahabee2a42018-02-07 15:37:01 -080020#define PM_VERSION_MAJOR 1
Rajan Vaja720fd9d2018-10-05 04:42:57 -070021#define PM_VERSION_MINOR 1
Soren Brinkmann76fcae32016-03-06 20:16:27 -080022
23#define PM_VERSION ((PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR)
24
25/* Capabilities for RAM */
26#define PM_CAP_ACCESS 0x1U
27#define PM_CAP_CONTEXT 0x2U
28
29#define MAX_LATENCY (~0U)
30#define MAX_QOS 100U
31
Filip Drazic0bd9d0c2016-07-20 17:17:39 +020032/* State arguments of the self suspend */
33#define PM_STATE_CPU_IDLE 0x0U
34#define PM_STATE_SUSPEND_TO_RAM 0xFU
35
Venkatesh Yadav Abbarapu7ace4af2020-11-23 04:26:54 -080036#define EM_FUNID_NUM_MASK 0xF0000U
Soren Brinkmann76fcae32016-03-06 20:16:27 -080037/*********************************************************************
38 * Enum definitions
39 ********************************************************************/
40
41enum pm_api_id {
42 /* Miscellaneous API functions: */
43 PM_GET_API_VERSION = 1, /* Do not change or move */
44 PM_SET_CONFIGURATION,
45 PM_GET_NODE_STATUS,
46 PM_GET_OP_CHARACTERISTIC,
47 PM_REGISTER_NOTIFIER,
48 /* API for suspending of PUs: */
49 PM_REQ_SUSPEND,
50 PM_SELF_SUSPEND,
51 PM_FORCE_POWERDOWN,
52 PM_ABORT_SUSPEND,
53 PM_REQ_WAKEUP,
54 PM_SET_WAKEUP_SOURCE,
55 PM_SYSTEM_SHUTDOWN,
56 /* API for managing PM slaves: */
57 PM_REQ_NODE,
58 PM_RELEASE_NODE,
59 PM_SET_REQUIREMENT,
60 PM_SET_MAX_LATENCY,
61 /* Direct control API functions: */
62 PM_RESET_ASSERT,
63 PM_RESET_GET_STATUS,
64 PM_MMIO_WRITE,
65 PM_MMIO_READ,
Filip Drazicca1e0af2017-03-16 16:56:53 +010066 PM_INIT_FINALIZE,
Nava kishore Manne68d460c2016-08-20 23:18:09 +053067 PM_FPGA_LOAD,
68 PM_FPGA_GET_STATUS,
Siva Durga Prasad Paladugu16427d12016-08-24 11:45:47 +053069 PM_GET_CHIPID,
Rajan Vaja670bec02018-01-18 22:54:07 -080070 PM_SECURE_RSA_AES,
71 PM_SECURE_SHA,
72 PM_SECURE_RSA,
Rajan Vaja83687612018-01-17 02:39:20 -080073 PM_PINCTRL_REQUEST,
74 PM_PINCTRL_RELEASE,
75 PM_PINCTRL_GET_FUNCTION,
76 PM_PINCTRL_SET_FUNCTION,
77 PM_PINCTRL_CONFIG_PARAM_GET,
78 PM_PINCTRL_CONFIG_PARAM_SET,
Rajan Vaja5529a012018-01-17 02:39:23 -080079 PM_IOCTL,
Rajan Vaja35116132018-01-17 02:39:25 -080080 /* API to query information from firmware */
81 PM_QUERY_DATA,
82 /* Clock control API functions */
83 PM_CLOCK_ENABLE,
84 PM_CLOCK_DISABLE,
85 PM_CLOCK_GETSTATE,
86 PM_CLOCK_SETDIVIDER,
87 PM_CLOCK_GETDIVIDER,
88 PM_CLOCK_SETRATE,
89 PM_CLOCK_GETRATE,
90 PM_CLOCK_SETPARENT,
91 PM_CLOCK_GETPARENT,
Siva Durga Prasad Paladugua4ed4b22018-04-30 20:06:58 +053092 PM_SECURE_IMAGE,
Siva Durga Prasad Paladugu7c6516a2018-09-04 17:41:34 +053093 /* FPGA PL Readback */
94 PM_FPGA_READ,
Siva Durga Prasad Paladugu8bd905b2018-09-04 18:05:50 +053095 PM_SECURE_AES,
Jolly Shaha7cc5ee2019-01-02 12:27:00 -080096 /* PLL control API functions */
97 PM_PLL_SET_PARAMETER,
Jolly Shahcb2f45d2019-01-04 11:28:38 -080098 PM_PLL_GET_PARAMETER,
Jolly Shah1f0d5852019-01-04 11:32:31 -080099 PM_PLL_SET_MODE,
Jolly Shah141421e2019-01-04 11:35:48 -0800100 PM_PLL_GET_MODE,
Kalyani Akula6ebe4832020-11-22 22:42:10 -0800101 /* PM Register Access API */
102 PM_REGISTER_ACCESS,
VNSL Durgadeb1a362020-11-23 04:46:04 -0800103 PM_EFUSE_ACCESS,
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800104 PM_API_MAX
105};
106
107enum pm_node_id {
108 NODE_UNKNOWN = 0,
109 NODE_APU,
110 NODE_APU_0,
111 NODE_APU_1,
112 NODE_APU_2,
113 NODE_APU_3,
114 NODE_RPU,
115 NODE_RPU_0,
116 NODE_RPU_1,
Rajan Vaja670bec02018-01-18 22:54:07 -0800117 NODE_PLD,
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800118 NODE_FPD,
119 NODE_OCM_BANK_0,
120 NODE_OCM_BANK_1,
121 NODE_OCM_BANK_2,
122 NODE_OCM_BANK_3,
123 NODE_TCM_0_A,
124 NODE_TCM_0_B,
125 NODE_TCM_1_A,
126 NODE_TCM_1_B,
127 NODE_L2,
128 NODE_GPU_PP_0,
129 NODE_GPU_PP_1,
130 NODE_USB_0,
131 NODE_USB_1,
132 NODE_TTC_0,
133 NODE_TTC_1,
134 NODE_TTC_2,
135 NODE_TTC_3,
136 NODE_SATA,
137 NODE_ETH_0,
138 NODE_ETH_1,
139 NODE_ETH_2,
140 NODE_ETH_3,
141 NODE_UART_0,
142 NODE_UART_1,
143 NODE_SPI_0,
144 NODE_SPI_1,
145 NODE_I2C_0,
146 NODE_I2C_1,
147 NODE_SD_0,
148 NODE_SD_1,
149 NODE_DP,
150 NODE_GDMA,
151 NODE_ADMA,
152 NODE_NAND,
153 NODE_QSPI,
154 NODE_GPIO,
155 NODE_CAN_0,
156 NODE_CAN_1,
Mirela Simonoviccd165822017-01-30 17:44:00 +0100157 NODE_EXTERN,
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800158 NODE_APLL,
159 NODE_VPLL,
160 NODE_DPLL,
161 NODE_RPLL,
162 NODE_IOPLL,
163 NODE_DDR,
Mirela Simonovic0ff06ce2016-06-07 18:15:40 +0200164 NODE_IPI_APU,
Mirela Simonovic9b984be2016-06-17 16:17:23 +0200165 NODE_IPI_RPU_0,
Filip Drazic35e99e22016-07-26 12:07:05 +0200166 NODE_GPU,
167 NODE_PCIE,
168 NODE_PCAP,
169 NODE_RTC,
Rajan Vaja670bec02018-01-18 22:54:07 -0800170 NODE_LPD,
171 NODE_VCU,
172 NODE_IPI_RPU_1,
173 NODE_IPI_PL_0,
174 NODE_IPI_PL_1,
175 NODE_IPI_PL_2,
176 NODE_IPI_PL_3,
177 NODE_PL,
Rajan Vaja0ac2be12018-01-17 02:39:21 -0800178 NODE_GEM_TSU,
179 NODE_SWDT_0,
180 NODE_SWDT_1,
181 NODE_CSU,
182 NODE_PJTAG,
183 NODE_TRACE,
184 NODE_TESTSCAN,
185 NODE_PMU,
186 NODE_MAX,
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800187};
188
189enum pm_request_ack {
190 REQ_ACK_NO = 1,
191 REQ_ACK_BLOCKING,
192 REQ_ACK_NON_BLOCKING,
193};
194
195enum pm_abort_reason {
196 ABORT_REASON_WKUP_EVENT = 100,
197 ABORT_REASON_PU_BUSY,
198 ABORT_REASON_NO_PWRDN,
199 ABORT_REASON_UNKNOWN,
200};
201
202enum pm_suspend_reason {
203 SUSPEND_REASON_PU_REQ = 201,
204 SUSPEND_REASON_ALERT,
205 SUSPEND_REASON_SYS_SHUTDOWN,
206};
207
208enum pm_ram_state {
209 PM_RAM_STATE_OFF = 1,
210 PM_RAM_STATE_RETENTION,
211 PM_RAM_STATE_ON,
212};
213
214enum pm_opchar_type {
215 PM_OPCHAR_TYPE_POWER = 1,
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800216 PM_OPCHAR_TYPE_TEMP,
Anes Hadziahmetagic92aee012016-05-12 16:17:30 +0200217 PM_OPCHAR_TYPE_LATENCY,
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800218};
219
220/**
221 * @PM_RET_SUCCESS: success
Davorin Mista8e059012018-08-24 17:09:06 +0200222 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
223 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated)
224 * @PM_RET_ERROR_INTERNAL: internal error
225 * @PM_RET_ERROR_CONFLICT: conflict
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800226 * @PM_RET_ERROR_ACCESS: access rights violation
Davorin Mista8e059012018-08-24 17:09:06 +0200227 * @PM_RET_ERROR_INVALID_NODE: invalid node
228 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node
229 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800230 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU
Davorin Mista8e059012018-08-24 17:09:06 +0200231 * @PM_RET_ERROR_NODE_USED: node is already in use
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800232 */
233enum pm_ret_status {
234 PM_RET_SUCCESS,
Davorin Mista8e059012018-08-24 17:09:06 +0200235 PM_RET_ERROR_ARGS = 1,
236 PM_RET_ERROR_NOTSUPPORTED = 4,
237 PM_RET_ERROR_INTERNAL = 2000,
238 PM_RET_ERROR_CONFLICT = 2001,
239 PM_RET_ERROR_ACCESS = 2002,
240 PM_RET_ERROR_INVALID_NODE = 2003,
241 PM_RET_ERROR_DOUBLE_REQ = 2004,
242 PM_RET_ERROR_ABORT_SUSPEND = 2005,
243 PM_RET_ERROR_TIMEOUT = 2006,
244 PM_RET_ERROR_NODE_USED = 2007
Soren Brinkmann76fcae32016-03-06 20:16:27 -0800245};
246
247/**
248 * @PM_INITIAL_BOOT: boot is a fresh system startup
249 * @PM_RESUME: boot is a resume
250 * @PM_BOOT_ERROR: error, boot cause cannot be identified
251 */
252enum pm_boot_status {
253 PM_INITIAL_BOOT,
254 PM_RESUME,
255 PM_BOOT_ERROR,
256};
257
Siva Durga Prasad Paladugu1f80d3f2018-04-30 15:56:10 +0530258/**
259 * @PMF_SHUTDOWN_TYPE_SHUTDOWN: shutdown
260 * @PMF_SHUTDOWN_TYPE_RESET: reset/reboot
261 * @PMF_SHUTDOWN_TYPE_SETSCOPE_ONLY: set the shutdown/reboot scope
262 */
Soren Brinkmann58fbb9b2016-09-02 09:50:54 -0700263enum pm_shutdown_type {
264 PMF_SHUTDOWN_TYPE_SHUTDOWN,
265 PMF_SHUTDOWN_TYPE_RESET,
Siva Durga Prasad Paladugu1f80d3f2018-04-30 15:56:10 +0530266 PMF_SHUTDOWN_TYPE_SETSCOPE_ONLY,
Soren Brinkmann58fbb9b2016-09-02 09:50:54 -0700267};
268
Siva Durga Prasad Paladugu1f80d3f2018-04-30 15:56:10 +0530269/**
270 * @PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM: shutdown/reboot APU subsystem only
271 * @PMF_SHUTDOWN_SUBTYPE_PS_ONLY: shutdown/reboot entire PS (but not PL)
272 * @PMF_SHUTDOWN_SUBTYPE_SYSTEM: shutdown/reboot entire system
273 */
Soren Brinkmann58fbb9b2016-09-02 09:50:54 -0700274enum pm_shutdown_subtype {
275 PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM,
276 PMF_SHUTDOWN_SUBTYPE_PS_ONLY,
277 PMF_SHUTDOWN_SUBTYPE_SYSTEM,
278};
279
Jolly Shaha7cc5ee2019-01-02 12:27:00 -0800280/**
281 * @PM_PLL_PARAM_DIV2: Enable for divide by 2 function inside the PLL
282 * @PM_PLL_PARAM_FBDIV: Feedback divisor integer portion for the PLL
283 * @PM_PLL_PARAM_DATA: Feedback divisor fractional portion for the PLL
284 * @PM_PLL_PARAM_PRE_SRC: Clock source for PLL input
285 * @PM_PLL_PARAM_POST_SRC: Clock source for PLL Bypass mode
286 * @PM_PLL_PARAM_LOCK_DLY: Lock circuit config settings for lock windowsize
287 * @PM_PLL_PARAM_LOCK_CNT: Lock circuit counter setting
288 * @PM_PLL_PARAM_LFHF: PLL loop filter high frequency capacitor control
289 * @PM_PLL_PARAM_CP: PLL charge pump control
290 * @PM_PLL_PARAM_RES: PLL loop filter resistor control
291 */
292enum pm_pll_param {
293 PM_PLL_PARAM_DIV2,
294 PM_PLL_PARAM_FBDIV,
295 PM_PLL_PARAM_DATA,
296 PM_PLL_PARAM_PRE_SRC,
297 PM_PLL_PARAM_POST_SRC,
298 PM_PLL_PARAM_LOCK_DLY,
299 PM_PLL_PARAM_LOCK_CNT,
300 PM_PLL_PARAM_LFHF,
301 PM_PLL_PARAM_CP,
302 PM_PLL_PARAM_RES,
303 PM_PLL_PARAM_MAX,
304};
305
Jolly Shah1f0d5852019-01-04 11:32:31 -0800306/**
307 * @PM_PLL_MODE_RESET: PLL is in reset (not locked)
308 * @PM_PLL_MODE_INTEGER: PLL is locked in integer mode
309 * @PM_PLL_MODE_FRACTIONAL: PLL is locked in fractional mode
310 */
311enum pm_pll_mode {
312 PM_PLL_MODE_RESET,
313 PM_PLL_MODE_INTEGER,
314 PM_PLL_MODE_FRACTIONAL,
315 PM_PLL_MODE_MAX,
316};
Jolly Shaha7cc5ee2019-01-02 12:27:00 -0800317
Jolly Shah8b4c4c72019-01-04 11:49:46 -0800318/**
319 * @PM_CLOCK_DIV0_ID: Clock divider 0
320 * @PM_CLOCK_DIV1_ID: Clock divider 1
321 */
322enum pm_clock_div_id {
323 PM_CLOCK_DIV0_ID,
324 PM_CLOCK_DIV1_ID,
325};
326
Venkatesh Yadav Abbarapu7ace4af2020-11-23 04:26:54 -0800327/**
328 * EM API IDs
329 */
330enum em_api_id {
331 EM_SET_ACTION = 1,
332 EM_REMOVE_ACTION,
333 EM_SEND_ERRORS,
334};
335
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000336#endif /* PM_DEFS_H */