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 | |
Tejas Patel | 54d1319 | 2019-02-27 18:44:55 +0530 | [diff] [blame] | 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 | |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 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 | |
Tejas Patel | 9d09ff9 | 2019-01-08 01:46:35 -0800 | [diff] [blame] | 32 | /* PM API ids */ |
| 33 | #define PM_GET_API_VERSION 1U |
Tejas Patel | 41f3e0b | 2019-01-08 01:46:37 -0800 | [diff] [blame] | 34 | #define PM_GET_DEVICE_STATUS 3U |
Tejas Patel | fe0e10a | 2019-12-08 23:29:44 -0800 | [diff] [blame] | 35 | #define PM_REQ_SUSPEND 6U |
| 36 | #define PM_SELF_SUSPEND 7U |
Tejas Patel | 6b28225 | 2019-01-10 03:03:47 -0800 | [diff] [blame] | 37 | #define PM_FORCE_POWERDOWN 8U |
Tejas Patel | fe0e10a | 2019-12-08 23:29:44 -0800 | [diff] [blame] | 38 | #define PM_ABORT_SUSPEND 9U |
Tejas Patel | 49cd871 | 2019-01-23 14:18:51 +0530 | [diff] [blame] | 39 | #define PM_REQ_WAKEUP 10U |
Tejas Patel | db81205 | 2019-01-23 14:18:53 +0530 | [diff] [blame] | 40 | #define PM_SET_WAKEUP_SOURCE 11U |
Tejas Patel | 6b28225 | 2019-01-10 03:03:47 -0800 | [diff] [blame] | 41 | #define PM_SYSTEM_SHUTDOWN 12U |
Tejas Patel | 41f3e0b | 2019-01-08 01:46:37 -0800 | [diff] [blame] | 42 | #define PM_REQUEST_DEVICE 13U |
| 43 | #define PM_RELEASE_DEVICE 14U |
| 44 | #define PM_SET_REQUIREMENT 15U |
Tejas Patel | 87c4f3a | 2019-01-08 01:46:38 -0800 | [diff] [blame] | 45 | #define PM_RESET_ASSERT 17U |
| 46 | #define PM_RESET_GET_STATUS 18U |
Tejas Patel | 0266202 | 2019-01-21 17:56:49 +0530 | [diff] [blame] | 47 | #define PM_INIT_FINALIZE 21U |
Tejas Patel | 20e9202 | 2019-01-08 01:46:39 -0800 | [diff] [blame] | 48 | #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 Patel | 9141f44 | 2019-01-10 03:03:48 -0800 | [diff] [blame] | 54 | #define PM_IOCTL 34U |
Tejas Patel | a3e34ad | 2019-02-01 17:25:19 +0530 | [diff] [blame] | 55 | #define PM_QUERY_DATA 35U |
Tejas Patel | 1f56fb1 | 2019-01-08 01:46:40 -0800 | [diff] [blame] | 56 | #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 Patel | 023116d | 2019-01-08 01:46:41 -0800 | [diff] [blame] | 65 | #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 Patel | 9d09ff9 | 2019-01-08 01:46:35 -0800 | [diff] [blame] | 69 | |
Tejas Patel | 9141f44 | 2019-01-10 03:03:48 -0800 | [diff] [blame] | 70 | /* 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 | |
Saeed Nowshadi | c5a1bda | 2019-12-08 23:35:35 -0800 | [diff] [blame] | 80 | /* System shutdown macros */ |
| 81 | #define XPM_SHUTDOWN_TYPE_SHUTDOWN 0U |
| 82 | #define XPM_SHUTDOWN_TYPE_RESET 1U |
| 83 | #define XPM_SHUTDOWN_TYPE_SETSCOPE_ONLY 2U |
| 84 | |
| 85 | #define XPM_SHUTDOWN_SUBTYPE_RST_SUBSYSTEM 0U |
| 86 | #define XPM_SHUTDOWN_SUBTYPE_RST_PS_ONLY 1U |
| 87 | #define XPM_SHUTDOWN_SUBTYPE_RST_SYSTEM 2U |
| 88 | |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 89 | /********************************************************************* |
| 90 | * Enum definitions |
| 91 | ********************************************************************/ |
| 92 | |
Tejas Patel | fe0e10a | 2019-12-08 23:29:44 -0800 | [diff] [blame] | 93 | enum pm_abort_reason { |
| 94 | ABORT_REASON_WKUP_EVENT = 100, |
| 95 | ABORT_REASON_PU_BUSY, |
| 96 | ABORT_REASON_NO_PWRDN, |
| 97 | ABORT_REASON_UNKNOWN, |
| 98 | }; |
| 99 | |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 100 | /** |
Tejas Patel | 41f3e0b | 2019-01-08 01:46:37 -0800 | [diff] [blame] | 101 | * Subsystem IDs |
| 102 | */ |
| 103 | typedef enum { |
| 104 | XPM_SUBSYSID_PMC, |
| 105 | XPM_SUBSYSID_PSM, |
| 106 | XPM_SUBSYSID_APU, |
| 107 | XPM_SUBSYSID_RPU0_LOCK, |
| 108 | XPM_SUBSYSID_RPU0_0, |
| 109 | XPM_SUBSYSID_RPU0_1, |
| 110 | XPM_SUBSYSID_DDR0, |
| 111 | XPM_SUBSYSID_ME, |
| 112 | XPM_SUBSYSID_PL, |
| 113 | XPM_SUBSYSID_MAX, |
| 114 | } XPm_SubsystemId; |
| 115 | |
| 116 | /** |
Tejas Patel | 354fe57 | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 117 | * @PM_RET_SUCCESS: success |
| 118 | * @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated) |
| 119 | * @PM_RET_ERROR_NOTSUPPORTED: feature not supported (deprecated) |
| 120 | * @PM_RET_ERROR_INTERNAL: internal error |
| 121 | * @PM_RET_ERROR_CONFLICT: conflict |
| 122 | * @PM_RET_ERROR_ACCESS: access rights violation |
| 123 | * @PM_RET_ERROR_INVALID_NODE: invalid node |
| 124 | * @PM_RET_ERROR_DOUBLE_REQ: duplicate request for same node |
| 125 | * @PM_RET_ERROR_ABORT_SUSPEND: suspend procedure has been aborted |
| 126 | * @PM_RET_ERROR_TIMEOUT: timeout in communication with PMU |
| 127 | * @PM_RET_ERROR_NODE_USED: node is already in use |
| 128 | */ |
| 129 | enum pm_ret_status { |
| 130 | PM_RET_SUCCESS, |
| 131 | PM_RET_ERROR_ARGS = 1, |
| 132 | PM_RET_ERROR_NOTSUPPORTED = 4, |
| 133 | PM_RET_ERROR_INTERNAL = 2000, |
| 134 | PM_RET_ERROR_CONFLICT = 2001, |
| 135 | PM_RET_ERROR_ACCESS = 2002, |
| 136 | PM_RET_ERROR_INVALID_NODE = 2003, |
| 137 | PM_RET_ERROR_DOUBLE_REQ = 2004, |
| 138 | PM_RET_ERROR_ABORT_SUSPEND = 2005, |
| 139 | PM_RET_ERROR_TIMEOUT = 2006, |
| 140 | PM_RET_ERROR_NODE_USED = 2007 |
| 141 | }; |
| 142 | #endif /* PM_DEFS_H */ |