Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ |
| 2 | /* |
| 3 | * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved. |
| 4 | * Copyright (C) 2019-2020, Linaro Limited |
| 5 | */ |
| 6 | #ifndef _SCMI_PROTOCOLS_H |
| 7 | #define _SCMI_PROTOCOLS_H |
| 8 | |
| 9 | #include <linux/bitops.h> |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 10 | #include <asm/types.h> |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 11 | |
| 12 | /* |
| 13 | * Subset the SCMI protocols definition |
| 14 | * based on SCMI specification v2.0 (DEN0056B) |
| 15 | * https://developer.arm.com/docs/den0056/b |
| 16 | */ |
| 17 | |
| 18 | enum scmi_std_protocol { |
| 19 | SCMI_PROTOCOL_ID_BASE = 0x10, |
| 20 | SCMI_PROTOCOL_ID_POWER_DOMAIN = 0x11, |
| 21 | SCMI_PROTOCOL_ID_SYSTEM = 0x12, |
| 22 | SCMI_PROTOCOL_ID_PERF = 0x13, |
| 23 | SCMI_PROTOCOL_ID_CLOCK = 0x14, |
| 24 | SCMI_PROTOCOL_ID_SENSOR = 0x15, |
| 25 | SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16, |
Etienne Carriere | d68663a | 2021-03-08 22:38:06 +0100 | [diff] [blame] | 26 | SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17, |
Alice Guo | aeb0319 | 2025-04-28 18:37:26 +0800 | [diff] [blame] | 27 | SCMI_PROTOCOL_ID_PINCTRL = 0x19, |
Peng Fan | 8cbe700 | 2025-04-28 18:37:28 +0800 | [diff] [blame] | 28 | SCMI_PROTOCOL_ID_IMX_MISC = 0x84, |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | enum scmi_status_code { |
| 32 | SCMI_SUCCESS = 0, |
| 33 | SCMI_NOT_SUPPORTED = -1, |
| 34 | SCMI_INVALID_PARAMETERS = -2, |
| 35 | SCMI_DENIED = -3, |
| 36 | SCMI_NOT_FOUND = -4, |
| 37 | SCMI_OUT_OF_RANGE = -5, |
| 38 | SCMI_BUSY = -6, |
| 39 | SCMI_COMMS_ERROR = -7, |
| 40 | SCMI_GENERIC_ERROR = -8, |
| 41 | SCMI_HARDWARE_ERROR = -9, |
| 42 | SCMI_PROTOCOL_ERROR = -10, |
| 43 | }; |
| 44 | |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 45 | /* |
Etienne Carriere | 4c4ec90 | 2022-02-21 09:22:42 +0100 | [diff] [blame] | 46 | * Generic message IDs |
| 47 | */ |
| 48 | enum scmi_discovery_id { |
| 49 | SCMI_PROTOCOL_VERSION = 0x0, |
| 50 | SCMI_PROTOCOL_ATTRIBUTES = 0x1, |
| 51 | SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2, |
| 52 | }; |
| 53 | |
Peng Fan | 8cbe700 | 2025-04-28 18:37:28 +0800 | [diff] [blame] | 54 | enum scmi_imx_misc_message_id { |
| 55 | SCMI_MISC_ROM_PASSOVER_GET = 0x7 |
| 56 | }; |
| 57 | |
Etienne Carriere | 4c4ec90 | 2022-02-21 09:22:42 +0100 | [diff] [blame] | 58 | /* |
AKASHI Takahiro | d1ce56a | 2023-10-11 19:07:00 +0900 | [diff] [blame] | 59 | * SCMI Base Protocol |
| 60 | */ |
| 61 | #define SCMI_BASE_PROTOCOL_VERSION 0x20000 |
| 62 | |
| 63 | enum scmi_base_message_id { |
| 64 | SCMI_BASE_DISCOVER_VENDOR = 0x3, |
| 65 | SCMI_BASE_DISCOVER_SUB_VENDOR = 0x4, |
| 66 | SCMI_BASE_DISCOVER_IMPL_VERSION = 0x5, |
| 67 | SCMI_BASE_DISCOVER_LIST_PROTOCOLS = 0x6, |
| 68 | SCMI_BASE_DISCOVER_AGENT = 0x7, |
| 69 | SCMI_BASE_NOTIFY_ERRORS = 0x8, |
| 70 | SCMI_BASE_SET_DEVICE_PERMISSIONS = 0x9, |
| 71 | SCMI_BASE_SET_PROTOCOL_PERMISSIONS = 0xa, |
| 72 | SCMI_BASE_RESET_AGENT_CONFIGURATION = 0xb, |
| 73 | }; |
| 74 | |
| 75 | #define SCMI_BASE_NAME_LENGTH_MAX 16 |
| 76 | |
| 77 | /** |
| 78 | * struct scmi_protocol_version_out - Response for SCMI_PROTOCOL_VERSION |
| 79 | * command |
| 80 | * @status: SCMI command status |
| 81 | * @version: Protocol version |
| 82 | */ |
| 83 | struct scmi_protocol_version_out { |
| 84 | s32 status; |
| 85 | u32 version; |
| 86 | }; |
| 87 | |
| 88 | /** |
| 89 | * struct scmi_protocol_attrs_out - Response for SCMI_PROTOCOL_ATTRIBUTES |
| 90 | * command |
| 91 | * @status: SCMI command status |
| 92 | * @attributes: Protocol attributes or implementation details |
| 93 | */ |
| 94 | struct scmi_protocol_attrs_out { |
| 95 | s32 status; |
| 96 | u32 attributes; |
| 97 | }; |
| 98 | |
| 99 | #define SCMI_PROTOCOL_ATTRS_NUM_AGENTS(attributes) \ |
| 100 | (((attributes) & GENMASK(15, 8)) >> 8) |
| 101 | #define SCMI_PROTOCOL_ATTRS_NUM_PROTOCOLS(attributes) \ |
| 102 | ((attributes) & GENMASK(7, 0)) |
| 103 | |
| 104 | /** |
| 105 | * struct scmi_protocol_msg_attrs_out - Response for |
| 106 | * SCMI_PROTOCOL_MESSAGE_ATTRIBUTES command |
| 107 | * @status: SCMI command status |
| 108 | * @attributes: Message-specific attributes |
| 109 | */ |
| 110 | struct scmi_protocol_msg_attrs_out { |
| 111 | s32 status; |
| 112 | u32 attributes; |
| 113 | }; |
| 114 | |
| 115 | /** |
| 116 | * struct scmi_base_discover_vendor_out - Response for |
| 117 | * SCMI_BASE_DISCOVER_VENDOR or |
| 118 | * SCMI_BASE_DISCOVER_SUB_VENDOR command |
| 119 | * @status: SCMI command status |
| 120 | * @vendor_identifier: Name of vendor or sub-vendor in string |
| 121 | */ |
| 122 | struct scmi_base_discover_vendor_out { |
| 123 | s32 status; |
| 124 | u8 vendor_identifier[SCMI_BASE_NAME_LENGTH_MAX]; |
| 125 | }; |
| 126 | |
| 127 | /** |
| 128 | * struct scmi_base_discover_impl_version_out - Response for |
| 129 | * SCMI_BASE_DISCOVER_IMPL_VERSION command |
| 130 | * @status: SCMI command status |
| 131 | * @impl_version: Vendor-specific implementation version |
| 132 | */ |
| 133 | struct scmi_base_discover_impl_version_out { |
| 134 | s32 status; |
| 135 | u32 impl_version; |
| 136 | }; |
| 137 | |
| 138 | /** |
| 139 | * struct scmi_base_discover_list_protocols_out - Response for |
| 140 | * SCMI_BASE_DISCOVER_LIST_PROTOCOLS command |
| 141 | * @status: SCMI command status |
| 142 | * @num_protocols: Number of SCMI protocols in @protocol |
| 143 | * @protocols: Array of packed SCMI protocol ID's |
| 144 | */ |
| 145 | struct scmi_base_discover_list_protocols_out { |
| 146 | s32 status; |
| 147 | u32 num_protocols; |
Ye Li | 57fa163 | 2025-04-28 18:37:33 +0800 | [diff] [blame] | 148 | u32 protocols[]; |
AKASHI Takahiro | d1ce56a | 2023-10-11 19:07:00 +0900 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | /** |
| 152 | * struct scmi_base_discover_agent_out - Response for |
| 153 | * SCMI_BASE_DISCOVER_AGENT command |
| 154 | * @status: SCMI command status |
| 155 | * @agent_id: SCMI agent ID |
| 156 | * @name: Name of agent in string |
| 157 | */ |
| 158 | struct scmi_base_discover_agent_out { |
| 159 | s32 status; |
| 160 | u32 agent_id; |
| 161 | u8 name[SCMI_BASE_NAME_LENGTH_MAX]; |
| 162 | }; |
| 163 | |
| 164 | #define SCMI_BASE_NOTIFY_ERRORS_ENABLE BIT(0) |
| 165 | |
| 166 | /** |
| 167 | * struct scmi_base_set_device_permissions_in - Parameters for |
| 168 | * SCMI_BASE_SET_DEVICE_PERMISSIONS command |
| 169 | * @agent_id: SCMI agent ID |
| 170 | * @device_id: device ID |
| 171 | * @flags: A set of flags |
| 172 | */ |
| 173 | struct scmi_base_set_device_permissions_in { |
| 174 | u32 agent_id; |
| 175 | u32 device_id; |
| 176 | u32 flags; |
| 177 | }; |
| 178 | |
| 179 | #define SCMI_BASE_SET_DEVICE_PERMISSIONS_ACCESS BIT(0) |
| 180 | |
| 181 | /** |
| 182 | * struct scmi_base_set_protocol_permissions_in - Parameters for |
| 183 | * SCMI_BASE_SET_PROTOCOL_PERMISSIONS command |
| 184 | * @agent_id: SCMI agent ID |
| 185 | * @device_id: device ID |
| 186 | * @command_id: command ID |
| 187 | * @flags: A set of flags |
| 188 | */ |
| 189 | struct scmi_base_set_protocol_permissions_in { |
| 190 | u32 agent_id; |
| 191 | u32 device_id; |
| 192 | u32 command_id; |
| 193 | u32 flags; |
| 194 | }; |
| 195 | |
| 196 | #define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_COMMAND GENMASK(7, 0) |
| 197 | #define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_ACCESS BIT(0) |
| 198 | |
| 199 | /** |
| 200 | * struct scmi_base_reset_agent_configuration_in - Parameters for |
| 201 | * SCMI_BASE_RESET_AGENT_CONFIGURATION command |
| 202 | * @agent_id: SCMI agent ID |
| 203 | * @flags: A set of flags |
| 204 | */ |
| 205 | struct scmi_base_reset_agent_configuration_in { |
| 206 | u32 agent_id; |
| 207 | u32 flags; |
| 208 | }; |
| 209 | |
| 210 | #define SCMI_BASE_RESET_ALL_ACCESS_PERMISSIONS BIT(0) |
| 211 | |
| 212 | /** |
| 213 | * struct scmi_base_ops - SCMI base protocol interfaces |
| 214 | */ |
| 215 | struct scmi_base_ops { |
| 216 | /** |
| 217 | * protocol_version - get Base protocol version |
| 218 | * @dev: SCMI protocol device |
| 219 | * @version: Pointer to SCMI protocol version |
| 220 | * |
| 221 | * Obtain the protocol version number in @version for Base protocol. |
| 222 | * |
| 223 | * Return: 0 on success, error code on failure |
| 224 | */ |
| 225 | int (*protocol_version)(struct udevice *dev, u32 *version); |
| 226 | /** |
| 227 | * protocol_attrs - get protocol attributes |
| 228 | * @dev: SCMI protocol device |
| 229 | * @num_agents: Number of SCMI agents |
| 230 | * @num_protocols: Number of SCMI protocols |
| 231 | * |
| 232 | * Obtain the protocol attributes, the number of agents and the number |
| 233 | * of protocols, in @num_agents and @num_protocols respectively, that |
| 234 | * the device provides. |
| 235 | * |
| 236 | * Return: 0 on success, error code on failure |
| 237 | */ |
| 238 | int (*protocol_attrs)(struct udevice *dev, u32 *num_agents, |
| 239 | u32 *num_protocols); |
| 240 | /** |
| 241 | * protocol_message_attrs - get message-specific attributes |
| 242 | * @dev: SCMI protocol device |
| 243 | * @message_id: SCMI message ID |
| 244 | * @attributes: Message-specific attributes |
| 245 | * |
| 246 | * Obtain the message-specific attributes in @attributes. |
| 247 | * This command succeeds if the message is implemented and available. |
| 248 | * |
| 249 | * Return: 0 on success, error code on failure |
| 250 | */ |
| 251 | int (*protocol_message_attrs)(struct udevice *dev, u32 message_id, |
| 252 | u32 *attributes); |
| 253 | /** |
| 254 | * base_discover_vendor - get vendor name |
| 255 | * @dev: SCMI protocol device |
| 256 | * @vendor: Pointer to vendor name |
| 257 | * |
| 258 | * Obtain the vendor's name in @vendor. |
| 259 | * It is a caller's responsibility to free @vendor. |
| 260 | * |
| 261 | * Return: 0 on success, error code on failure |
| 262 | */ |
| 263 | int (*base_discover_vendor)(struct udevice *dev, u8 **vendor); |
| 264 | /** |
| 265 | * base_discover_sub_vendor - get sub-vendor name |
| 266 | * @dev: SCMI protocol device |
| 267 | * @sub_vendor: Pointer to sub-vendor name |
| 268 | * |
| 269 | * Obtain the sub-vendor's name in @sub_vendor. |
| 270 | * It is a caller's responsibility to free @sub_vendor. |
| 271 | * |
| 272 | * Return: 0 on success, error code on failure |
| 273 | */ |
| 274 | int (*base_discover_sub_vendor)(struct udevice *dev, u8 **sub_vendor); |
| 275 | /** |
| 276 | * base_discover_impl_version - get implementation version |
| 277 | * @dev: SCMI protocol device |
| 278 | * @impl_version: Pointer to implementation version |
| 279 | * |
| 280 | * Obtain the implementation version number in @impl_version. |
| 281 | * |
| 282 | * Return: 0 on success, error code on failure |
| 283 | */ |
| 284 | int (*base_discover_impl_version)(struct udevice *dev, |
| 285 | u32 *impl_version); |
| 286 | /** |
| 287 | * base_discover_list_protocols - get list of protocols |
| 288 | * @dev: SCMI protocol device |
| 289 | * @protocols: Pointer to array of SCMI protocols |
| 290 | * |
| 291 | * Obtain the list of protocols provided in @protocols. |
| 292 | * The number of elements in @protocols always match to the number of |
| 293 | * protocols returned by smci_protocol_attrs() when this function |
| 294 | * succeeds. |
| 295 | * It is a caller's responsibility to free @protocols. |
| 296 | * |
| 297 | * Return: the number of protocols in @protocols on success, |
| 298 | * error code on failure |
| 299 | */ |
| 300 | int (*base_discover_list_protocols)(struct udevice *dev, |
| 301 | u8 **protocols); |
| 302 | /** |
| 303 | * base_discover_agent - identify agent |
| 304 | * @dev: SCMI protocol device |
| 305 | * @agent_id: SCMI agent ID |
| 306 | * @ret_agent_id: Pointer to SCMI agent ID |
| 307 | * @name: Pointer to SCMI agent name |
| 308 | * |
| 309 | * Obtain the agent's name in @name. If @agent_id is equal to |
| 310 | * 0xffffffff, * this function returns the caller's agent id in |
| 311 | * @ret_agent_id. |
| 312 | * It is a caller's responsibility to free @name. |
| 313 | * |
| 314 | * Return: 0 on success, error code on failure |
| 315 | */ |
| 316 | int (*base_discover_agent)(struct udevice *dev, u32 agent_id, |
| 317 | u32 *ret_agent_id, u8 **name); |
| 318 | /** |
| 319 | * base_notify_errors - configure error notification |
| 320 | * @dev: SCMI protocol device |
| 321 | * @enable: Operation |
| 322 | * |
| 323 | * Enable or disable error notification from SCMI firmware. |
| 324 | * |
| 325 | * Return: 0 on success, error code on failure |
| 326 | */ |
| 327 | int (*base_notify_errors)(struct udevice *dev, u32 enable); |
| 328 | /** |
| 329 | * base_set_device_permissions - configure access permission to device |
| 330 | * @dev: SCMI protocol device |
| 331 | * @agent_id: SCMI agent ID |
| 332 | * @device_id: ID of device to access |
| 333 | * @flags: A set of flags |
| 334 | * |
| 335 | * Ask for allowing or denying access permission to the device, |
| 336 | * @device_id. The meaning of @flags is defined in SCMI specification. |
| 337 | * |
| 338 | * Return: 0 on success, error code on failure |
| 339 | */ |
| 340 | int (*base_set_device_permissions)(struct udevice *dev, u32 agent_id, |
| 341 | u32 device_id, u32 flags); |
| 342 | /** |
| 343 | * base_set_protocol_permissions - configure access permission to |
| 344 | * protocol on device |
| 345 | * @dev: SCMI protocol device |
| 346 | * @agent_id: SCMI agent ID |
| 347 | * @device_id: ID of device to access |
| 348 | * @command_id: command ID |
| 349 | * @flags: A set of flags |
| 350 | * |
| 351 | * Ask for allowing or denying access permission to the protocol, |
| 352 | * @command_id, on the device, @device_id. |
| 353 | * The meaning of @flags is defined in SCMI specification. |
| 354 | * |
| 355 | * Return: 0 on success, error code on failure |
| 356 | */ |
| 357 | int (*base_set_protocol_permissions)(struct udevice *dev, u32 agent_id, |
| 358 | u32 device_id, u32 command_id, |
| 359 | u32 flags); |
| 360 | /** |
| 361 | * base_reset_agent_configuration - reset resource settings |
| 362 | * @dev: SCMI protocol device |
| 363 | * @agent_id: SCMI agent ID |
| 364 | * @flags: A set of flags |
| 365 | * |
| 366 | * Reset all the resource settings against @agent_id. |
| 367 | * The meaning of @flags is defined in SCMI specification. |
| 368 | * |
| 369 | * Return: 0 on success, error code on failure |
| 370 | */ |
| 371 | int (*base_reset_agent_configuration)(struct udevice *dev, u32 agent_id, |
| 372 | u32 flags); |
| 373 | }; |
| 374 | |
| 375 | /** |
| 376 | * scmi_generic_protocol_version - get protocol version |
| 377 | * @dev: SCMI protocol device |
| 378 | * @id: SCMI protocol ID |
| 379 | * @version: Pointer to SCMI protocol version |
| 380 | * |
| 381 | * Obtain the protocol version number in @version. |
| 382 | * |
| 383 | * Return: 0 on success, error code on failure |
| 384 | */ |
| 385 | int scmi_generic_protocol_version(struct udevice *dev, |
| 386 | enum scmi_std_protocol id, u32 *version); |
| 387 | |
| 388 | /** |
| 389 | * scmi_base_protocol_version - get Base protocol version |
| 390 | * @dev: SCMI protocol device |
| 391 | * @version: Pointer to SCMI protocol version |
| 392 | * |
| 393 | * Obtain the protocol version number in @version for Base protocol. |
| 394 | * |
| 395 | * Return: 0 on success, error code on failure |
| 396 | */ |
| 397 | int scmi_base_protocol_version(struct udevice *dev, u32 *version); |
| 398 | |
| 399 | /** |
| 400 | * scmi_protocol_attrs - get protocol attributes |
| 401 | * @dev: SCMI protocol device |
| 402 | * @num_agents: Number of SCMI agents |
| 403 | * @num_protocols: Number of SCMI protocols |
| 404 | * |
| 405 | * Obtain the protocol attributes, the number of agents and the number |
| 406 | * of protocols, in @num_agents and @num_protocols respectively, that |
| 407 | * the device provides. |
| 408 | * |
| 409 | * Return: 0 on success, error code on failure |
| 410 | */ |
| 411 | int scmi_base_protocol_attrs(struct udevice *dev, u32 *num_agents, |
| 412 | u32 *num_protocols); |
| 413 | |
| 414 | /** |
| 415 | * scmi_protocol_message_attrs - get message-specific attributes |
| 416 | * @dev: SCMI protocol device |
| 417 | * @message_id: SCMI message ID |
| 418 | * @attributes: Message-specific attributes |
| 419 | * |
| 420 | * Obtain the message-specific attributes in @attributes. |
| 421 | * This command succeeds if the message is implemented and available. |
| 422 | * |
| 423 | * Return: 0 on success, error code on failure |
| 424 | */ |
| 425 | int scmi_base_protocol_message_attrs(struct udevice *dev, u32 message_id, |
| 426 | u32 *attributes); |
| 427 | |
| 428 | /** |
| 429 | * scmi_base_discover_vendor - get vendor name |
| 430 | * @dev: SCMI protocol device |
| 431 | * @vendor: Pointer to vendor name |
| 432 | * |
| 433 | * Obtain the vendor's name in @vendor. |
| 434 | * It is a caller's responsibility to free @vendor. |
| 435 | * |
| 436 | * Return: 0 on success, error code on failure |
| 437 | */ |
| 438 | int scmi_base_discover_vendor(struct udevice *dev, u8 **vendor); |
| 439 | |
| 440 | /** |
| 441 | * scmi_base_discover_sub_vendor - get sub-vendor name |
| 442 | * @dev: SCMI protocol device |
| 443 | * @sub_vendor: Pointer to sub-vendor name |
| 444 | * |
| 445 | * Obtain the sub-vendor's name in @sub_vendor. |
| 446 | * It is a caller's responsibility to free @sub_vendor. |
| 447 | * |
| 448 | * Return: 0 on success, error code on failure |
| 449 | */ |
| 450 | int scmi_base_discover_sub_vendor(struct udevice *dev, u8 **sub_vendor); |
| 451 | |
| 452 | /** |
| 453 | * scmi_base_discover_impl_version - get implementation version |
| 454 | * @dev: SCMI protocol device |
| 455 | * @impl_version: Pointer to implementation version |
| 456 | * |
| 457 | * Obtain the implementation version number in @impl_version. |
| 458 | * |
| 459 | * Return: 0 on success, error code on failure |
| 460 | */ |
| 461 | int scmi_base_discover_impl_version(struct udevice *dev, u32 *impl_version); |
| 462 | |
| 463 | /** |
| 464 | * scmi_base_discover_list_protocols - get list of protocols |
| 465 | * @dev: SCMI protocol device |
| 466 | * @protocols: Pointer to array of SCMI protocols |
| 467 | * |
| 468 | * Obtain the list of protocols provided in @protocols. |
| 469 | * The number of elements in @protocols always match to the number of |
| 470 | * protocols returned by smci_protocol_attrs() when this function succeeds. |
| 471 | * It is a caller's responsibility to free @protocols. |
| 472 | * |
| 473 | * Return: the number of protocols in @protocols on success, error code on |
| 474 | * failure |
| 475 | */ |
| 476 | int scmi_base_discover_list_protocols(struct udevice *dev, u8 **protocols); |
| 477 | |
| 478 | /** |
| 479 | * scmi_base_discover_agent - identify agent |
| 480 | * @dev: SCMI protocol device |
| 481 | * @agent_id: SCMI agent ID |
| 482 | * @ret_agent_id: Pointer to SCMI agent ID |
| 483 | * @name: Pointer to SCMI agent name |
| 484 | * |
| 485 | * Obtain the agent's name in @name. If @agent_id is equal to 0xffffffff, |
| 486 | * this function returns the caller's agent id in @ret_agent_id. |
| 487 | * It is a caller's responsibility to free @name. |
| 488 | * |
| 489 | * Return: 0 on success, error code on failure |
| 490 | */ |
| 491 | int scmi_base_discover_agent(struct udevice *dev, u32 agent_id, |
| 492 | u32 *ret_agent_id, u8 **name); |
| 493 | |
| 494 | /** |
| 495 | * scmi_base_notify_errors - configure error notification |
| 496 | * @dev: SCMI protocol device |
| 497 | * @enable: Operation |
| 498 | * |
| 499 | * Enable or disable error notification from SCMI firmware. |
| 500 | * |
| 501 | * Return: 0 on success, error code on failure |
| 502 | */ |
| 503 | int scmi_base_notify_errors(struct udevice *dev, u32 enable); |
| 504 | |
| 505 | /** |
| 506 | * scmi_base_set_device_permissions - configure access permission to device |
| 507 | * @dev: SCMI protocol device |
| 508 | * @agent_id: SCMI agent ID |
| 509 | * @device_id: ID of device to access |
| 510 | * @flags: A set of flags |
| 511 | * |
| 512 | * Ask for allowing or denying access permission to the device, @device_id. |
| 513 | * The meaning of @flags is defined in SCMI specification. |
| 514 | * |
| 515 | * Return: 0 on success, error code on failure |
| 516 | */ |
| 517 | int scmi_base_set_device_permissions(struct udevice *dev, u32 agent_id, |
| 518 | u32 device_id, u32 flags); |
| 519 | |
| 520 | /** |
| 521 | * scmi_base_set_protocol_permissions - configure access permission to |
| 522 | * protocol on device |
| 523 | * @dev: SCMI protocol device |
| 524 | * @agent_id: SCMI agent ID |
| 525 | * @device_id: ID of device to access |
| 526 | * @command_id: SCMI command ID |
| 527 | * @flags: A set of flags |
| 528 | * |
| 529 | * Ask for allowing or denying access permission to the protocol, @command_id, |
| 530 | * on the device, @device_id. |
| 531 | * The meaning of @flags is defined in SCMI specification. |
| 532 | * |
| 533 | * Return: 0 on success, error code on failure |
| 534 | */ |
| 535 | int scmi_base_set_protocol_permissions(struct udevice *dev, |
| 536 | u32 agent_id, u32 device_id, |
| 537 | u32 command_id, u32 flags); |
| 538 | |
| 539 | /** |
| 540 | * scmi_base_reset_agent_configuration - reset resource settings |
| 541 | * @dev: SCMI protocol device |
| 542 | * @agent_id: SCMI agent ID |
| 543 | * @flags: A set of flags |
| 544 | * |
| 545 | * Reset all the resource settings against @agent_id. |
| 546 | * The meaning of @flags is defined in SCMI specification. |
| 547 | * |
| 548 | * Return: 0 on success, error code on failure |
| 549 | */ |
| 550 | int scmi_base_reset_agent_configuration(struct udevice *dev, u32 agent_id, |
| 551 | u32 flags); |
| 552 | |
| 553 | /* |
AKASHI Takahiro | 8f00d02 | 2023-10-16 14:39:43 +0900 | [diff] [blame] | 554 | * SCMI Power Domain Management Protocol |
| 555 | */ |
| 556 | |
| 557 | #define SCMI_PWD_PROTOCOL_VERSION 0x30000 |
| 558 | #define SCMI_PWD_PSTATE_TYPE_LOST BIT(30) |
| 559 | #define SCMI_PWD_PSTATE_ID GENMASK(27, 0) |
| 560 | |
| 561 | enum scmi_power_domain_message_id { |
| 562 | SCMI_PWD_ATTRIBUTES = 0x3, |
| 563 | SCMI_PWD_STATE_SET = 0x4, |
| 564 | SCMI_PWD_STATE_GET = 0x5, |
| 565 | SCMI_PWD_STATE_NOTIFY = 0x6, |
| 566 | SCMI_PWD_STATE_CHANGE_REQUESTED_NOTIFY = 0x7, |
| 567 | SCMI_PWD_NAME_GET = 0x8, |
| 568 | }; |
| 569 | |
| 570 | /** |
| 571 | * struct scmi_pwd_protocol_attrs_out |
| 572 | * @status: SCMI command status |
| 573 | * @attributes: Protocol attributes |
| 574 | * @stats_addr_low: Lower 32 bits of address of statistics memory region |
| 575 | * @stats_addr_high: Higher 32 bits of address of statistics memory region |
| 576 | * @stats_len: Length of statistics memory region |
| 577 | */ |
| 578 | struct scmi_pwd_protocol_attrs_out { |
| 579 | s32 status; |
| 580 | u32 attributes; |
| 581 | u32 stats_addr_low; |
| 582 | u32 stats_addr_high; |
| 583 | u32 stats_len; |
| 584 | }; |
| 585 | |
| 586 | #define SCMI_PWD_PROTO_ATTRS_NUM_PWD(attributes) ((attributes) & GENMASK(15, 0)) |
| 587 | |
| 588 | /** |
| 589 | * struct scmi_pwd_protocol_msg_attrs_out |
| 590 | * @status: SCMI command status |
| 591 | * @attributes: Message-specific attributes |
| 592 | */ |
| 593 | struct scmi_pwd_protocol_msg_attrs_out { |
| 594 | s32 status; |
| 595 | u32 attributes; |
| 596 | }; |
| 597 | |
| 598 | #define SCMI_PWD_NAME_LENGTH_MAX 16 |
| 599 | |
| 600 | /** |
| 601 | * struct scmi_pwd_attrs_out |
| 602 | * @status: SCMI command status |
| 603 | * @attributes: Power domain attributes |
| 604 | * @name: Name of power domain |
| 605 | */ |
| 606 | struct scmi_pwd_attrs_out { |
| 607 | s32 status; |
| 608 | u32 attributes; |
| 609 | u8 name[SCMI_PWD_NAME_LENGTH_MAX]; |
| 610 | }; |
| 611 | |
| 612 | #define SCMI_PWD_ATTR_PSTATE_CHANGE_NOTIFY BIT(31) |
| 613 | #define SCMI_PWD_ATTR_PSTATE_ASYNC BIT(30) |
| 614 | #define SCMI_PWD_ATTR_PSTATE_SYNC BIT(29) |
| 615 | #define SCMI_PWD_ATTR_PSTATE_CHANGE_RQ_NOTIFY BIT(28) |
| 616 | #define SCMI_PWD_ATTR_EXTENDED_NAME BIT(27) |
| 617 | |
| 618 | /** |
| 619 | * struct scmi_pwd_state_set_in |
| 620 | * @flags: Flags |
| 621 | * @domain_id: Identifier of power domain |
| 622 | * @pstate: Power state of the domain |
| 623 | */ |
| 624 | struct scmi_pwd_state_set_in { |
| 625 | u32 flags; |
| 626 | u32 domain_id; |
| 627 | u32 pstate; |
| 628 | }; |
| 629 | |
| 630 | #define SCMI_PWD_SET_FLAGS_ASYNC BIT(0) |
| 631 | |
| 632 | /** |
| 633 | * struct scmi_pwd_state_get_out |
| 634 | * @status: SCMI command status |
| 635 | * @pstate: Power state of the domain |
| 636 | */ |
| 637 | struct scmi_pwd_state_get_out { |
| 638 | s32 status; |
| 639 | u32 pstate; |
| 640 | }; |
| 641 | |
| 642 | #define SCMI_PWD_EXTENDED_NAME_MAX 64 |
| 643 | /** |
| 644 | * struct scmi_pwd_name_get_out |
| 645 | * @status: SCMI command status |
| 646 | * @flags: Parameter flags |
| 647 | * @extended_name: Extended name of power domain |
| 648 | */ |
| 649 | struct scmi_pwd_name_get_out { |
| 650 | s32 status; |
| 651 | u32 flags; |
| 652 | u8 extended_name[SCMI_PWD_EXTENDED_NAME_MAX]; |
| 653 | }; |
| 654 | |
| 655 | /** |
| 656 | * scmi_pwd_protocol_attrs - get protocol attributes |
| 657 | * @dev: SCMI protocol device |
| 658 | * @num_pwdoms: Number of power domains |
| 659 | * @stats_addr: Address of statistics memory region |
| 660 | * @stats_len: Length of statistics memory region |
| 661 | * |
| 662 | * Obtain the protocol attributes, the number of power domains and |
| 663 | * the information of statistics memory region. |
| 664 | * |
| 665 | * Return: 0 on success, error code on failure |
| 666 | */ |
| 667 | int scmi_pwd_protocol_attrs(struct udevice *dev, int *num_pwdoms, |
| 668 | u64 *stats_addr, size_t *stats_len); |
| 669 | /** |
| 670 | * scmi_pwd_protocol_message_attrs - get message-specific attributes |
| 671 | * @dev: SCMI protocol device |
| 672 | * @message_id: SCMI message ID |
| 673 | * @attributes: Message-specific attributes |
| 674 | * |
| 675 | * Obtain the message-specific attributes in @attributes. |
| 676 | * |
| 677 | * Return: 0 on success, error code on failure |
| 678 | */ |
| 679 | int scmi_pwd_protocol_message_attrs(struct udevice *dev, s32 message_id, |
| 680 | u32 *attributes); |
| 681 | /** |
| 682 | * scmi_pwd_attrs - get power domain attributes |
| 683 | * @dev: SCMI protocol device |
| 684 | * @domain_id: Identifier of power domain |
| 685 | * @attributes: Power domain attributes |
| 686 | * @name: Name of power domain |
| 687 | * |
| 688 | * Obtain the attributes of the given power domain, @domain_id, in @attributes |
| 689 | * as well as its name in @name. |
| 690 | * |
| 691 | * Return: 0 on success, error code on failure |
| 692 | */ |
| 693 | int scmi_pwd_attrs(struct udevice *dev, u32 message_id, u32 *attributes, |
| 694 | u8 **name); |
| 695 | /** |
| 696 | * scmi_pwd_state_set - set power state |
| 697 | * @dev: SCMI protocol device |
| 698 | * @flags: Parameter flags |
| 699 | * @domain_id: Identifier of power domain |
| 700 | * @pstate: Power state |
| 701 | * |
| 702 | * Change the power state of the given power domain, @domain_id. |
| 703 | * |
| 704 | * Return: 0 on success, error code on failure |
| 705 | */ |
| 706 | int scmi_pwd_state_set(struct udevice *dev, u32 flags, u32 domain_id, |
| 707 | u32 pstate); |
| 708 | /** |
| 709 | * scmi_pwd_state_get - get power state |
| 710 | * @dev: SCMI protocol device |
| 711 | * @domain_id: Identifier of power domain |
| 712 | * @pstate: Power state |
| 713 | * |
| 714 | * Obtain the power state of the given power domain, @domain_id. |
| 715 | * |
| 716 | * Return: 0 on success, error code on failure |
| 717 | */ |
| 718 | int scmi_pwd_state_get(struct udevice *dev, u32 domain_id, u32 *pstate); |
| 719 | /** |
| 720 | * scmi_pwd_name_get - get extended name |
| 721 | * @dev: SCMI protocol device |
| 722 | * @domain_id: Identifier of power domain |
| 723 | * @name: Extended name of the domain |
| 724 | * |
| 725 | * Obtain the extended name of the given power domain, @domain_id, in @name. |
| 726 | * |
| 727 | * Return: 0 on success, error code on failure |
| 728 | */ |
| 729 | int scmi_pwd_name_get(struct udevice *dev, u32 domain_id, u8 **name); |
| 730 | |
| 731 | /* |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 732 | * SCMI Clock Protocol |
| 733 | */ |
Alice Guo | 26d0ed0 | 2025-04-28 18:37:31 +0800 | [diff] [blame] | 734 | #define CLOCK_PROTOCOL_VERSION_3_0 0x30000 |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 735 | |
| 736 | enum scmi_clock_message_id { |
Etienne Carriere | 4c4ec90 | 2022-02-21 09:22:42 +0100 | [diff] [blame] | 737 | SCMI_CLOCK_ATTRIBUTES = 0x3, |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 738 | SCMI_CLOCK_RATE_SET = 0x5, |
| 739 | SCMI_CLOCK_RATE_GET = 0x6, |
| 740 | SCMI_CLOCK_CONFIG_SET = 0x7, |
Peng Fan | 3b5eaad | 2025-04-28 18:37:30 +0800 | [diff] [blame] | 741 | SCMI_CLOCK_PARENT_SET = 0xD, |
Alice Guo | 26d0ed0 | 2025-04-28 18:37:31 +0800 | [diff] [blame] | 742 | SCMI_CLOCK_GET_PERMISSIONS = 0xF, |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 743 | }; |
| 744 | |
Etienne Carriere | 4c4ec90 | 2022-02-21 09:22:42 +0100 | [diff] [blame] | 745 | #define SCMI_CLK_PROTO_ATTR_COUNT_MASK GENMASK(15, 0) |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 746 | #define SCMI_CLK_RATE_ASYNC_NOTIFY BIT(0) |
| 747 | #define SCMI_CLK_RATE_ASYNC_NORESP (BIT(0) | BIT(1)) |
| 748 | #define SCMI_CLK_RATE_ROUND_DOWN 0 |
| 749 | #define SCMI_CLK_RATE_ROUND_UP BIT(2) |
| 750 | #define SCMI_CLK_RATE_ROUND_CLOSEST BIT(3) |
| 751 | |
Etienne Carriere | 4c4ec90 | 2022-02-21 09:22:42 +0100 | [diff] [blame] | 752 | #define SCMI_CLOCK_NAME_LENGTH_MAX 16 |
| 753 | |
| 754 | /** |
| 755 | * struct scmi_clk_get_nb_out - Response for SCMI_PROTOCOL_ATTRIBUTES command |
| 756 | * @status: SCMI command status |
| 757 | * @attributes: Attributes of the clock protocol, mainly number of clocks exposed |
| 758 | */ |
| 759 | struct scmi_clk_protocol_attr_out { |
| 760 | s32 status; |
| 761 | u32 attributes; |
| 762 | }; |
| 763 | |
| 764 | /** |
| 765 | * struct scmi_clk_attribute_in - Message payload for SCMI_CLOCK_ATTRIBUTES command |
| 766 | * @clock_id: SCMI clock ID |
| 767 | */ |
| 768 | struct scmi_clk_attribute_in { |
| 769 | u32 clock_id; |
| 770 | }; |
| 771 | |
| 772 | /** |
| 773 | * struct scmi_clk_get_nb_out - Response payload for SCMI_CLOCK_ATTRIBUTES command |
| 774 | * @status: SCMI command status |
| 775 | * @attributes: clock attributes |
| 776 | * @clock_name: name of the clock |
| 777 | */ |
| 778 | struct scmi_clk_attribute_out { |
| 779 | s32 status; |
| 780 | u32 attributes; |
Alice Guo | 26d0ed0 | 2025-04-28 18:37:31 +0800 | [diff] [blame] | 781 | #define CLK_HAS_RESTRICTIONS(x) ((x) & BIT(1)) |
Etienne Carriere | 4c4ec90 | 2022-02-21 09:22:42 +0100 | [diff] [blame] | 782 | char clock_name[SCMI_CLOCK_NAME_LENGTH_MAX]; |
| 783 | }; |
| 784 | |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 785 | /** |
| 786 | * struct scmi_clk_state_in - Message payload for CLOCK_CONFIG_SET command |
| 787 | * @clock_id: SCMI clock ID |
| 788 | * @attributes: Attributes of the targets clock state |
| 789 | */ |
| 790 | struct scmi_clk_state_in { |
| 791 | u32 clock_id; |
| 792 | u32 attributes; |
| 793 | }; |
| 794 | |
| 795 | /** |
| 796 | * struct scmi_clk_state_out - Response payload for CLOCK_CONFIG_SET command |
| 797 | * @status: SCMI command status |
| 798 | */ |
| 799 | struct scmi_clk_state_out { |
| 800 | s32 status; |
| 801 | }; |
| 802 | |
| 803 | /** |
| 804 | * struct scmi_clk_state_in - Message payload for CLOCK_RATE_GET command |
| 805 | * @clock_id: SCMI clock ID |
| 806 | * @attributes: Attributes of the targets clock state |
| 807 | */ |
| 808 | struct scmi_clk_rate_get_in { |
| 809 | u32 clock_id; |
| 810 | }; |
| 811 | |
| 812 | /** |
| 813 | * struct scmi_clk_rate_get_out - Response payload for CLOCK_RATE_GET command |
| 814 | * @status: SCMI command status |
| 815 | * @rate_lsb: 32bit LSB of the clock rate in Hertz |
| 816 | * @rate_msb: 32bit MSB of the clock rate in Hertz |
| 817 | */ |
| 818 | struct scmi_clk_rate_get_out { |
| 819 | s32 status; |
| 820 | u32 rate_lsb; |
| 821 | u32 rate_msb; |
| 822 | }; |
| 823 | |
| 824 | /** |
| 825 | * struct scmi_clk_state_in - Message payload for CLOCK_RATE_SET command |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 826 | * @flags: Flags for the clock rate set request |
Clément Léger | d5e3abb | 2021-10-13 16:00:04 +0200 | [diff] [blame] | 827 | * @clock_id: SCMI clock ID |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 828 | * @rate_lsb: 32bit LSB of the clock rate in Hertz |
| 829 | * @rate_msb: 32bit MSB of the clock rate in Hertz |
| 830 | */ |
| 831 | struct scmi_clk_rate_set_in { |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 832 | u32 flags; |
Clément Léger | d5e3abb | 2021-10-13 16:00:04 +0200 | [diff] [blame] | 833 | u32 clock_id; |
Etienne Carriere | 78928e1 | 2020-09-09 18:44:04 +0200 | [diff] [blame] | 834 | u32 rate_lsb; |
| 835 | u32 rate_msb; |
| 836 | }; |
| 837 | |
| 838 | /** |
| 839 | * struct scmi_clk_rate_set_out - Response payload for CLOCK_RATE_SET command |
| 840 | * @status: SCMI command status |
| 841 | */ |
| 842 | struct scmi_clk_rate_set_out { |
| 843 | s32 status; |
| 844 | }; |
| 845 | |
Peng Fan | 3b5eaad | 2025-04-28 18:37:30 +0800 | [diff] [blame] | 846 | /** |
| 847 | * struct scmi_clk_parent_state_in - Message payload for CLOCK_PARENT_SET command |
| 848 | * @clock_id: SCMI clock ID |
| 849 | * @parent_clk: SCMI clock ID |
| 850 | */ |
| 851 | struct scmi_clk_parent_set_in { |
| 852 | u32 clock_id; |
| 853 | u32 parent_clk; |
| 854 | }; |
| 855 | |
| 856 | /** |
| 857 | * struct scmi_clk_parent_set_out - Response payload for CLOCK_PARENT_SET command |
| 858 | * @status: SCMI command status |
| 859 | */ |
| 860 | struct scmi_clk_parent_set_out { |
| 861 | s32 status; |
| 862 | }; |
| 863 | |
Alice Guo | 26d0ed0 | 2025-04-28 18:37:31 +0800 | [diff] [blame] | 864 | /** |
| 865 | * @clock_id: Identifier for the clock device. |
| 866 | */ |
| 867 | struct scmi_clk_get_permissions_in { |
| 868 | u32 clock_id; |
| 869 | }; |
| 870 | |
| 871 | /** |
| 872 | * @status: Negative 32-bit integers are used to return error status codes. |
| 873 | * @permissions: Bit[31] Clock state control, Bit[30] Clock parent control, |
| 874 | * Bit[29] Clock rate control, Bits[28:0] Reserved, must be zero. |
| 875 | */ |
| 876 | struct scmi_clk_get_permissions_out { |
| 877 | s32 status; |
| 878 | u32 permissions; |
| 879 | }; |
| 880 | |
| 881 | #define SUPPORT_CLK_STAT_CONTROL BIT(31) |
| 882 | #define SUPPORT_CLK_PARENT_CONTROL BIT(30) |
| 883 | #define SUPPORT_CLK_RATE_CONTROL BIT(29) |
| 884 | |
Etienne Carriere | c6e9af3 | 2020-09-09 18:44:06 +0200 | [diff] [blame] | 885 | /* |
| 886 | * SCMI Reset Domain Protocol |
| 887 | */ |
| 888 | |
| 889 | enum scmi_reset_domain_message_id { |
| 890 | SCMI_RESET_DOMAIN_ATTRIBUTES = 0x3, |
| 891 | SCMI_RESET_DOMAIN_RESET = 0x4, |
| 892 | }; |
| 893 | |
| 894 | #define SCMI_RD_NAME_LEN 16 |
| 895 | |
| 896 | #define SCMI_RD_ATTRIBUTES_FLAG_ASYNC BIT(31) |
| 897 | #define SCMI_RD_ATTRIBUTES_FLAG_NOTIF BIT(30) |
| 898 | |
| 899 | #define SCMI_RD_RESET_FLAG_ASYNC BIT(2) |
| 900 | #define SCMI_RD_RESET_FLAG_ASSERT BIT(1) |
| 901 | #define SCMI_RD_RESET_FLAG_CYCLE BIT(0) |
| 902 | |
| 903 | /** |
| 904 | * struct scmi_rd_attr_in - Payload for RESET_DOMAIN_ATTRIBUTES message |
| 905 | * @domain_id: SCMI reset domain ID |
| 906 | */ |
| 907 | struct scmi_rd_attr_in { |
| 908 | u32 domain_id; |
| 909 | }; |
| 910 | |
| 911 | /** |
| 912 | * struct scmi_rd_attr_out - Payload for RESET_DOMAIN_ATTRIBUTES response |
| 913 | * @status: SCMI command status |
| 914 | * @attributes: Retrieved attributes of the reset domain |
| 915 | * @latency: Reset cycle max lantency |
| 916 | * @name: Reset domain name |
| 917 | */ |
| 918 | struct scmi_rd_attr_out { |
| 919 | s32 status; |
| 920 | u32 attributes; |
| 921 | u32 latency; |
| 922 | char name[SCMI_RD_NAME_LEN]; |
| 923 | }; |
| 924 | |
| 925 | /** |
| 926 | * struct scmi_rd_reset_in - Message payload for RESET command |
| 927 | * @domain_id: SCMI reset domain ID |
| 928 | * @flags: Flags for the reset request |
| 929 | * @reset_state: Reset target state |
| 930 | */ |
| 931 | struct scmi_rd_reset_in { |
| 932 | u32 domain_id; |
| 933 | u32 flags; |
| 934 | u32 reset_state; |
| 935 | }; |
| 936 | |
| 937 | /** |
| 938 | * struct scmi_rd_reset_out - Response payload for RESET command |
| 939 | * @status: SCMI command status |
| 940 | */ |
| 941 | struct scmi_rd_reset_out { |
| 942 | s32 status; |
| 943 | }; |
| 944 | |
Etienne Carriere | d68663a | 2021-03-08 22:38:06 +0100 | [diff] [blame] | 945 | /* |
| 946 | * SCMI Voltage Domain Protocol |
| 947 | */ |
| 948 | |
| 949 | enum scmi_voltage_domain_message_id { |
| 950 | SCMI_VOLTAGE_DOMAIN_ATTRIBUTES = 0x3, |
| 951 | SCMI_VOLTAGE_DOMAIN_CONFIG_SET = 0x5, |
| 952 | SCMI_VOLTAGE_DOMAIN_CONFIG_GET = 0x6, |
| 953 | SCMI_VOLTAGE_DOMAIN_LEVEL_SET = 0x7, |
| 954 | SCMI_VOLTAGE_DOMAIN_LEVEL_GET = 0x8, |
| 955 | }; |
| 956 | |
| 957 | #define SCMI_VOLTD_NAME_LEN 16 |
| 958 | |
| 959 | #define SCMI_VOLTD_CONFIG_MASK GENMASK(3, 0) |
| 960 | #define SCMI_VOLTD_CONFIG_OFF 0 |
| 961 | #define SCMI_VOLTD_CONFIG_ON 0x7 |
| 962 | |
| 963 | /** |
| 964 | * struct scmi_voltd_attr_in - Payload for VOLTAGE_DOMAIN_ATTRIBUTES message |
| 965 | * @domain_id: SCMI voltage domain ID |
| 966 | */ |
| 967 | struct scmi_voltd_attr_in { |
| 968 | u32 domain_id; |
| 969 | }; |
| 970 | |
| 971 | /** |
| 972 | * struct scmi_voltd_attr_out - Payload for VOLTAGE_DOMAIN_ATTRIBUTES response |
| 973 | * @status: SCMI command status |
| 974 | * @attributes: Retrieved attributes of the voltage domain |
| 975 | * @name: Voltage domain name |
| 976 | */ |
| 977 | struct scmi_voltd_attr_out { |
| 978 | s32 status; |
| 979 | u32 attributes; |
| 980 | char name[SCMI_VOLTD_NAME_LEN]; |
| 981 | }; |
| 982 | |
| 983 | /** |
| 984 | * struct scmi_voltd_config_set_in - Message payload for VOLTAGE_CONFIG_SET cmd |
| 985 | * @domain_id: SCMI voltage domain ID |
| 986 | * @config: Configuration data of the voltage domain |
| 987 | */ |
| 988 | struct scmi_voltd_config_set_in { |
| 989 | u32 domain_id; |
| 990 | u32 config; |
| 991 | }; |
| 992 | |
| 993 | /** |
| 994 | * struct scmi_voltd_config_set_out - Response for VOLTAGE_CONFIG_SET command |
| 995 | * @status: SCMI command status |
| 996 | */ |
| 997 | struct scmi_voltd_config_set_out { |
| 998 | s32 status; |
| 999 | }; |
| 1000 | |
| 1001 | /** |
| 1002 | * struct scmi_voltd_config_get_in - Message payload for VOLTAGE_CONFIG_GET cmd |
| 1003 | * @domain_id: SCMI voltage domain ID |
| 1004 | */ |
| 1005 | struct scmi_voltd_config_get_in { |
| 1006 | u32 domain_id; |
| 1007 | }; |
| 1008 | |
| 1009 | /** |
| 1010 | * struct scmi_voltd_config_get_out - Response for VOLTAGE_CONFIG_GET command |
| 1011 | * @status: SCMI command status |
| 1012 | * @config: Configuration data of the voltage domain |
| 1013 | */ |
| 1014 | struct scmi_voltd_config_get_out { |
| 1015 | s32 status; |
| 1016 | u32 config; |
| 1017 | }; |
| 1018 | |
| 1019 | /** |
| 1020 | * struct scmi_voltd_level_set_in - Message payload for VOLTAGE_LEVEL_SET cmd |
| 1021 | * @domain_id: SCMI voltage domain ID |
| 1022 | * @flags: Parameter flags for configuring target level |
| 1023 | * @voltage_level: Target voltage level in microvolts (uV) |
| 1024 | */ |
| 1025 | struct scmi_voltd_level_set_in { |
| 1026 | u32 domain_id; |
| 1027 | u32 flags; |
| 1028 | s32 voltage_level; |
| 1029 | }; |
| 1030 | |
| 1031 | /** |
| 1032 | * struct scmi_voltd_level_set_out - Response for VOLTAGE_LEVEL_SET command |
| 1033 | * @status: SCMI command status |
| 1034 | */ |
| 1035 | struct scmi_voltd_level_set_out { |
| 1036 | s32 status; |
| 1037 | }; |
| 1038 | |
| 1039 | /** |
| 1040 | * struct scmi_voltd_level_get_in - Message payload for VOLTAGE_LEVEL_GET cmd |
| 1041 | * @domain_id: SCMI voltage domain ID |
| 1042 | */ |
| 1043 | struct scmi_voltd_level_get_in { |
| 1044 | u32 domain_id; |
| 1045 | }; |
| 1046 | |
| 1047 | /** |
| 1048 | * struct scmi_voltd_level_get_out - Response for VOLTAGE_LEVEL_GET command |
| 1049 | * @status: SCMI command status |
| 1050 | * @voltage_level: Voltage level in microvolts (uV) |
| 1051 | */ |
| 1052 | struct scmi_voltd_level_get_out { |
| 1053 | s32 status; |
| 1054 | s32 voltage_level; |
| 1055 | }; |
| 1056 | |
Alice Guo | aeb0319 | 2025-04-28 18:37:26 +0800 | [diff] [blame] | 1057 | /* SCMI Pinctrl Protocol */ |
| 1058 | enum scmi_pinctrl_message_id { |
| 1059 | SCMI_MSG_PINCTRL_CONFIG_SET = 0x6 |
| 1060 | }; |
| 1061 | |
| 1062 | struct scmi_pin_config { |
| 1063 | u32 type; |
| 1064 | u32 val; |
| 1065 | }; |
| 1066 | |
| 1067 | /** |
| 1068 | * struct scmi_pad_config_set_in - Message payload for PAD_CONFIG_SET command |
| 1069 | * @identifier: Identifier for the pin or group. |
| 1070 | * @function_id: Identifier for the function selected to be enabled |
| 1071 | * for the selected pin or group. This field is set to |
| 1072 | * 0xFFFFFFFF if no function should be enabled by the |
| 1073 | * pin or group. |
| 1074 | * @attributes: Bits[31:11] Reserved, must be zero. |
| 1075 | * Bit[10] Function valid. |
| 1076 | * Bits[9:2] Number of configurations to set. |
| 1077 | * Bits[1:0] Selector: Whether the identifier field |
| 1078 | * refers to a pin or a group. |
| 1079 | * @configs: Array of configurations. |
| 1080 | */ |
| 1081 | struct scmi_pinctrl_config_set_in { |
| 1082 | u32 identifier; |
| 1083 | u32 function_id; |
| 1084 | u32 attributes; |
| 1085 | struct scmi_pin_config configs[4]; |
| 1086 | }; |
| 1087 | |
| 1088 | struct scmi_pinctrl_config_set_out { |
| 1089 | s32 status; |
| 1090 | }; |
| 1091 | |
Peng Fan | 06f837a | 2025-04-28 18:37:29 +0800 | [diff] [blame] | 1092 | /* SCMI Perf Protocol */ |
| 1093 | enum scmi_perf_message_id { |
| 1094 | SCMI_PERF_DOMAIN_ATTRIBUTES = 0x3, |
| 1095 | SCMI_PERF_DESCRIBE_LEVELS = 0x4, |
| 1096 | SCMI_PERF_LIMITS_SET = 0x5, |
| 1097 | SCMI_PERF_LIMITS_GET = 0x6, |
| 1098 | SCMI_PERF_LEVEL_SET = 0x7, |
| 1099 | SCMI_PERF_LEVEL_GET = 0x8 |
| 1100 | }; |
| 1101 | |
| 1102 | struct scmi_perf_in { |
| 1103 | u32 domain_id; |
| 1104 | u32 perf_level; |
| 1105 | }; |
| 1106 | |
| 1107 | struct scmi_perf_out { |
| 1108 | s32 status; |
| 1109 | }; |
Etienne Carriere | 02fd126 | 2020-09-09 18:44:00 +0200 | [diff] [blame] | 1110 | #endif /* _SCMI_PROTOCOLS_H */ |