blob: f090db5385ebb8cabd8f2212ba1430b6de3d8329 [file] [log] [blame]
Tejas Patelc73a90e2018-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 Patel5a8ffea2019-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 Patelc73a90e2018-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 Patel95794c72019-01-08 01:46:35 -080032/* PM API ids */
33#define PM_GET_API_VERSION 1U
Tejas Patelcf1e56a2019-01-08 01:46:37 -080034#define PM_GET_DEVICE_STATUS 3U
Tejas Patelfbb32692019-12-08 23:29:44 -080035#define PM_REQ_SUSPEND 6U
36#define PM_SELF_SUSPEND 7U
Tejas Patelffecfe72019-01-10 03:03:47 -080037#define PM_FORCE_POWERDOWN 8U
Tejas Patelfbb32692019-12-08 23:29:44 -080038#define PM_ABORT_SUSPEND 9U
Tejas Patelc56be552019-01-23 14:18:51 +053039#define PM_REQ_WAKEUP 10U
Tejas Patel42cd77e2019-01-23 14:18:53 +053040#define PM_SET_WAKEUP_SOURCE 11U
Tejas Patelffecfe72019-01-10 03:03:47 -080041#define PM_SYSTEM_SHUTDOWN 12U
Tejas Patelcf1e56a2019-01-08 01:46:37 -080042#define PM_REQUEST_DEVICE 13U
43#define PM_RELEASE_DEVICE 14U
44#define PM_SET_REQUIREMENT 15U
Tejas Patel9c3c5e02019-01-08 01:46:38 -080045#define PM_RESET_ASSERT 17U
46#define PM_RESET_GET_STATUS 18U
Tejas Patelad199112019-01-21 17:56:49 +053047#define PM_INIT_FINALIZE 21U
Tejas Patel0ed83c62019-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 Pateld62fa4b2019-01-10 03:03:48 -080054#define PM_IOCTL 34U
Tejas Patel1f71e4f2019-02-01 17:25:19 +053055#define PM_QUERY_DATA 35U
Tejas Patel2394b942019-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 Patelbaccc602019-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 Patel95794c72019-01-08 01:46:35 -080069
Tejas Pateld62fa4b2019-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 Patelc73a90e2018-12-14 00:55:37 -080080/*********************************************************************
81 * Enum definitions
82 ********************************************************************/
83
Tejas Patelfbb32692019-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 Patelc73a90e2018-12-14 00:55:37 -080091/**
Tejas Patelcf1e56a2019-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 Patelc73a90e2018-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 */