blob: f090db5385ebb8cabd8f2212ba1430b6de3d8329 [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 Patel9d09ff92019-01-08 01:46:35 -080032/* PM API ids */
33#define PM_GET_API_VERSION 1U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080034#define PM_GET_DEVICE_STATUS 3U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080035#define PM_REQ_SUSPEND 6U
36#define PM_SELF_SUSPEND 7U
Tejas Patel6b282252019-01-10 03:03:47 -080037#define PM_FORCE_POWERDOWN 8U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080038#define PM_ABORT_SUSPEND 9U
Tejas Patel49cd8712019-01-23 14:18:51 +053039#define PM_REQ_WAKEUP 10U
Tejas Pateldb812052019-01-23 14:18:53 +053040#define PM_SET_WAKEUP_SOURCE 11U
Tejas Patel6b282252019-01-10 03:03:47 -080041#define PM_SYSTEM_SHUTDOWN 12U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080042#define PM_REQUEST_DEVICE 13U
43#define PM_RELEASE_DEVICE 14U
44#define PM_SET_REQUIREMENT 15U
Tejas Patel87c4f3a2019-01-08 01:46:38 -080045#define PM_RESET_ASSERT 17U
46#define PM_RESET_GET_STATUS 18U
Tejas Patel02662022019-01-21 17:56:49 +053047#define PM_INIT_FINALIZE 21U
Tejas Patel20e92022019-01-08 01:46:39 -080048#define PM_PINCTRL_REQUEST 28U
49#define PM_PINCTRL_RELEASE 29U
50#define PM_PINCTRL_GET_FUNCTION 30U
51#define PM_PINCTRL_SET_FUNCTION 31U
52#define PM_PINCTRL_CONFIG_PARAM_GET 32U
53#define PM_PINCTRL_CONFIG_PARAM_SET 33U
Tejas Patel9141f442019-01-10 03:03:48 -080054#define PM_IOCTL 34U
Tejas Patela3e34ad2019-02-01 17:25:19 +053055#define PM_QUERY_DATA 35U
Tejas Patel1f56fb12019-01-08 01:46:40 -080056#define PM_CLOCK_ENABLE 36U
57#define PM_CLOCK_DISABLE 37U
58#define PM_CLOCK_GETSTATE 38U
59#define PM_CLOCK_SETDIVIDER 39U
60#define PM_CLOCK_GETDIVIDER 40U
61#define PM_CLOCK_SETRATE 41U
62#define PM_CLOCK_GETRATE 42U
63#define PM_CLOCK_SETPARENT 43U
64#define PM_CLOCK_GETPARENT 44U
Tejas Patel023116d2019-01-08 01:46:41 -080065#define PM_PLL_SET_PARAMETER 48U
66#define PM_PLL_GET_PARAMETER 49U
67#define PM_PLL_SET_MODE 50U
68#define PM_PLL_GET_MODE 51U
Tejas Patel9d09ff92019-01-08 01:46:35 -080069
Tejas Patel9141f442019-01-10 03:03:48 -080070/* IOCTL IDs for clock driver */
71#define IOCTL_SET_PLL_FRAC_MODE 8
72#define IOCTL_GET_PLL_FRAC_MODE 9
73#define IOCTL_SET_PLL_FRAC_DATA 10
74#define IOCTL_GET_PLL_FRAC_DATA 11
75
76/* Parameter ID for PLL IOCTLs */
77/* Fractional data portion for PLL */
78#define PM_PLL_PARAM_DATA 2
79
Tejas Patel354fe572018-12-14 00:55:37 -080080/*********************************************************************
81 * Enum definitions
82 ********************************************************************/
83
Tejas Patelfe0e10a2019-12-08 23:29:44 -080084enum pm_abort_reason {
85 ABORT_REASON_WKUP_EVENT = 100,
86 ABORT_REASON_PU_BUSY,
87 ABORT_REASON_NO_PWRDN,
88 ABORT_REASON_UNKNOWN,
89};
90
Tejas Patel354fe572018-12-14 00:55:37 -080091/**
Tejas Patel41f3e0b2019-01-08 01:46:37 -080092 * Subsystem IDs
93 */
94typedef enum {
95 XPM_SUBSYSID_PMC,
96 XPM_SUBSYSID_PSM,
97 XPM_SUBSYSID_APU,
98 XPM_SUBSYSID_RPU0_LOCK,
99 XPM_SUBSYSID_RPU0_0,
100 XPM_SUBSYSID_RPU0_1,
101 XPM_SUBSYSID_DDR0,
102 XPM_SUBSYSID_ME,
103 XPM_SUBSYSID_PL,
104 XPM_SUBSYSID_MAX,
105} XPm_SubsystemId;
106
107/**
Tejas Patel354fe572018-12-14 00:55:37 -0800108 * @PM_RET_SUCCESS: success
109 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
110 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated)
111 * @PM_RET_ERROR_INTERNAL: internal error
112 * @PM_RET_ERROR_CONFLICT: conflict
113 * @PM_RET_ERROR_ACCESS: access rights violation
114 * @PM_RET_ERROR_INVALID_NODE: invalid node
115 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node
116 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted
117 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU
118 * @PM_RET_ERROR_NODE_USED: node is already in use
119 */
120enum pm_ret_status {
121 PM_RET_SUCCESS,
122 PM_RET_ERROR_ARGS = 1,
123 PM_RET_ERROR_NOTSUPPORTED = 4,
124 PM_RET_ERROR_INTERNAL = 2000,
125 PM_RET_ERROR_CONFLICT = 2001,
126 PM_RET_ERROR_ACCESS = 2002,
127 PM_RET_ERROR_INVALID_NODE = 2003,
128 PM_RET_ERROR_DOUBLE_REQ = 2004,
129 PM_RET_ERROR_ABORT_SUSPEND = 2005,
130 PM_RET_ERROR_TIMEOUT = 2006,
131 PM_RET_ERROR_NODE_USED = 2007
132};
133#endif /* PM_DEFS_H */