blob: 966b00bb506861564f2ac9adf0bce3219b432129 [file] [log] [blame]
Tejas Patel354fe572018-12-14 00:55:37 -08001/*
2 * Copyright (c) 2019, Xilinx, Inc. All rights reserved.
3 *
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
Ravi Patel22b0b492019-03-06 12:34:46 +053036#define PM_GET_CALLBACK_DATA 0xa01
37#define PM_GET_TRUSTZONE_VERSION 0xa03
38
39/* PM API Versions */
40#define PM_API_BASE_VERSION 1U
41
Tejas Patel9d09ff92019-01-08 01:46:35 -080042/* PM API ids */
43#define PM_GET_API_VERSION 1U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080044#define PM_GET_DEVICE_STATUS 3U
Saeed Nowshadi2294b422019-06-03 10:22:35 -070045#define PM_GET_OP_CHARACTERISTIC 4U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080046#define PM_REQ_SUSPEND 6U
47#define PM_SELF_SUSPEND 7U
Tejas Patel6b282252019-01-10 03:03:47 -080048#define PM_FORCE_POWERDOWN 8U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080049#define PM_ABORT_SUSPEND 9U
Tejas Patel49cd8712019-01-23 14:18:51 +053050#define PM_REQ_WAKEUP 10U
Tejas Pateldb812052019-01-23 14:18:53 +053051#define PM_SET_WAKEUP_SOURCE 11U
Tejas Patel6b282252019-01-10 03:03:47 -080052#define PM_SYSTEM_SHUTDOWN 12U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080053#define PM_REQUEST_DEVICE 13U
54#define PM_RELEASE_DEVICE 14U
55#define PM_SET_REQUIREMENT 15U
Tejas Patel87c4f3a2019-01-08 01:46:38 -080056#define PM_RESET_ASSERT 17U
57#define PM_RESET_GET_STATUS 18U
Tejas Patel02662022019-01-21 17:56:49 +053058#define PM_INIT_FINALIZE 21U
Ravi Patelbd4aa5a2019-08-12 03:17:54 -070059#define PM_GET_CHIPID 24U
Tejas Patel20e92022019-01-08 01:46:39 -080060#define PM_PINCTRL_REQUEST 28U
61#define PM_PINCTRL_RELEASE 29U
62#define PM_PINCTRL_GET_FUNCTION 30U
63#define PM_PINCTRL_SET_FUNCTION 31U
64#define PM_PINCTRL_CONFIG_PARAM_GET 32U
65#define PM_PINCTRL_CONFIG_PARAM_SET 33U
Tejas Patel9141f442019-01-10 03:03:48 -080066#define PM_IOCTL 34U
Tejas Patela3e34ad2019-02-01 17:25:19 +053067#define PM_QUERY_DATA 35U
Tejas Patel1f56fb12019-01-08 01:46:40 -080068#define PM_CLOCK_ENABLE 36U
69#define PM_CLOCK_DISABLE 37U
70#define PM_CLOCK_GETSTATE 38U
71#define PM_CLOCK_SETDIVIDER 39U
72#define PM_CLOCK_GETDIVIDER 40U
73#define PM_CLOCK_SETRATE 41U
74#define PM_CLOCK_GETRATE 42U
75#define PM_CLOCK_SETPARENT 43U
76#define PM_CLOCK_GETPARENT 44U
Tejas Patel023116d2019-01-08 01:46:41 -080077#define PM_PLL_SET_PARAMETER 48U
78#define PM_PLL_GET_PARAMETER 49U
79#define PM_PLL_SET_MODE 50U
80#define PM_PLL_GET_MODE 51U
Ravi Patel22b0b492019-03-06 12:34:46 +053081#define PM_FEATURE_CHECK 63U
Tejas Patel9d09ff92019-01-08 01:46:35 -080082
Jolly Shahed05a712019-03-22 05:33:39 +053083/* Loader API ids */
84#define PM_LOAD_PDI 0x701U
85
Tejas Patel9141f442019-01-10 03:03:48 -080086/* IOCTL IDs for clock driver */
87#define IOCTL_SET_PLL_FRAC_MODE 8
88#define IOCTL_GET_PLL_FRAC_MODE 9
89#define IOCTL_SET_PLL_FRAC_DATA 10
90#define IOCTL_GET_PLL_FRAC_DATA 11
91
92/* Parameter ID for PLL IOCTLs */
93/* Fractional data portion for PLL */
94#define PM_PLL_PARAM_DATA 2
95
Saeed Nowshadic5a1bda2019-12-08 23:35:35 -080096/* System shutdown macros */
97#define XPM_SHUTDOWN_TYPE_SHUTDOWN 0U
98#define XPM_SHUTDOWN_TYPE_RESET 1U
99#define XPM_SHUTDOWN_TYPE_SETSCOPE_ONLY 2U
100
101#define XPM_SHUTDOWN_SUBTYPE_RST_SUBSYSTEM 0U
102#define XPM_SHUTDOWN_SUBTYPE_RST_PS_ONLY 1U
103#define XPM_SHUTDOWN_SUBTYPE_RST_SYSTEM 2U
104
Tejas Patel354fe572018-12-14 00:55:37 -0800105/*********************************************************************
106 * Enum definitions
107 ********************************************************************/
108
Tejas Patelfe0e10a2019-12-08 23:29:44 -0800109enum pm_abort_reason {
110 ABORT_REASON_WKUP_EVENT = 100,
111 ABORT_REASON_PU_BUSY,
112 ABORT_REASON_NO_PWRDN,
113 ABORT_REASON_UNKNOWN,
114};
115
Saeed Nowshadi2294b422019-06-03 10:22:35 -0700116enum pm_opchar_type {
117 PM_OPCHAR_TYPE_POWER = 1,
118 PM_OPCHAR_TYPE_TEMP,
119 PM_OPCHAR_TYPE_LATENCY,
120};
121
Tejas Patel354fe572018-12-14 00:55:37 -0800122/**
Tejas Patel41f3e0b2019-01-08 01:46:37 -0800123 * Subsystem IDs
124 */
125typedef enum {
126 XPM_SUBSYSID_PMC,
127 XPM_SUBSYSID_PSM,
128 XPM_SUBSYSID_APU,
129 XPM_SUBSYSID_RPU0_LOCK,
130 XPM_SUBSYSID_RPU0_0,
131 XPM_SUBSYSID_RPU0_1,
132 XPM_SUBSYSID_DDR0,
133 XPM_SUBSYSID_ME,
134 XPM_SUBSYSID_PL,
135 XPM_SUBSYSID_MAX,
136} XPm_SubsystemId;
137
138/**
Tejas Patel354fe572018-12-14 00:55:37 -0800139 * @PM_RET_SUCCESS: success
140 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
141 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated)
Ravi Patel22b0b492019-03-06 12:34:46 +0530142 * @PM_RET_ERROR_NOFEATURE: feature is not available
Tejas Patel354fe572018-12-14 00:55:37 -0800143 * @PM_RET_ERROR_INTERNAL: internal error
144 * @PM_RET_ERROR_CONFLICT: conflict
145 * @PM_RET_ERROR_ACCESS: access rights violation
146 * @PM_RET_ERROR_INVALID_NODE: invalid node
147 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node
148 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted
149 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU
150 * @PM_RET_ERROR_NODE_USED: node is already in use
151 */
152enum pm_ret_status {
153 PM_RET_SUCCESS,
154 PM_RET_ERROR_ARGS = 1,
155 PM_RET_ERROR_NOTSUPPORTED = 4,
Ravi Patel22b0b492019-03-06 12:34:46 +0530156 PM_RET_ERROR_NOFEATURE = 19,
Tejas Patel354fe572018-12-14 00:55:37 -0800157 PM_RET_ERROR_INTERNAL = 2000,
158 PM_RET_ERROR_CONFLICT = 2001,
159 PM_RET_ERROR_ACCESS = 2002,
160 PM_RET_ERROR_INVALID_NODE = 2003,
161 PM_RET_ERROR_DOUBLE_REQ = 2004,
162 PM_RET_ERROR_ABORT_SUSPEND = 2005,
163 PM_RET_ERROR_TIMEOUT = 2006,
164 PM_RET_ERROR_NODE_USED = 2007
165};
166#endif /* PM_DEFS_H */