blob: 669af6765ce90029afe446256d39363000211fc4 [file] [log] [blame]
Ibai Erkiaga009ab7b2019-09-27 11:37:01 +01001/* 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
11enum pm_api_id {
12 PM_GET_API_VERSION = 1,
Michal Simek31431dd2021-07-30 07:59:29 +020013 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 Simek0f3604a2019-10-04 15:25:18 +020040 PM_SECURE_SHA = 26,
Michal Simek31431dd2021-07-30 07:59:29 +020041 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 Simek0f3604a2019-10-04 15:25:18 +020060 PM_FPGA_READ = 46,
Michal Simek31431dd2021-07-30 07:59:29 +020061 PM_SECURE_AES = 47,
Michal Simek0f3604a2019-10-04 15:25:18 +020062 PM_CLOCK_PLL_GETPARAM = 49,
Michal Simek31431dd2021-07-30 07:59:29 +020063 /* PM_REGISTER_ACCESS API */
Michal Simek0f3604a2019-10-04 15:25:18 +020064 PM_REGISTER_ACCESS = 52,
Michal Simek31431dd2021-07-30 07:59:29 +020065 PM_EFUSE_ACCESS = 53,
Michal Simek0f3604a2019-10-04 15:25:18 +020066 PM_FEATURE_CHECK = 63,
67 PM_API_MAX,
Ibai Erkiaga009ab7b2019-09-27 11:37:01 +010068};
69
Michal Simek29af2ac2020-07-23 09:24:06 +020070enum 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 Erkiaga009ab7b2019-09-27 11:37:01 +010087#define PM_SIP_SVC 0xc2000000
Ibai Erkiaga009ab7b2019-09-27 11:37:01 +010088
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 Erkiagaf6cccbb2020-08-04 23:17:26 +0100102/*
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 Erkiaga009ab7b2019-09-27 11:37:01 +0100111unsigned int zynqmp_firmware_version(void);
Michal Simeka3e552b2019-09-27 14:20:00 +0200112void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size);
Michal Simek65962702019-10-04 15:52:43 +0200113int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2,
Michal Simek866225f2019-10-04 15:45:29 +0200114 u32 arg3, u32 *ret_payload);
Ibai Erkiaga009ab7b2019-09-27 11:37:01 +0100115
116#endif /* _ZYNQMP_FIRMWARE_H_ */