1 /* 2 * Copyright (c) 2019-2022, 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 /* 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 25 /* 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 32 #define PERIPH_DEVID(IDX) NODEID(XPM_NODECLASS_DEVICE, \ 33 XPM_NODESUBCL_DEV_PERIPH, \ 34 XPM_NODETYPE_DEV_PERIPH, (IDX)) 35 36 #define PM_GET_CALLBACK_DATA 0xa01U 37 #define PM_GET_TRUSTZONE_VERSION 0xa03U 38 #define TF_A_PM_REGISTER_SGI 0xa04U 39 40 /* PM API Versions */ 41 #define PM_API_BASE_VERSION 1U 42 #define PM_API_VERSION_2 2U 43 44 /* PM API ids */ 45 #define PM_REGISTER_NOTIFIER 5U 46 #define PM_REQ_SUSPEND 6U 47 #define PM_SELF_SUSPEND 7U 48 #define PM_FORCE_POWERDOWN 8U 49 #define PM_ABORT_SUSPEND 9U 50 #define PM_REQ_WAKEUP 10U 51 #define PM_SET_WAKEUP_SOURCE 11U 52 #define PM_SYSTEM_SHUTDOWN 12U 53 #define PM_IOCTL 34U 54 #define PM_QUERY_DATA 35U 55 #define PM_PLL_SET_PARAMETER 48U 56 #define PM_PLL_GET_PARAMETER 49U 57 #define PM_PLL_SET_MODE 50U 58 #define PM_PLL_GET_MODE 51U 59 #define PM_FEATURE_CHECK 63U 60 61 /* Loader API ids */ 62 #define PM_LOAD_PDI 0x701U 63 #define PM_LOAD_GET_HANDOFF_PARAMS 0x70BU 64 65 /* IOCTL IDs for clock driver */ 66 #define IOCTL_SET_PLL_FRAC_MODE 8U 67 #define IOCTL_GET_PLL_FRAC_MODE 9U 68 #define IOCTL_SET_PLL_FRAC_DATA 10U 69 #define IOCTL_GET_PLL_FRAC_DATA 11U 70 #define IOCTL_SET_SGI 25U 71 72 /* Parameter ID for PLL IOCTLs */ 73 /* Fractional data portion for PLL */ 74 #define PM_PLL_PARAM_DATA 2 75 76 /* System shutdown macros */ 77 #define XPM_SHUTDOWN_TYPE_SHUTDOWN 0U 78 #define XPM_SHUTDOWN_TYPE_RESET 1U 79 #define XPM_SHUTDOWN_TYPE_SETSCOPE_ONLY 2U 80 81 #define XPM_SHUTDOWN_SUBTYPE_RST_SUBSYSTEM 0U 82 #define XPM_SHUTDOWN_SUBTYPE_RST_PS_ONLY 1U 83 #define XPM_SHUTDOWN_SUBTYPE_RST_SYSTEM 2U 84 85 /********************************************************************* 86 * Enum definitions 87 ********************************************************************/ 88 89 enum pm_abort_reason { 90 ABORT_REASON_WKUP_EVENT = 100, 91 ABORT_REASON_PU_BUSY, 92 ABORT_REASON_NO_PWRDN, 93 ABORT_REASON_UNKNOWN, 94 }; 95 96 enum pm_opchar_type { 97 PM_OPCHAR_TYPE_POWER = 1, 98 PM_OPCHAR_TYPE_TEMP, 99 PM_OPCHAR_TYPE_LATENCY, 100 }; 101 102 /** 103 * Subsystem IDs 104 */ 105 typedef enum { 106 XPM_SUBSYSID_PMC, 107 XPM_SUBSYSID_PSM, 108 XPM_SUBSYSID_APU, 109 XPM_SUBSYSID_RPU0_LOCK, 110 XPM_SUBSYSID_RPU0_0, 111 XPM_SUBSYSID_RPU0_1, 112 XPM_SUBSYSID_DDR0, 113 XPM_SUBSYSID_ME, 114 XPM_SUBSYSID_PL, 115 XPM_SUBSYSID_MAX, 116 } XPm_SubsystemId; 117 118 /** 119 * @PM_RET_SUCCESS: success 120 * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated) 121 * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated) 122 * @PM_RET_ERROR_NOFEATURE: feature is not available 123 * @PM_RET_ERROR_INTERNAL: internal error 124 * @PM_RET_ERROR_CONFLICT: conflict 125 * @PM_RET_ERROR_ACCESS: access rights violation 126 * @PM_RET_ERROR_INVALID_NODE: invalid node 127 * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node 128 * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted 129 * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU 130 * @PM_RET_ERROR_NODE_USED: node is already in use 131 */ 132 enum pm_ret_status { 133 PM_RET_SUCCESS, 134 PM_RET_ERROR_ARGS = 1, 135 PM_RET_ERROR_NOTSUPPORTED = 4, 136 PM_RET_ERROR_NOFEATURE = 19, 137 PM_RET_ERROR_INTERNAL = 2000, 138 PM_RET_ERROR_CONFLICT = 2001, 139 PM_RET_ERROR_ACCESS = 2002, 140 PM_RET_ERROR_INVALID_NODE = 2003, 141 PM_RET_ERROR_DOUBLE_REQ = 2004, 142 PM_RET_ERROR_ABORT_SUSPEND = 2005, 143 PM_RET_ERROR_TIMEOUT = 2006, 144 PM_RET_ERROR_NODE_USED = 2007 145 }; 146 147 /** 148 * Qids 149 */ 150 enum pm_query_id { 151 XPM_QID_INVALID, 152 XPM_QID_CLOCK_GET_NAME, 153 XPM_QID_CLOCK_GET_TOPOLOGY, 154 XPM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS, 155 XPM_QID_CLOCK_GET_MUXSOURCES, 156 XPM_QID_CLOCK_GET_ATTRIBUTES, 157 XPM_QID_PINCTRL_GET_NUM_PINS, 158 XPM_QID_PINCTRL_GET_NUM_FUNCTIONS, 159 XPM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS, 160 XPM_QID_PINCTRL_GET_FUNCTION_NAME, 161 XPM_QID_PINCTRL_GET_FUNCTION_GROUPS, 162 XPM_QID_PINCTRL_GET_PIN_GROUPS, 163 XPM_QID_CLOCK_GET_NUM_CLOCKS, 164 XPM_QID_CLOCK_GET_MAX_DIVISOR, 165 XPM_QID_PLD_GET_PARENT, 166 }; 167 #endif /* PM_DEFS_H */ 168