Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Xilinx Zynq MPSoC Firmware driver |
| 4 | * |
| 5 | * Copyright (C) 2018-2019 Xilinx, Inc. |
| 6 | */ |
| 7 | |
| 8 | #ifndef _ZYNQMP_FIRMWARE_H_ |
| 9 | #define _ZYNQMP_FIRMWARE_H_ |
| 10 | |
| 11 | enum pm_api_id { |
| 12 | PM_GET_API_VERSION = 1, |
Michal Simek | 31431dd | 2021-07-30 07:59:29 +0200 | [diff] [blame^] | 13 | PM_SET_CONFIGURATION = 2, |
| 14 | PM_GET_NODE_STATUS = 3, |
| 15 | PM_GET_OPERATING_CHARACTERISTIC = 4, |
| 16 | PM_REGISTER_NOTIFIER = 5, |
| 17 | /* API for suspending */ |
| 18 | PM_REQUEST_SUSPEND = 6, |
| 19 | PM_SELF_SUSPEND = 7, |
| 20 | PM_FORCE_POWERDOWN = 8, |
| 21 | PM_ABORT_SUSPEND = 9, |
| 22 | PM_REQUEST_WAKEUP = 10, |
| 23 | PM_SET_WAKEUP_SOURCE = 11, |
| 24 | PM_SYSTEM_SHUTDOWN = 12, |
| 25 | PM_REQUEST_NODE = 13, |
| 26 | PM_RELEASE_NODE = 14, |
| 27 | PM_SET_REQUIREMENT = 15, |
| 28 | PM_SET_MAX_LATENCY = 16, |
| 29 | /* Direct control API functions: */ |
| 30 | PM_RESET_ASSERT = 17, |
| 31 | PM_RESET_GET_STATUS = 18, |
| 32 | PM_MMIO_WRITE = 19, |
| 33 | PM_MMIO_READ = 20, |
| 34 | PM_PM_INIT_FINALIZE = 21, |
| 35 | PM_FPGA_LOAD = 22, |
| 36 | PM_FPGA_GET_STATUS = 23, |
| 37 | PM_GET_CHIPID = 24, |
| 38 | /* ID 25 is been used by U-boot to process secure boot images */ |
| 39 | /* Secure library generic API functions */ |
Michal Simek | 0f3604a | 2019-10-04 15:25:18 +0200 | [diff] [blame] | 40 | PM_SECURE_SHA = 26, |
Michal Simek | 31431dd | 2021-07-30 07:59:29 +0200 | [diff] [blame^] | 41 | PM_SECURE_RSA = 27, |
| 42 | PM_PINCTRL_REQUEST = 28, |
| 43 | PM_PINCTRL_RELEASE = 29, |
| 44 | PM_PINCTRL_GET_FUNCTION = 30, |
| 45 | PM_PINCTRL_SET_FUNCTION = 31, |
| 46 | PM_PINCTRL_CONFIG_PARAM_GET = 32, |
| 47 | PM_PINCTRL_CONFIG_PARAM_SET = 33, |
| 48 | PM_IOCTL = 34, |
| 49 | PM_QUERY_DATA = 35, |
| 50 | PM_CLOCK_ENABLE = 36, |
| 51 | PM_CLOCK_DISABLE = 37, |
| 52 | PM_CLOCK_GETSTATE = 38, |
| 53 | PM_CLOCK_SETDIVIDER = 39, |
| 54 | PM_CLOCK_GETDIVIDER = 40, |
| 55 | PM_CLOCK_SETRATE = 41, |
| 56 | PM_CLOCK_GETRATE = 42, |
| 57 | PM_CLOCK_SETPARENT = 43, |
| 58 | PM_CLOCK_GETPARENT = 44, |
| 59 | PM_SECURE_IMAGE = 45, |
Michal Simek | 0f3604a | 2019-10-04 15:25:18 +0200 | [diff] [blame] | 60 | PM_FPGA_READ = 46, |
Michal Simek | 31431dd | 2021-07-30 07:59:29 +0200 | [diff] [blame^] | 61 | PM_SECURE_AES = 47, |
Michal Simek | 0f3604a | 2019-10-04 15:25:18 +0200 | [diff] [blame] | 62 | PM_CLOCK_PLL_GETPARAM = 49, |
Michal Simek | 31431dd | 2021-07-30 07:59:29 +0200 | [diff] [blame^] | 63 | /* PM_REGISTER_ACCESS API */ |
Michal Simek | 0f3604a | 2019-10-04 15:25:18 +0200 | [diff] [blame] | 64 | PM_REGISTER_ACCESS = 52, |
Michal Simek | 31431dd | 2021-07-30 07:59:29 +0200 | [diff] [blame^] | 65 | PM_EFUSE_ACCESS = 53, |
Michal Simek | 0f3604a | 2019-10-04 15:25:18 +0200 | [diff] [blame] | 66 | PM_FEATURE_CHECK = 63, |
| 67 | PM_API_MAX, |
Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 68 | }; |
| 69 | |
Michal Simek | 29af2ac | 2020-07-23 09:24:06 +0200 | [diff] [blame] | 70 | enum pm_query_id { |
| 71 | PM_QID_INVALID = 0, |
| 72 | PM_QID_CLOCK_GET_NAME = 1, |
| 73 | PM_QID_CLOCK_GET_TOPOLOGY = 2, |
| 74 | PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS = 3, |
| 75 | PM_QID_CLOCK_GET_PARENTS = 4, |
| 76 | PM_QID_CLOCK_GET_ATTRIBUTES = 5, |
| 77 | PM_QID_PINCTRL_GET_NUM_PINS = 6, |
| 78 | PM_QID_PINCTRL_GET_NUM_FUNCTIONS = 7, |
| 79 | PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS = 8, |
| 80 | PM_QID_PINCTRL_GET_FUNCTION_NAME = 9, |
| 81 | PM_QID_PINCTRL_GET_FUNCTION_GROUPS = 10, |
| 82 | PM_QID_PINCTRL_GET_PIN_GROUPS = 11, |
| 83 | PM_QID_CLOCK_GET_NUM_CLOCKS = 12, |
| 84 | PM_QID_CLOCK_GET_MAX_DIVISOR = 13, |
| 85 | }; |
| 86 | |
Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 87 | #define PM_SIP_SVC 0xc2000000 |
Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 88 | |
| 89 | #define ZYNQMP_PM_VERSION_MAJOR 1 |
| 90 | #define ZYNQMP_PM_VERSION_MINOR 0 |
| 91 | #define ZYNQMP_PM_VERSION_MAJOR_SHIFT 16 |
| 92 | #define ZYNQMP_PM_VERSION_MINOR_MASK 0xFFFF |
| 93 | |
| 94 | #define ZYNQMP_PM_VERSION \ |
| 95 | ((ZYNQMP_PM_VERSION_MAJOR << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | \ |
| 96 | ZYNQMP_PM_VERSION_MINOR) |
| 97 | |
| 98 | #define ZYNQMP_PM_VERSION_INVALID ~0 |
| 99 | |
| 100 | #define PMUFW_V1_0 ((1 << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | 0) |
| 101 | |
Ibai Erkiaga | f6cccbb | 2020-08-04 23:17:26 +0100 | [diff] [blame] | 102 | /* |
| 103 | * Return payload size |
| 104 | * Not every firmware call expects the same amount of return bytes, however the |
| 105 | * firmware driver always copies 5 bytes from RX buffer to the ret_payload |
| 106 | * buffer. Therefore allocating with this defined value is recommended to avoid |
| 107 | * overflows. |
| 108 | */ |
| 109 | #define PAYLOAD_ARG_CNT 5U |
| 110 | |
Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 111 | unsigned int zynqmp_firmware_version(void); |
Michal Simek | a3e552b | 2019-09-27 14:20:00 +0200 | [diff] [blame] | 112 | void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size); |
Michal Simek | 6596270 | 2019-10-04 15:52:43 +0200 | [diff] [blame] | 113 | int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, |
Michal Simek | 866225f | 2019-10-04 15:45:29 +0200 | [diff] [blame] | 114 | u32 arg3, u32 *ret_payload); |
Ibai Erkiaga | 009ab7b | 2019-09-27 11:37:01 +0100 | [diff] [blame] | 115 | |
| 116 | #endif /* _ZYNQMP_FIRMWARE_H_ */ |