blob: fa35066070f1bbda9ea2d33f90ae7c178f5d9cb2 [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 Patel6b282252019-01-10 03:03:47 -080032#define PM_SYSTEM_SHUTDOWN 12U
Tejas Patel41f3e0b2019-01-08 01:46:37 -080033#define PM_REQUEST_DEVICE 13U
34#define PM_RELEASE_DEVICE 14U
35#define PM_SET_REQUIREMENT 15U
Tejas Patel87c4f3a2019-01-08 01:46:38 -080036#define PM_RESET_ASSERT 17U
37#define PM_RESET_GET_STATUS 18U
Tejas Patel20e92022019-01-08 01:46:39 -080038#define PM_PINCTRL_REQUEST 28U
39#define PM_PINCTRL_RELEASE 29U
40#define PM_PINCTRL_GET_FUNCTION 30U
41#define PM_PINCTRL_SET_FUNCTION 31U
42#define PM_PINCTRL_CONFIG_PARAM_GET 32U
43#define PM_PINCTRL_CONFIG_PARAM_SET 33U
Tejas Patel9141f442019-01-10 03:03:48 -080044#define PM_IOCTL 34U
Tejas Patel1f56fb12019-01-08 01:46:40 -080045#define PM_CLOCK_ENABLE 36U
46#define PM_CLOCK_DISABLE 37U
47#define PM_CLOCK_GETSTATE 38U
48#define PM_CLOCK_SETDIVIDER 39U
49#define PM_CLOCK_GETDIVIDER 40U
50#define PM_CLOCK_SETRATE 41U
51#define PM_CLOCK_GETRATE 42U
52#define PM_CLOCK_SETPARENT 43U
53#define PM_CLOCK_GETPARENT 44U
Tejas Patel023116d2019-01-08 01:46:41 -080054#define PM_PLL_SET_PARAMETER 48U
55#define PM_PLL_GET_PARAMETER 49U
56#define PM_PLL_SET_MODE 50U
57#define PM_PLL_GET_MODE 51U
Tejas Patel9d09ff92019-01-08 01:46:35 -080058
Tejas Patel9141f442019-01-10 03:03:48 -080059/* IOCTL IDs for clock driver */
60#define IOCTL_SET_PLL_FRAC_MODE 8
61#define IOCTL_GET_PLL_FRAC_MODE 9
62#define IOCTL_SET_PLL_FRAC_DATA 10
63#define IOCTL_GET_PLL_FRAC_DATA 11
64
65/* Parameter ID for PLL IOCTLs */
66/* Fractional data portion for PLL */
67#define PM_PLL_PARAM_DATA 2
68
Tejas Patel354fe572018-12-14 00:55:37 -080069/*********************************************************************
70 * Enum definitions
71 ********************************************************************/
72
Tejas Patelfe0e10a2019-12-08 23:29:44 -080073enum pm_abort_reason {
74 ABORT_REASON_WKUP_EVENT = 100,
75 ABORT_REASON_PU_BUSY,
76 ABORT_REASON_NO_PWRDN,
77 ABORT_REASON_UNKNOWN,
78};
79
Tejas Patel354fe572018-12-14 00:55:37 -080080/**
Tejas Patel41f3e0b2019-01-08 01:46:37 -080081 * Subsystem IDs
82 */
83typedef enum {
84 XPM_SUBSYSID_PMC,
85 XPM_SUBSYSID_PSM,
86 XPM_SUBSYSID_APU,
87 XPM_SUBSYSID_RPU0_LOCK,
88 XPM_SUBSYSID_RPU0_0,
89 XPM_SUBSYSID_RPU0_1,
90 XPM_SUBSYSID_DDR0,
91 XPM_SUBSYSID_ME,
92 XPM_SUBSYSID_PL,
93 XPM_SUBSYSID_MAX,
94} XPm_SubsystemId;
95
96/**
Tejas Patel354fe572018-12-14 00:55:37 -080097 * @PM_RET_SUCCESS: success
98 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
99 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated)
100 * @PM_RET_ERROR_INTERNAL: internal error
101 * @PM_RET_ERROR_CONFLICT: conflict
102 * @PM_RET_ERROR_ACCESS: access rights violation
103 * @PM_RET_ERROR_INVALID_NODE: invalid node
104 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node
105 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted
106 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU
107 * @PM_RET_ERROR_NODE_USED: node is already in use
108 */
109enum pm_ret_status {
110 PM_RET_SUCCESS,
111 PM_RET_ERROR_ARGS = 1,
112 PM_RET_ERROR_NOTSUPPORTED = 4,
113 PM_RET_ERROR_INTERNAL = 2000,
114 PM_RET_ERROR_CONFLICT = 2001,
115 PM_RET_ERROR_ACCESS = 2002,
116 PM_RET_ERROR_INVALID_NODE = 2003,
117 PM_RET_ERROR_DOUBLE_REQ = 2004,
118 PM_RET_ERROR_ABORT_SUSPEND = 2005,
119 PM_RET_ERROR_TIMEOUT = 2006,
120 PM_RET_ERROR_NODE_USED = 2007
121};
122#endif /* PM_DEFS_H */