Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /* ZynqMP power management enums and defines */ |
| 8 | |
| 9 | #ifndef _PM_DEFS_H_ |
| 10 | #define _PM_DEFS_H_ |
| 11 | |
| 12 | /********************************************************************* |
| 13 | * Macro definitions |
| 14 | ********************************************************************/ |
| 15 | |
| 16 | /* |
| 17 | * Version number is a 32bit value, like: |
| 18 | * (PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR |
| 19 | */ |
Jolly Shah | abee2a4 | 2018-02-07 15:37:01 -0800 | [diff] [blame] | 20 | #define PM_VERSION_MAJOR 1 |
| 21 | #define PM_VERSION_MINOR 0 |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 22 | |
| 23 | #define PM_VERSION ((PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR) |
| 24 | |
| 25 | /* Capabilities for RAM */ |
| 26 | #define PM_CAP_ACCESS 0x1U |
| 27 | #define PM_CAP_CONTEXT 0x2U |
| 28 | |
| 29 | #define MAX_LATENCY (~0U) |
| 30 | #define MAX_QOS 100U |
| 31 | |
Filip Drazic | 0bd9d0c | 2016-07-20 17:17:39 +0200 | [diff] [blame] | 32 | /* State arguments of the self suspend */ |
| 33 | #define PM_STATE_CPU_IDLE 0x0U |
| 34 | #define PM_STATE_SUSPEND_TO_RAM 0xFU |
| 35 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 36 | /********************************************************************* |
| 37 | * Enum definitions |
| 38 | ********************************************************************/ |
| 39 | |
| 40 | enum pm_api_id { |
| 41 | /* Miscellaneous API functions: */ |
| 42 | PM_GET_API_VERSION = 1, /* Do not change or move */ |
| 43 | PM_SET_CONFIGURATION, |
| 44 | PM_GET_NODE_STATUS, |
| 45 | PM_GET_OP_CHARACTERISTIC, |
| 46 | PM_REGISTER_NOTIFIER, |
| 47 | /* API for suspending of PUs: */ |
| 48 | PM_REQ_SUSPEND, |
| 49 | PM_SELF_SUSPEND, |
| 50 | PM_FORCE_POWERDOWN, |
| 51 | PM_ABORT_SUSPEND, |
| 52 | PM_REQ_WAKEUP, |
| 53 | PM_SET_WAKEUP_SOURCE, |
| 54 | PM_SYSTEM_SHUTDOWN, |
| 55 | /* API for managing PM slaves: */ |
| 56 | PM_REQ_NODE, |
| 57 | PM_RELEASE_NODE, |
| 58 | PM_SET_REQUIREMENT, |
| 59 | PM_SET_MAX_LATENCY, |
| 60 | /* Direct control API functions: */ |
| 61 | PM_RESET_ASSERT, |
| 62 | PM_RESET_GET_STATUS, |
| 63 | PM_MMIO_WRITE, |
| 64 | PM_MMIO_READ, |
Filip Drazic | ca1e0af | 2017-03-16 16:56:53 +0100 | [diff] [blame] | 65 | PM_INIT_FINALIZE, |
Nava kishore Manne | 68d460c | 2016-08-20 23:18:09 +0530 | [diff] [blame] | 66 | PM_FPGA_LOAD, |
| 67 | PM_FPGA_GET_STATUS, |
Siva Durga Prasad Paladugu | 16427d1 | 2016-08-24 11:45:47 +0530 | [diff] [blame] | 68 | PM_GET_CHIPID, |
Rajan Vaja | 670bec0 | 2018-01-18 22:54:07 -0800 | [diff] [blame] | 69 | PM_SECURE_RSA_AES, |
| 70 | PM_SECURE_SHA, |
| 71 | PM_SECURE_RSA, |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 72 | PM_PINCTRL_REQUEST, |
| 73 | PM_PINCTRL_RELEASE, |
| 74 | PM_PINCTRL_GET_FUNCTION, |
| 75 | PM_PINCTRL_SET_FUNCTION, |
| 76 | PM_PINCTRL_CONFIG_PARAM_GET, |
| 77 | PM_PINCTRL_CONFIG_PARAM_SET, |
Rajan Vaja | 5529a01 | 2018-01-17 02:39:23 -0800 | [diff] [blame] | 78 | PM_IOCTL, |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 79 | /* API to query information from firmware */ |
| 80 | PM_QUERY_DATA, |
| 81 | /* Clock control API functions */ |
| 82 | PM_CLOCK_ENABLE, |
| 83 | PM_CLOCK_DISABLE, |
| 84 | PM_CLOCK_GETSTATE, |
| 85 | PM_CLOCK_SETDIVIDER, |
| 86 | PM_CLOCK_GETDIVIDER, |
| 87 | PM_CLOCK_SETRATE, |
| 88 | PM_CLOCK_GETRATE, |
| 89 | PM_CLOCK_SETPARENT, |
| 90 | PM_CLOCK_GETPARENT, |
Siva Durga Prasad Paladugu | a4ed4b2 | 2018-04-30 20:06:58 +0530 | [diff] [blame] | 91 | PM_SECURE_IMAGE, |
Siva Durga Prasad Paladugu | 7c6516a | 2018-09-04 17:41:34 +0530 | [diff] [blame] | 92 | /* FPGA PL Readback */ |
| 93 | PM_FPGA_READ, |
Siva Durga Prasad Paladugu | 8bd905b | 2018-09-04 18:05:50 +0530 | [diff] [blame] | 94 | PM_SECURE_AES, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 95 | PM_API_MAX |
| 96 | }; |
| 97 | |
| 98 | enum pm_node_id { |
| 99 | NODE_UNKNOWN = 0, |
| 100 | NODE_APU, |
| 101 | NODE_APU_0, |
| 102 | NODE_APU_1, |
| 103 | NODE_APU_2, |
| 104 | NODE_APU_3, |
| 105 | NODE_RPU, |
| 106 | NODE_RPU_0, |
| 107 | NODE_RPU_1, |
Rajan Vaja | 670bec0 | 2018-01-18 22:54:07 -0800 | [diff] [blame] | 108 | NODE_PLD, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 109 | NODE_FPD, |
| 110 | NODE_OCM_BANK_0, |
| 111 | NODE_OCM_BANK_1, |
| 112 | NODE_OCM_BANK_2, |
| 113 | NODE_OCM_BANK_3, |
| 114 | NODE_TCM_0_A, |
| 115 | NODE_TCM_0_B, |
| 116 | NODE_TCM_1_A, |
| 117 | NODE_TCM_1_B, |
| 118 | NODE_L2, |
| 119 | NODE_GPU_PP_0, |
| 120 | NODE_GPU_PP_1, |
| 121 | NODE_USB_0, |
| 122 | NODE_USB_1, |
| 123 | NODE_TTC_0, |
| 124 | NODE_TTC_1, |
| 125 | NODE_TTC_2, |
| 126 | NODE_TTC_3, |
| 127 | NODE_SATA, |
| 128 | NODE_ETH_0, |
| 129 | NODE_ETH_1, |
| 130 | NODE_ETH_2, |
| 131 | NODE_ETH_3, |
| 132 | NODE_UART_0, |
| 133 | NODE_UART_1, |
| 134 | NODE_SPI_0, |
| 135 | NODE_SPI_1, |
| 136 | NODE_I2C_0, |
| 137 | NODE_I2C_1, |
| 138 | NODE_SD_0, |
| 139 | NODE_SD_1, |
| 140 | NODE_DP, |
| 141 | NODE_GDMA, |
| 142 | NODE_ADMA, |
| 143 | NODE_NAND, |
| 144 | NODE_QSPI, |
| 145 | NODE_GPIO, |
| 146 | NODE_CAN_0, |
| 147 | NODE_CAN_1, |
Mirela Simonovic | cd16582 | 2017-01-30 17:44:00 +0100 | [diff] [blame] | 148 | NODE_EXTERN, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 149 | NODE_APLL, |
| 150 | NODE_VPLL, |
| 151 | NODE_DPLL, |
| 152 | NODE_RPLL, |
| 153 | NODE_IOPLL, |
| 154 | NODE_DDR, |
Mirela Simonovic | 0ff06ce | 2016-06-07 18:15:40 +0200 | [diff] [blame] | 155 | NODE_IPI_APU, |
Mirela Simonovic | 9b984be | 2016-06-17 16:17:23 +0200 | [diff] [blame] | 156 | NODE_IPI_RPU_0, |
Filip Drazic | 35e99e2 | 2016-07-26 12:07:05 +0200 | [diff] [blame] | 157 | NODE_GPU, |
| 158 | NODE_PCIE, |
| 159 | NODE_PCAP, |
| 160 | NODE_RTC, |
Rajan Vaja | 670bec0 | 2018-01-18 22:54:07 -0800 | [diff] [blame] | 161 | NODE_LPD, |
| 162 | NODE_VCU, |
| 163 | NODE_IPI_RPU_1, |
| 164 | NODE_IPI_PL_0, |
| 165 | NODE_IPI_PL_1, |
| 166 | NODE_IPI_PL_2, |
| 167 | NODE_IPI_PL_3, |
| 168 | NODE_PL, |
Rajan Vaja | 0ac2be1 | 2018-01-17 02:39:21 -0800 | [diff] [blame] | 169 | NODE_GEM_TSU, |
| 170 | NODE_SWDT_0, |
| 171 | NODE_SWDT_1, |
| 172 | NODE_CSU, |
| 173 | NODE_PJTAG, |
| 174 | NODE_TRACE, |
| 175 | NODE_TESTSCAN, |
| 176 | NODE_PMU, |
| 177 | NODE_MAX, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | enum pm_request_ack { |
| 181 | REQ_ACK_NO = 1, |
| 182 | REQ_ACK_BLOCKING, |
| 183 | REQ_ACK_NON_BLOCKING, |
| 184 | }; |
| 185 | |
| 186 | enum pm_abort_reason { |
| 187 | ABORT_REASON_WKUP_EVENT = 100, |
| 188 | ABORT_REASON_PU_BUSY, |
| 189 | ABORT_REASON_NO_PWRDN, |
| 190 | ABORT_REASON_UNKNOWN, |
| 191 | }; |
| 192 | |
| 193 | enum pm_suspend_reason { |
| 194 | SUSPEND_REASON_PU_REQ = 201, |
| 195 | SUSPEND_REASON_ALERT, |
| 196 | SUSPEND_REASON_SYS_SHUTDOWN, |
| 197 | }; |
| 198 | |
| 199 | enum pm_ram_state { |
| 200 | PM_RAM_STATE_OFF = 1, |
| 201 | PM_RAM_STATE_RETENTION, |
| 202 | PM_RAM_STATE_ON, |
| 203 | }; |
| 204 | |
| 205 | enum pm_opchar_type { |
| 206 | PM_OPCHAR_TYPE_POWER = 1, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 207 | PM_OPCHAR_TYPE_TEMP, |
Anes Hadziahmetagic | 92aee01 | 2016-05-12 16:17:30 +0200 | [diff] [blame] | 208 | PM_OPCHAR_TYPE_LATENCY, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 209 | }; |
| 210 | |
| 211 | /** |
| 212 | * @PM_RET_SUCCESS: success |
| 213 | * @PM_RET_ERROR_ARGS: illegal arguments provided |
| 214 | * @PM_RET_ERROR_ACCESS: access rights violation |
| 215 | * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU |
| 216 | * @PM_RET_ERROR_NOTSUPPORTED: feature not supported |
| 217 | * @PM_RET_ERROR_PROC: node is not a processor node |
| 218 | * @PM_RET_ERROR_API_ID: illegal API ID |
| 219 | * @PM_RET_ERROR_OTHER: other error |
| 220 | */ |
| 221 | enum pm_ret_status { |
| 222 | PM_RET_SUCCESS, |
| 223 | PM_RET_ERROR_ARGS, |
| 224 | PM_RET_ERROR_ACCESS, |
| 225 | PM_RET_ERROR_TIMEOUT, |
| 226 | PM_RET_ERROR_NOTSUPPORTED, |
| 227 | PM_RET_ERROR_PROC, |
| 228 | PM_RET_ERROR_API_ID, |
| 229 | PM_RET_ERROR_FAILURE, |
| 230 | PM_RET_ERROR_COMMUNIC, |
| 231 | PM_RET_ERROR_DOUBLEREQ, |
| 232 | PM_RET_ERROR_OTHER, |
| 233 | }; |
| 234 | |
| 235 | /** |
| 236 | * @PM_INITIAL_BOOT: boot is a fresh system startup |
| 237 | * @PM_RESUME: boot is a resume |
| 238 | * @PM_BOOT_ERROR: error, boot cause cannot be identified |
| 239 | */ |
| 240 | enum pm_boot_status { |
| 241 | PM_INITIAL_BOOT, |
| 242 | PM_RESUME, |
| 243 | PM_BOOT_ERROR, |
| 244 | }; |
| 245 | |
Siva Durga Prasad Paladugu | 1f80d3f | 2018-04-30 15:56:10 +0530 | [diff] [blame] | 246 | /** |
| 247 | * @PMF_SHUTDOWN_TYPE_SHUTDOWN: shutdown |
| 248 | * @PMF_SHUTDOWN_TYPE_RESET: reset/reboot |
| 249 | * @PMF_SHUTDOWN_TYPE_SETSCOPE_ONLY: set the shutdown/reboot scope |
| 250 | */ |
Soren Brinkmann | 58fbb9b | 2016-09-02 09:50:54 -0700 | [diff] [blame] | 251 | enum pm_shutdown_type { |
| 252 | PMF_SHUTDOWN_TYPE_SHUTDOWN, |
| 253 | PMF_SHUTDOWN_TYPE_RESET, |
Siva Durga Prasad Paladugu | 1f80d3f | 2018-04-30 15:56:10 +0530 | [diff] [blame] | 254 | PMF_SHUTDOWN_TYPE_SETSCOPE_ONLY, |
Soren Brinkmann | 58fbb9b | 2016-09-02 09:50:54 -0700 | [diff] [blame] | 255 | }; |
| 256 | |
Siva Durga Prasad Paladugu | 1f80d3f | 2018-04-30 15:56:10 +0530 | [diff] [blame] | 257 | /** |
| 258 | * @PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM: shutdown/reboot APU subsystem only |
| 259 | * @PMF_SHUTDOWN_SUBTYPE_PS_ONLY: shutdown/reboot entire PS (but not PL) |
| 260 | * @PMF_SHUTDOWN_SUBTYPE_SYSTEM: shutdown/reboot entire system |
| 261 | */ |
Soren Brinkmann | 58fbb9b | 2016-09-02 09:50:54 -0700 | [diff] [blame] | 262 | enum pm_shutdown_subtype { |
| 263 | PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM, |
| 264 | PMF_SHUTDOWN_SUBTYPE_PS_ONLY, |
| 265 | PMF_SHUTDOWN_SUBTYPE_SYSTEM, |
| 266 | }; |
| 267 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 268 | #endif /* _PM_DEFS_H_ */ |