blob: 7d69699ba120a858651934fc28cb88980d5ebe04 [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
18/* Processor core device IDs */
19#define APU_DEVID(IDX) NODEID(XPM_NODECLASS_DEVICE, XPM_NODESUBCL_DEV_CORE, \
20 XPM_NODETYPE_DEV_CORE_APU, (IDX))
21
22#define XPM_DEVID_ACPU_0 APU_DEVID(XPM_NODEIDX_DEV_ACPU_0)
23#define XPM_DEVID_ACPU_1 APU_DEVID(XPM_NODEIDX_DEV_ACPU_1)
24
Tejas Patel9d09ff92019-01-08 01:46:35 -080025/* PM API ids */
26#define PM_GET_API_VERSION 1U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080027#define PM_GET_DEVICE_STATUS 3U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080028#define PM_REQ_SUSPEND 6U
29#define PM_SELF_SUSPEND 7U
Tejas Patel6b282252019-01-10 03:03:47 -080030#define PM_FORCE_POWERDOWN 8U
Tejas Patelfe0e10a2019-12-08 23:29:44 -080031#define PM_ABORT_SUSPEND 9U
Tejas Patel49cd8712019-01-23 14:18:51 +053032#define PM_REQ_WAKEUP 10U
Tejas Pateldb812052019-01-23 14:18:53 +053033#define PM_SET_WAKEUP_SOURCE 11U
Tejas Patel6b282252019-01-10 03:03:47 -080034#define PM_SYSTEM_SHUTDOWN 12U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080035#define PM_REQUEST_DEVICE 13U
36#define PM_RELEASE_DEVICE 14U
37#define PM_SET_REQUIREMENT 15U
Tejas Patel87c4f3a2019-01-08 01:46:38 -080038#define PM_RESET_ASSERT 17U
39#define PM_RESET_GET_STATUS 18U
Tejas Patel02662022019-01-21 17:56:49 +053040#define PM_INIT_FINALIZE 21U
Tejas Patel20e92022019-01-08 01:46:39 -080041#define PM_PINCTRL_REQUEST 28U
42#define PM_PINCTRL_RELEASE 29U
43#define PM_PINCTRL_GET_FUNCTION 30U
44#define PM_PINCTRL_SET_FUNCTION 31U
45#define PM_PINCTRL_CONFIG_PARAM_GET 32U
46#define PM_PINCTRL_CONFIG_PARAM_SET 33U
Tejas Patel9141f442019-01-10 03:03:48 -080047#define PM_IOCTL 34U
Tejas Patela3e34ad2019-02-01 17:25:19 +053048#define PM_QUERY_DATA 35U
Tejas Patel1f56fb12019-01-08 01:46:40 -080049#define PM_CLOCK_ENABLE 36U
50#define PM_CLOCK_DISABLE 37U
51#define PM_CLOCK_GETSTATE 38U
52#define PM_CLOCK_SETDIVIDER 39U
53#define PM_CLOCK_GETDIVIDER 40U
54#define PM_CLOCK_SETRATE 41U
55#define PM_CLOCK_GETRATE 42U
56#define PM_CLOCK_SETPARENT 43U
57#define PM_CLOCK_GETPARENT 44U
Tejas Patel023116d2019-01-08 01:46:41 -080058#define PM_PLL_SET_PARAMETER 48U
59#define PM_PLL_GET_PARAMETER 49U
60#define PM_PLL_SET_MODE 50U
61#define PM_PLL_GET_MODE 51U
Tejas Patel9d09ff92019-01-08 01:46:35 -080062
Tejas Patel9141f442019-01-10 03:03:48 -080063/* IOCTL IDs for clock driver */
64#define IOCTL_SET_PLL_FRAC_MODE 8
65#define IOCTL_GET_PLL_FRAC_MODE 9
66#define IOCTL_SET_PLL_FRAC_DATA 10
67#define IOCTL_GET_PLL_FRAC_DATA 11
68
69/* Parameter ID for PLL IOCTLs */
70/* Fractional data portion for PLL */
71#define PM_PLL_PARAM_DATA 2
72
Tejas Patel354fe572018-12-14 00:55:37 -080073/*********************************************************************
74 * Enum definitions
75 ********************************************************************/
76
Tejas Patelfe0e10a2019-12-08 23:29:44 -080077enum pm_abort_reason {
78 ABORT_REASON_WKUP_EVENT = 100,
79 ABORT_REASON_PU_BUSY,
80 ABORT_REASON_NO_PWRDN,
81 ABORT_REASON_UNKNOWN,
82};
83
Tejas Patel354fe572018-12-14 00:55:37 -080084/**
Tejas Patel41f3e0b2019-01-08 01:46:37 -080085 * Subsystem IDs
86 */
87typedef enum {
88 XPM_SUBSYSID_PMC,
89 XPM_SUBSYSID_PSM,
90 XPM_SUBSYSID_APU,
91 XPM_SUBSYSID_RPU0_LOCK,
92 XPM_SUBSYSID_RPU0_0,
93 XPM_SUBSYSID_RPU0_1,
94 XPM_SUBSYSID_DDR0,
95 XPM_SUBSYSID_ME,
96 XPM_SUBSYSID_PL,
97 XPM_SUBSYSID_MAX,
98} XPm_SubsystemId;
99
100/**
Tejas Patel354fe572018-12-14 00:55:37 -0800101 * @PM_RET_SUCCESS: success
102 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
103 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated)
104 * @PM_RET_ERROR_INTERNAL: internal error
105 * @PM_RET_ERROR_CONFLICT: conflict
106 * @PM_RET_ERROR_ACCESS: access rights violation
107 * @PM_RET_ERROR_INVALID_NODE: invalid node
108 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node
109 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted
110 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU
111 * @PM_RET_ERROR_NODE_USED: node is already in use
112 */
113enum pm_ret_status {
114 PM_RET_SUCCESS,
115 PM_RET_ERROR_ARGS = 1,
116 PM_RET_ERROR_NOTSUPPORTED = 4,
117 PM_RET_ERROR_INTERNAL = 2000,
118 PM_RET_ERROR_CONFLICT = 2001,
119 PM_RET_ERROR_ACCESS = 2002,
120 PM_RET_ERROR_INVALID_NODE = 2003,
121 PM_RET_ERROR_DOUBLE_REQ = 2004,
122 PM_RET_ERROR_ABORT_SUSPEND = 2005,
123 PM_RET_ERROR_TIMEOUT = 2006,
124 PM_RET_ERROR_NODE_USED = 2007
125};
126#endif /* PM_DEFS_H */