Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 1 | /* |
| 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 Patel | 9d09ff9 | 2019-01-08 01:46:35 -0800 | [diff] [blame] | 25 | /* PM API ids */ |
| 26 | #define PM_GET_API_VERSION 1U |
Tejas Patel | 41f3e0b | 2019-01-08 01:46:37 -0800 | [diff] [blame] | 27 | #define PM_GET_DEVICE_STATUS 3U |
Tejas Patel | fe0e10a | 2019-12-08 23:29:44 -0800 | [diff] [blame] | 28 | #define PM_REQ_SUSPEND 6U |
| 29 | #define PM_SELF_SUSPEND 7U |
| 30 | #define PM_ABORT_SUSPEND 9U |
Tejas Patel | 41f3e0b | 2019-01-08 01:46:37 -0800 | [diff] [blame] | 31 | #define PM_REQUEST_DEVICE 13U |
| 32 | #define PM_RELEASE_DEVICE 14U |
| 33 | #define PM_SET_REQUIREMENT 15U |
Tejas Patel | 87c4f3a | 2019-01-08 01:46:38 -0800 | [diff] [blame] | 34 | #define PM_RESET_ASSERT 17U |
| 35 | #define PM_RESET_GET_STATUS 18U |
Tejas Patel | 20e9202 | 2019-01-08 01:46:39 -0800 | [diff] [blame] | 36 | #define PM_PINCTRL_REQUEST 28U |
| 37 | #define PM_PINCTRL_RELEASE 29U |
| 38 | #define PM_PINCTRL_GET_FUNCTION 30U |
| 39 | #define PM_PINCTRL_SET_FUNCTION 31U |
| 40 | #define PM_PINCTRL_CONFIG_PARAM_GET 32U |
| 41 | #define PM_PINCTRL_CONFIG_PARAM_SET 33U |
Tejas Patel | 1f56fb1 | 2019-01-08 01:46:40 -0800 | [diff] [blame] | 42 | #define PM_CLOCK_ENABLE 36U |
| 43 | #define PM_CLOCK_DISABLE 37U |
| 44 | #define PM_CLOCK_GETSTATE 38U |
| 45 | #define PM_CLOCK_SETDIVIDER 39U |
| 46 | #define PM_CLOCK_GETDIVIDER 40U |
| 47 | #define PM_CLOCK_SETRATE 41U |
| 48 | #define PM_CLOCK_GETRATE 42U |
| 49 | #define PM_CLOCK_SETPARENT 43U |
| 50 | #define PM_CLOCK_GETPARENT 44U |
Tejas Patel | 023116d | 2019-01-08 01:46:41 -0800 | [diff] [blame] | 51 | #define PM_PLL_SET_PARAMETER 48U |
| 52 | #define PM_PLL_GET_PARAMETER 49U |
| 53 | #define PM_PLL_SET_MODE 50U |
| 54 | #define PM_PLL_GET_MODE 51U |
Tejas Patel | 9d09ff9 | 2019-01-08 01:46:35 -0800 | [diff] [blame] | 55 | |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 56 | /********************************************************************* |
| 57 | * Enum definitions |
| 58 | ********************************************************************/ |
| 59 | |
Tejas Patel | fe0e10a | 2019-12-08 23:29:44 -0800 | [diff] [blame] | 60 | enum pm_abort_reason { |
| 61 | ABORT_REASON_WKUP_EVENT = 100, |
| 62 | ABORT_REASON_PU_BUSY, |
| 63 | ABORT_REASON_NO_PWRDN, |
| 64 | ABORT_REASON_UNKNOWN, |
| 65 | }; |
| 66 | |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 67 | /** |
Tejas Patel | 41f3e0b | 2019-01-08 01:46:37 -0800 | [diff] [blame] | 68 | * Subsystem IDs |
| 69 | */ |
| 70 | typedef enum { |
| 71 | XPM_SUBSYSID_PMC, |
| 72 | XPM_SUBSYSID_PSM, |
| 73 | XPM_SUBSYSID_APU, |
| 74 | XPM_SUBSYSID_RPU0_LOCK, |
| 75 | XPM_SUBSYSID_RPU0_0, |
| 76 | XPM_SUBSYSID_RPU0_1, |
| 77 | XPM_SUBSYSID_DDR0, |
| 78 | XPM_SUBSYSID_ME, |
| 79 | XPM_SUBSYSID_PL, |
| 80 | XPM_SUBSYSID_MAX, |
| 81 | } XPm_SubsystemId; |
| 82 | |
| 83 | /** |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 84 | * @PM_RET_SUCCESS: success |
| 85 | * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated) |
| 86 | * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated) |
| 87 | * @PM_RET_ERROR_INTERNAL: internal error |
| 88 | * @PM_RET_ERROR_CONFLICT: conflict |
| 89 | * @PM_RET_ERROR_ACCESS: access rights violation |
| 90 | * @PM_RET_ERROR_INVALID_NODE: invalid node |
| 91 | * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node |
| 92 | * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted |
| 93 | * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU |
| 94 | * @PM_RET_ERROR_NODE_USED: node is already in use |
| 95 | */ |
| 96 | enum pm_ret_status { |
| 97 | PM_RET_SUCCESS, |
| 98 | PM_RET_ERROR_ARGS = 1, |
| 99 | PM_RET_ERROR_NOTSUPPORTED = 4, |
| 100 | PM_RET_ERROR_INTERNAL = 2000, |
| 101 | PM_RET_ERROR_CONFLICT = 2001, |
| 102 | PM_RET_ERROR_ACCESS = 2002, |
| 103 | PM_RET_ERROR_INVALID_NODE = 2003, |
| 104 | PM_RET_ERROR_DOUBLE_REQ = 2004, |
| 105 | PM_RET_ERROR_ABORT_SUSPEND = 2005, |
| 106 | PM_RET_ERROR_TIMEOUT = 2006, |
| 107 | PM_RET_ERROR_NODE_USED = 2007 |
| 108 | }; |
| 109 | #endif /* PM_DEFS_H */ |