pm_defs.h 5.14 KB
Newer Older
1
/*
2
 * Copyright (c) 2019-2020, Xilinx, Inc. All rights reserved.
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Versal power management enums and defines */

#ifndef PM_DEFS_H
#define PM_DEFS_H

#include "pm_node.h"

/*********************************************************************
 * Macro definitions
 ********************************************************************/

18
19
20
21
22
23
24
/* State arguments of the self suspend */
#define PM_STATE_CPU_IDLE	0x0U
#define PM_STATE_SUSPEND_TO_RAM	0xFU

#define MAX_LATENCY		(~0U)
#define MAX_QOS			100U

25
26
27
28
29
30
31
/* Processor core device IDs */
#define APU_DEVID(IDX)	NODEID(XPM_NODECLASS_DEVICE, XPM_NODESUBCL_DEV_CORE, \
			       XPM_NODETYPE_DEV_CORE_APU, (IDX))

#define XPM_DEVID_ACPU_0	APU_DEVID(XPM_NODEIDX_DEV_ACPU_0)
#define XPM_DEVID_ACPU_1	APU_DEVID(XPM_NODEIDX_DEV_ACPU_1)

32
33
34
35
#define PERIPH_DEVID(IDX)	NODEID(XPM_NODECLASS_DEVICE, \
				       XPM_NODESUBCL_DEV_PERIPH, \
				       XPM_NODETYPE_DEV_PERIPH, (IDX))

36
37
38
39
40
41
#define PM_GET_CALLBACK_DATA		0xa01
#define PM_GET_TRUSTZONE_VERSION	0xa03

/* PM API Versions */
#define PM_API_BASE_VERSION		1U

42
43
#define PM_API_QUERY_DATA_VERSION	2U

44
45
/* PM API ids */
#define PM_GET_API_VERSION		1U
46
#define PM_GET_DEVICE_STATUS		3U
47
#define PM_GET_OP_CHARACTERISTIC	4U
48
#define PM_REGISTER_NOTIFIER		5U
49
50
#define PM_REQ_SUSPEND			6U
#define PM_SELF_SUSPEND			7U
51
#define PM_FORCE_POWERDOWN		8U
52
#define PM_ABORT_SUSPEND		9U
53
#define PM_REQ_WAKEUP			10U
54
#define PM_SET_WAKEUP_SOURCE		11U
55
#define PM_SYSTEM_SHUTDOWN		12U
56
57
58
#define PM_REQUEST_DEVICE		13U
#define PM_RELEASE_DEVICE		14U
#define PM_SET_REQUIREMENT		15U
59
#define PM_SET_MAX_LATENCY		16U
60
61
#define PM_RESET_ASSERT			17U
#define PM_RESET_GET_STATUS		18U
62
#define PM_INIT_FINALIZE		21U
Ravi Patel's avatar
Ravi Patel committed
63
#define PM_GET_CHIPID			24U
64
65
66
67
68
69
#define	PM_PINCTRL_REQUEST		28U
#define	PM_PINCTRL_RELEASE		29U
#define	PM_PINCTRL_GET_FUNCTION		30U
#define	PM_PINCTRL_SET_FUNCTION		31U
#define	PM_PINCTRL_CONFIG_PARAM_GET	32U
#define	PM_PINCTRL_CONFIG_PARAM_SET	33U
70
#define PM_IOCTL			34U
71
#define PM_QUERY_DATA			35U
72
73
74
75
76
77
78
79
80
#define PM_CLOCK_ENABLE			36U
#define PM_CLOCK_DISABLE		37U
#define PM_CLOCK_GETSTATE		38U
#define PM_CLOCK_SETDIVIDER		39U
#define PM_CLOCK_GETDIVIDER		40U
#define PM_CLOCK_SETRATE		41U
#define PM_CLOCK_GETRATE		42U
#define PM_CLOCK_SETPARENT		43U
#define PM_CLOCK_GETPARENT		44U
81
82
83
84
#define PM_PLL_SET_PARAMETER		48U
#define PM_PLL_GET_PARAMETER		49U
#define PM_PLL_SET_MODE			50U
#define PM_PLL_GET_MODE			51U
85
#define PM_FEATURE_CHECK		63U
86

87
88
89
/* Loader API ids */
#define PM_LOAD_PDI			0x701U

90
91
92
93
94
95
96
97
98
99
/* IOCTL IDs for clock driver */
#define IOCTL_SET_PLL_FRAC_MODE		8
#define	IOCTL_GET_PLL_FRAC_MODE		9
#define	IOCTL_SET_PLL_FRAC_DATA		10
#define	IOCTL_GET_PLL_FRAC_DATA		11

/* Parameter ID for PLL IOCTLs */
/* Fractional data portion for PLL */
#define PM_PLL_PARAM_DATA	2

100
101
102
103
104
105
106
107
108
/* System shutdown macros */
#define	XPM_SHUTDOWN_TYPE_SHUTDOWN	0U
#define	XPM_SHUTDOWN_TYPE_RESET		1U
#define	XPM_SHUTDOWN_TYPE_SETSCOPE_ONLY	2U

#define	XPM_SHUTDOWN_SUBTYPE_RST_SUBSYSTEM	0U
#define	XPM_SHUTDOWN_SUBTYPE_RST_PS_ONLY	1U
#define	XPM_SHUTDOWN_SUBTYPE_RST_SYSTEM		2U

109
110
111
112
/*********************************************************************
 * Enum definitions
 ********************************************************************/

113
114
115
116
117
118
119
enum pm_abort_reason {
	ABORT_REASON_WKUP_EVENT = 100,
	ABORT_REASON_PU_BUSY,
	ABORT_REASON_NO_PWRDN,
	ABORT_REASON_UNKNOWN,
};

120
121
122
123
124
125
enum pm_opchar_type {
	PM_OPCHAR_TYPE_POWER = 1,
	PM_OPCHAR_TYPE_TEMP,
	PM_OPCHAR_TYPE_LATENCY,
};

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
 * Subsystem IDs
 */
typedef enum {
	XPM_SUBSYSID_PMC,
	XPM_SUBSYSID_PSM,
	XPM_SUBSYSID_APU,
	XPM_SUBSYSID_RPU0_LOCK,
	XPM_SUBSYSID_RPU0_0,
	XPM_SUBSYSID_RPU0_1,
	XPM_SUBSYSID_DDR0,
	XPM_SUBSYSID_ME,
	XPM_SUBSYSID_PL,
	XPM_SUBSYSID_MAX,
} XPm_SubsystemId;

142
143
144
145
/**
 * @PM_RET_SUCCESS:		success
 * @PM_RET_ERROR_ARGS:		illegal arguments provided (deprecated)
 * @PM_RET_ERROR_NOTSUPPORTED:	feature not supported  (deprecated)
146
 * @PM_RET_ERROR_NOFEATURE:	feature is not available
147
148
149
150
151
152
153
154
155
156
157
158
159
 * @PM_RET_ERROR_INTERNAL:	internal error
 * @PM_RET_ERROR_CONFLICT:	conflict
 * @PM_RET_ERROR_ACCESS:	access rights violation
 * @PM_RET_ERROR_INVALID_NODE:	invalid node
 * @PM_RET_ERROR_DOUBLE_REQ:	duplicate request for same node
 * @PM_RET_ERROR_ABORT_SUSPEND:	suspend procedure has been aborted
 * @PM_RET_ERROR_TIMEOUT:	timeout in communication with PMU
 * @PM_RET_ERROR_NODE_USED:	node is already in use
 */
enum pm_ret_status {
	PM_RET_SUCCESS,
	PM_RET_ERROR_ARGS = 1,
	PM_RET_ERROR_NOTSUPPORTED = 4,
160
	PM_RET_ERROR_NOFEATURE = 19,
161
162
163
164
165
166
167
168
169
	PM_RET_ERROR_INTERNAL = 2000,
	PM_RET_ERROR_CONFLICT = 2001,
	PM_RET_ERROR_ACCESS = 2002,
	PM_RET_ERROR_INVALID_NODE = 2003,
	PM_RET_ERROR_DOUBLE_REQ = 2004,
	PM_RET_ERROR_ABORT_SUSPEND = 2005,
	PM_RET_ERROR_TIMEOUT = 2006,
	PM_RET_ERROR_NODE_USED = 2007
};
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

/**
 * Qids
 */
enum pm_query_id {
	XPM_QID_INVALID,
	XPM_QID_CLOCK_GET_NAME,
	XPM_QID_CLOCK_GET_TOPOLOGY,
	XPM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS,
	XPM_QID_CLOCK_GET_MUXSOURCES,
	XPM_QID_CLOCK_GET_ATTRIBUTES,
	XPM_QID_PINCTRL_GET_NUM_PINS,
	XPM_QID_PINCTRL_GET_NUM_FUNCTIONS,
	XPM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS,
	XPM_QID_PINCTRL_GET_FUNCTION_NAME,
	XPM_QID_PINCTRL_GET_FUNCTION_GROUPS,
	XPM_QID_PINCTRL_GET_PIN_GROUPS,
	XPM_QID_CLOCK_GET_NUM_CLOCKS,
	XPM_QID_CLOCK_GET_MAX_DIVISOR,
	XPM_QID_PLD_GET_PARENT,
};
191
#endif /* PM_DEFS_H */