Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * |
| 7 | * Redistributions of source code must retain the above copyright notice, this |
| 8 | * list of conditions and the following disclaimer. |
| 9 | * |
| 10 | * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * Neither the name of ARM nor the names of its contributors may be used |
| 15 | * to endorse or promote products derived from this software without specific |
| 16 | * prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | /* ZynqMP power management enums and defines */ |
| 32 | |
| 33 | #ifndef _PM_DEFS_H_ |
| 34 | #define _PM_DEFS_H_ |
| 35 | |
| 36 | /********************************************************************* |
| 37 | * Macro definitions |
| 38 | ********************************************************************/ |
| 39 | |
| 40 | /* |
| 41 | * Version number is a 32bit value, like: |
| 42 | * (PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR |
| 43 | */ |
| 44 | #define PM_VERSION_MAJOR 0 |
| 45 | #define PM_VERSION_MINOR 2 |
| 46 | |
| 47 | #define PM_VERSION ((PM_VERSION_MAJOR << 16) | PM_VERSION_MINOR) |
| 48 | |
| 49 | /* Capabilities for RAM */ |
| 50 | #define PM_CAP_ACCESS 0x1U |
| 51 | #define PM_CAP_CONTEXT 0x2U |
| 52 | |
| 53 | #define MAX_LATENCY (~0U) |
| 54 | #define MAX_QOS 100U |
| 55 | |
Filip Drazic | 0bd9d0c | 2016-07-20 17:17:39 +0200 | [diff] [blame] | 56 | /* State arguments of the self suspend */ |
| 57 | #define PM_STATE_CPU_IDLE 0x0U |
| 58 | #define PM_STATE_SUSPEND_TO_RAM 0xFU |
| 59 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 60 | /********************************************************************* |
| 61 | * Enum definitions |
| 62 | ********************************************************************/ |
| 63 | |
| 64 | enum pm_api_id { |
| 65 | /* Miscellaneous API functions: */ |
| 66 | PM_GET_API_VERSION = 1, /* Do not change or move */ |
| 67 | PM_SET_CONFIGURATION, |
| 68 | PM_GET_NODE_STATUS, |
| 69 | PM_GET_OP_CHARACTERISTIC, |
| 70 | PM_REGISTER_NOTIFIER, |
| 71 | /* API for suspending of PUs: */ |
| 72 | PM_REQ_SUSPEND, |
| 73 | PM_SELF_SUSPEND, |
| 74 | PM_FORCE_POWERDOWN, |
| 75 | PM_ABORT_SUSPEND, |
| 76 | PM_REQ_WAKEUP, |
| 77 | PM_SET_WAKEUP_SOURCE, |
| 78 | PM_SYSTEM_SHUTDOWN, |
| 79 | /* API for managing PM slaves: */ |
| 80 | PM_REQ_NODE, |
| 81 | PM_RELEASE_NODE, |
| 82 | PM_SET_REQUIREMENT, |
| 83 | PM_SET_MAX_LATENCY, |
| 84 | /* Direct control API functions: */ |
| 85 | PM_RESET_ASSERT, |
| 86 | PM_RESET_GET_STATUS, |
| 87 | PM_MMIO_WRITE, |
| 88 | PM_MMIO_READ, |
Nava kishore Manne | 33d3927 | 2016-08-20 23:11:11 +0530 | [diff] [blame] | 89 | PM_INIT, |
Nava kishore Manne | 68d460c | 2016-08-20 23:18:09 +0530 | [diff] [blame] | 90 | PM_FPGA_LOAD, |
| 91 | PM_FPGA_GET_STATUS, |
Siva Durga Prasad Paladugu | 16427d1 | 2016-08-24 11:45:47 +0530 | [diff] [blame] | 92 | PM_GET_CHIPID, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 93 | PM_API_MAX |
| 94 | }; |
| 95 | |
| 96 | enum pm_node_id { |
| 97 | NODE_UNKNOWN = 0, |
| 98 | NODE_APU, |
| 99 | NODE_APU_0, |
| 100 | NODE_APU_1, |
| 101 | NODE_APU_2, |
| 102 | NODE_APU_3, |
| 103 | NODE_RPU, |
| 104 | NODE_RPU_0, |
| 105 | NODE_RPU_1, |
| 106 | NODE_PL, |
| 107 | NODE_FPD, |
| 108 | NODE_OCM_BANK_0, |
| 109 | NODE_OCM_BANK_1, |
| 110 | NODE_OCM_BANK_2, |
| 111 | NODE_OCM_BANK_3, |
| 112 | NODE_TCM_0_A, |
| 113 | NODE_TCM_0_B, |
| 114 | NODE_TCM_1_A, |
| 115 | NODE_TCM_1_B, |
| 116 | NODE_L2, |
| 117 | NODE_GPU_PP_0, |
| 118 | NODE_GPU_PP_1, |
| 119 | NODE_USB_0, |
| 120 | NODE_USB_1, |
| 121 | NODE_TTC_0, |
| 122 | NODE_TTC_1, |
| 123 | NODE_TTC_2, |
| 124 | NODE_TTC_3, |
| 125 | NODE_SATA, |
| 126 | NODE_ETH_0, |
| 127 | NODE_ETH_1, |
| 128 | NODE_ETH_2, |
| 129 | NODE_ETH_3, |
| 130 | NODE_UART_0, |
| 131 | NODE_UART_1, |
| 132 | NODE_SPI_0, |
| 133 | NODE_SPI_1, |
| 134 | NODE_I2C_0, |
| 135 | NODE_I2C_1, |
| 136 | NODE_SD_0, |
| 137 | NODE_SD_1, |
| 138 | NODE_DP, |
| 139 | NODE_GDMA, |
| 140 | NODE_ADMA, |
| 141 | NODE_NAND, |
| 142 | NODE_QSPI, |
| 143 | NODE_GPIO, |
| 144 | NODE_CAN_0, |
| 145 | NODE_CAN_1, |
| 146 | NODE_AFI, |
| 147 | NODE_APLL, |
| 148 | NODE_VPLL, |
| 149 | NODE_DPLL, |
| 150 | NODE_RPLL, |
| 151 | NODE_IOPLL, |
| 152 | NODE_DDR, |
Mirela Simonovic | 0ff06ce | 2016-06-07 18:15:40 +0200 | [diff] [blame] | 153 | NODE_IPI_APU, |
Mirela Simonovic | 9b984be | 2016-06-17 16:17:23 +0200 | [diff] [blame] | 154 | NODE_IPI_RPU_0, |
Filip Drazic | 35e99e2 | 2016-07-26 12:07:05 +0200 | [diff] [blame] | 155 | NODE_GPU, |
| 156 | NODE_PCIE, |
| 157 | NODE_PCAP, |
| 158 | NODE_RTC, |
Filip Drazic | 4c0765a | 2016-07-26 12:11:33 +0200 | [diff] [blame] | 159 | NODE_MAX |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | enum pm_request_ack { |
| 163 | REQ_ACK_NO = 1, |
| 164 | REQ_ACK_BLOCKING, |
| 165 | REQ_ACK_NON_BLOCKING, |
| 166 | }; |
| 167 | |
| 168 | enum pm_abort_reason { |
| 169 | ABORT_REASON_WKUP_EVENT = 100, |
| 170 | ABORT_REASON_PU_BUSY, |
| 171 | ABORT_REASON_NO_PWRDN, |
| 172 | ABORT_REASON_UNKNOWN, |
| 173 | }; |
| 174 | |
| 175 | enum pm_suspend_reason { |
| 176 | SUSPEND_REASON_PU_REQ = 201, |
| 177 | SUSPEND_REASON_ALERT, |
| 178 | SUSPEND_REASON_SYS_SHUTDOWN, |
| 179 | }; |
| 180 | |
| 181 | enum pm_ram_state { |
| 182 | PM_RAM_STATE_OFF = 1, |
| 183 | PM_RAM_STATE_RETENTION, |
| 184 | PM_RAM_STATE_ON, |
| 185 | }; |
| 186 | |
| 187 | enum pm_opchar_type { |
| 188 | PM_OPCHAR_TYPE_POWER = 1, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 189 | PM_OPCHAR_TYPE_TEMP, |
Anes Hadziahmetagic | 92aee01 | 2016-05-12 16:17:30 +0200 | [diff] [blame] | 190 | PM_OPCHAR_TYPE_LATENCY, |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | /** |
| 194 | * @PM_RET_SUCCESS: success |
| 195 | * @PM_RET_ERROR_ARGS: illegal arguments provided |
| 196 | * @PM_RET_ERROR_ACCESS: access rights violation |
| 197 | * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU |
| 198 | * @PM_RET_ERROR_NOTSUPPORTED: feature not supported |
| 199 | * @PM_RET_ERROR_PROC: node is not a processor node |
| 200 | * @PM_RET_ERROR_API_ID: illegal API ID |
| 201 | * @PM_RET_ERROR_OTHER: other error |
| 202 | */ |
| 203 | enum pm_ret_status { |
| 204 | PM_RET_SUCCESS, |
| 205 | PM_RET_ERROR_ARGS, |
| 206 | PM_RET_ERROR_ACCESS, |
| 207 | PM_RET_ERROR_TIMEOUT, |
| 208 | PM_RET_ERROR_NOTSUPPORTED, |
| 209 | PM_RET_ERROR_PROC, |
| 210 | PM_RET_ERROR_API_ID, |
| 211 | PM_RET_ERROR_FAILURE, |
| 212 | PM_RET_ERROR_COMMUNIC, |
| 213 | PM_RET_ERROR_DOUBLEREQ, |
| 214 | PM_RET_ERROR_OTHER, |
| 215 | }; |
| 216 | |
| 217 | /** |
| 218 | * @PM_INITIAL_BOOT: boot is a fresh system startup |
| 219 | * @PM_RESUME: boot is a resume |
| 220 | * @PM_BOOT_ERROR: error, boot cause cannot be identified |
| 221 | */ |
| 222 | enum pm_boot_status { |
| 223 | PM_INITIAL_BOOT, |
| 224 | PM_RESUME, |
| 225 | PM_BOOT_ERROR, |
| 226 | }; |
| 227 | |
Soren Brinkmann | 58fbb9b | 2016-09-02 09:50:54 -0700 | [diff] [blame] | 228 | enum pm_shutdown_type { |
| 229 | PMF_SHUTDOWN_TYPE_SHUTDOWN, |
| 230 | PMF_SHUTDOWN_TYPE_RESET, |
| 231 | }; |
| 232 | |
| 233 | enum pm_shutdown_subtype { |
| 234 | PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM, |
| 235 | PMF_SHUTDOWN_SUBTYPE_PS_ONLY, |
| 236 | PMF_SHUTDOWN_SUBTYPE_SYSTEM, |
| 237 | }; |
| 238 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 239 | #endif /* _PM_DEFS_H_ */ |