Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
Rajan Vaja | 02d1842 | 2019-03-04 11:09:39 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef PM_API_SYS_H |
| 8 | #define PM_API_SYS_H |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 9 | |
| 10 | #include <stdint.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 12 | #include "pm_defs.h" |
| 13 | |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 14 | enum pm_query_id { |
| 15 | PM_QID_INVALID, |
| 16 | PM_QID_CLOCK_GET_NAME, |
| 17 | PM_QID_CLOCK_GET_TOPOLOGY, |
| 18 | PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS, |
| 19 | PM_QID_CLOCK_GET_PARENTS, |
| 20 | PM_QID_CLOCK_GET_ATTRIBUTES, |
Rajan Vaja | d5dd836 | 2018-01-30 04:16:31 -0800 | [diff] [blame] | 21 | PM_QID_PINCTRL_GET_NUM_PINS, |
| 22 | PM_QID_PINCTRL_GET_NUM_FUNCTIONS, |
| 23 | PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS, |
| 24 | PM_QID_PINCTRL_GET_FUNCTION_NAME, |
| 25 | PM_QID_PINCTRL_GET_FUNCTION_GROUPS, |
| 26 | PM_QID_PINCTRL_GET_PIN_GROUPS, |
Rajan Vaja | da95940 | 2018-07-20 03:16:27 -0700 | [diff] [blame] | 27 | PM_QID_CLOCK_GET_NUM_CLOCKS, |
Rajan Vaja | b34deca | 2019-03-20 01:13:21 +0530 | [diff] [blame] | 28 | PM_QID_CLOCK_GET_MAX_DIVISOR, |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 29 | }; |
| 30 | |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 31 | /********************************************************** |
| 32 | * System-level API function declarations |
| 33 | **********************************************************/ |
| 34 | enum pm_ret_status pm_req_suspend(enum pm_node_id nid, |
| 35 | enum pm_request_ack ack, |
| 36 | unsigned int latency, |
| 37 | unsigned int state); |
| 38 | |
| 39 | enum pm_ret_status pm_self_suspend(enum pm_node_id nid, |
| 40 | unsigned int latency, |
| 41 | unsigned int state, |
| 42 | uintptr_t address); |
| 43 | |
| 44 | enum pm_ret_status pm_force_powerdown(enum pm_node_id nid, |
| 45 | enum pm_request_ack ack); |
| 46 | |
| 47 | enum pm_ret_status pm_abort_suspend(enum pm_abort_reason reason); |
| 48 | |
| 49 | enum pm_ret_status pm_req_wakeup(enum pm_node_id nid, |
| 50 | unsigned int set_address, |
| 51 | uintptr_t address, |
| 52 | enum pm_request_ack ack); |
| 53 | |
| 54 | enum pm_ret_status pm_set_wakeup_source(enum pm_node_id target, |
| 55 | enum pm_node_id wkup_node, |
| 56 | unsigned int enable); |
| 57 | |
Soren Brinkmann | 58fbb9b | 2016-09-02 09:50:54 -0700 | [diff] [blame] | 58 | enum pm_ret_status pm_system_shutdown(unsigned int type, unsigned int subtype); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 59 | |
| 60 | enum pm_ret_status pm_init_suspend_cb(enum pm_suspend_reason reason, |
| 61 | unsigned int latency, |
| 62 | unsigned int state, |
| 63 | unsigned int timeout); |
| 64 | |
| 65 | /* API functions for managing PM Slaves */ |
| 66 | enum pm_ret_status pm_req_node(enum pm_node_id nid, |
| 67 | unsigned int capabilities, |
| 68 | unsigned int qos, |
| 69 | enum pm_request_ack ack); |
| 70 | enum pm_ret_status pm_release_node(enum pm_node_id nid); |
| 71 | |
| 72 | enum pm_ret_status pm_set_requirement(enum pm_node_id nid, |
| 73 | unsigned int capabilities, |
| 74 | unsigned int qos, |
| 75 | enum pm_request_ack ack); |
| 76 | enum pm_ret_status pm_set_max_latency(enum pm_node_id nid, |
| 77 | unsigned int latency); |
| 78 | |
| 79 | /* Miscellaneous API functions */ |
| 80 | enum pm_ret_status pm_get_api_version(unsigned int *version); |
| 81 | enum pm_ret_status pm_set_configuration(unsigned int phys_addr); |
Filip Drazic | f2ddd91 | 2017-03-15 11:50:47 +0100 | [diff] [blame] | 82 | enum pm_ret_status pm_init_finalize(void); |
Anes Hadziahmetagic | 1caf88e | 2017-01-27 18:42:44 +0100 | [diff] [blame] | 83 | enum pm_ret_status pm_get_node_status(enum pm_node_id node, |
| 84 | uint32_t *ret_buff); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 85 | enum pm_ret_status pm_register_notifier(enum pm_node_id nid, |
| 86 | unsigned int event, |
| 87 | unsigned int wake, |
| 88 | unsigned int enable); |
| 89 | enum pm_ret_status pm_get_op_characteristic(enum pm_node_id nid, |
Anes Hadziahmetagic | 92aee01 | 2016-05-12 16:17:30 +0200 | [diff] [blame] | 90 | enum pm_opchar_type type, |
| 91 | uint32_t *result); |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 92 | enum pm_ret_status pm_acknowledge_cb(enum pm_node_id nid, |
| 93 | enum pm_ret_status status, |
| 94 | unsigned int oppoint); |
| 95 | enum pm_ret_status pm_notify_cb(enum pm_node_id nid, |
| 96 | unsigned int event, |
| 97 | unsigned int oppoint); |
| 98 | |
| 99 | /* Direct-Control API functions */ |
| 100 | enum pm_ret_status pm_reset_assert(unsigned int reset_id, |
| 101 | unsigned int assert); |
| 102 | enum pm_ret_status pm_reset_get_status(unsigned int reset_id, |
| 103 | unsigned int *reset_status); |
| 104 | enum pm_ret_status pm_mmio_write(uintptr_t address, |
| 105 | unsigned int mask, |
| 106 | unsigned int value); |
| 107 | enum pm_ret_status pm_mmio_read(uintptr_t address, unsigned int *value); |
Soren Brinkmann | 881788d | 2017-09-18 09:13:17 -0700 | [diff] [blame] | 108 | enum pm_ret_status pm_fpga_load(uint32_t address_low, |
| 109 | uint32_t address_high, |
Nava kishore Manne | 68d460c | 2016-08-20 23:18:09 +0530 | [diff] [blame] | 110 | uint32_t size, |
| 111 | uint32_t flags); |
| 112 | enum pm_ret_status pm_fpga_get_status(unsigned int *value); |
| 113 | |
Soren Brinkmann | cb36681 | 2016-09-22 12:21:11 -0700 | [diff] [blame] | 114 | enum pm_ret_status pm_get_chipid(uint32_t *value); |
Siva Durga Prasad Paladugu | de93d98 | 2018-04-30 15:49:27 +0530 | [diff] [blame] | 115 | enum pm_ret_status pm_secure_rsaaes(uint32_t address_high, |
| 116 | uint32_t address_low, |
| 117 | uint32_t size, |
| 118 | uint32_t flags); |
Siva Durga Prasad Paladugu | 1f80d3f | 2018-04-30 15:56:10 +0530 | [diff] [blame] | 119 | unsigned int pm_get_shutdown_scope(void); |
Rajan Vaja | 02d1842 | 2019-03-04 11:09:39 +0530 | [diff] [blame] | 120 | void pm_get_callbackdata(uint32_t *data, size_t count); |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 121 | enum pm_ret_status pm_pinctrl_request(unsigned int pin); |
| 122 | enum pm_ret_status pm_pinctrl_release(unsigned int pin); |
| 123 | enum pm_ret_status pm_pinctrl_get_function(unsigned int pin, |
Jolly Shah | 69fb5bf | 2018-02-07 16:25:41 -0800 | [diff] [blame] | 124 | enum pm_node_id *nid); |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 125 | enum pm_ret_status pm_pinctrl_set_function(unsigned int pin, |
Jolly Shah | 69fb5bf | 2018-02-07 16:25:41 -0800 | [diff] [blame] | 126 | enum pm_node_id nid); |
Rajan Vaja | 8368761 | 2018-01-17 02:39:20 -0800 | [diff] [blame] | 127 | enum pm_ret_status pm_pinctrl_get_config(unsigned int pin, |
| 128 | unsigned int param, |
| 129 | unsigned int *value); |
| 130 | enum pm_ret_status pm_pinctrl_set_config(unsigned int pin, |
| 131 | unsigned int param, |
| 132 | unsigned int value); |
Rajan Vaja | 5529a01 | 2018-01-17 02:39:23 -0800 | [diff] [blame] | 133 | enum pm_ret_status pm_ioctl(enum pm_node_id nid, |
| 134 | unsigned int ioctl_id, |
| 135 | unsigned int arg1, |
| 136 | unsigned int arg2, |
| 137 | unsigned int *value); |
Rajan Vaja | 3511613 | 2018-01-17 02:39:25 -0800 | [diff] [blame] | 138 | enum pm_ret_status pm_clock_enable(unsigned int clock_id); |
| 139 | enum pm_ret_status pm_clock_disable(unsigned int clock_id); |
| 140 | enum pm_ret_status pm_clock_getstate(unsigned int clock_id, |
| 141 | unsigned int *state); |
| 142 | enum pm_ret_status pm_clock_setdivider(unsigned int clock_id, |
| 143 | unsigned int divider); |
| 144 | enum pm_ret_status pm_clock_getdivider(unsigned int clock_id, |
| 145 | unsigned int *divider); |
| 146 | enum pm_ret_status pm_clock_setrate(unsigned int clock_id, |
| 147 | uint64_t rate); |
| 148 | enum pm_ret_status pm_clock_getrate(unsigned int clock_id, |
| 149 | uint64_t *rate); |
| 150 | enum pm_ret_status pm_clock_setparent(unsigned int clock_id, |
| 151 | unsigned int parent_id); |
| 152 | enum pm_ret_status pm_clock_getparent(unsigned int clock_id, |
| 153 | unsigned int *parent_id); |
Rajan Vaja | cd82568 | 2020-11-23 21:33:39 -0800 | [diff] [blame] | 154 | void pm_query_data(enum pm_query_id qid, unsigned int arg1, unsigned int arg2, |
| 155 | unsigned int arg3, unsigned int *data); |
Siva Durga Prasad Paladugu | f3994cc | 2018-05-01 11:12:55 +0530 | [diff] [blame] | 156 | enum pm_ret_status pm_sha_hash(uint32_t address_high, |
| 157 | uint32_t address_low, |
| 158 | uint32_t size, |
| 159 | uint32_t flags); |
| 160 | enum pm_ret_status pm_rsa_core(uint32_t address_high, |
| 161 | uint32_t address_low, |
| 162 | uint32_t size, |
| 163 | uint32_t flags); |
Siva Durga Prasad Paladugu | a4ed4b2 | 2018-04-30 20:06:58 +0530 | [diff] [blame] | 164 | enum pm_ret_status pm_secure_image(uint32_t address_low, |
| 165 | uint32_t address_high, |
| 166 | uint32_t key_lo, |
| 167 | uint32_t key_hi, |
| 168 | uint32_t *value); |
Siva Durga Prasad Paladugu | 7c6516a | 2018-09-04 17:41:34 +0530 | [diff] [blame] | 169 | |
| 170 | enum pm_ret_status pm_fpga_read(uint32_t reg_numframes, |
| 171 | uint32_t address_low, |
| 172 | uint32_t address_high, |
| 173 | uint32_t readback_type, |
| 174 | uint32_t *value); |
Siva Durga Prasad Paladugu | 8bd905b | 2018-09-04 18:05:50 +0530 | [diff] [blame] | 175 | enum pm_ret_status pm_aes_engine(uint32_t address_high, |
| 176 | uint32_t address_low, |
| 177 | uint32_t *value); |
Siva Durga Prasad Paladugu | 7c6516a | 2018-09-04 17:41:34 +0530 | [diff] [blame] | 178 | |
Jolly Shah | a7cc5ee | 2019-01-02 12:27:00 -0800 | [diff] [blame] | 179 | enum pm_ret_status pm_pll_set_parameter(enum pm_node_id nid, |
| 180 | enum pm_pll_param param_id, |
| 181 | unsigned int value); |
| 182 | |
Jolly Shah | cb2f45d | 2019-01-04 11:28:38 -0800 | [diff] [blame] | 183 | enum pm_ret_status pm_pll_get_parameter(enum pm_node_id nid, |
| 184 | enum pm_pll_param param_id, |
| 185 | unsigned int *value); |
| 186 | |
Jolly Shah | 1f0d585 | 2019-01-04 11:32:31 -0800 | [diff] [blame] | 187 | enum pm_ret_status pm_pll_set_mode(enum pm_node_id nid, enum pm_pll_mode mode); |
Jolly Shah | 141421e | 2019-01-04 11:35:48 -0800 | [diff] [blame] | 188 | enum pm_ret_status pm_pll_get_mode(enum pm_node_id nid, enum pm_pll_mode *mode); |
Jolly Shah | 1f0d585 | 2019-01-04 11:32:31 -0800 | [diff] [blame] | 189 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 190 | #endif /* PM_API_SYS_H */ |