diff options
| -rw-r--r-- | drivers/firmware/xilinx/zynqmp.c | 58 | ||||
| -rw-r--r-- | include/linux/firmware/xlnx-zynqmp.h | 26 |
2 files changed, 84 insertions, 0 deletions
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 765a2ca1b100..af5cffd3ac43 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c | |||
| @@ -557,6 +557,61 @@ static int zynqmp_pm_set_suspend_mode(u32 mode) | |||
| 557 | return zynqmp_pm_invoke_fn(PM_SET_SUSPEND_MODE, mode, 0, 0, 0, NULL); | 557 | return zynqmp_pm_invoke_fn(PM_SET_SUSPEND_MODE, mode, 0, 0, 0, NULL); |
| 558 | } | 558 | } |
| 559 | 559 | ||
| 560 | /** | ||
| 561 | * zynqmp_pm_request_node() - Request a node with specific capabilities | ||
| 562 | * @node: Node ID of the slave | ||
| 563 | * @capabilities: Requested capabilities of the slave | ||
| 564 | * @qos: Quality of service (not supported) | ||
| 565 | * @ack: Flag to specify whether acknowledge is requested | ||
| 566 | * | ||
| 567 | * This function is used by master to request particular node from firmware. | ||
| 568 | * Every master must request node before using it. | ||
| 569 | * | ||
| 570 | * Return: Returns status, either success or error+reason | ||
| 571 | */ | ||
| 572 | static int zynqmp_pm_request_node(const u32 node, const u32 capabilities, | ||
| 573 | const u32 qos, | ||
| 574 | const enum zynqmp_pm_request_ack ack) | ||
| 575 | { | ||
| 576 | return zynqmp_pm_invoke_fn(PM_REQUEST_NODE, node, capabilities, | ||
| 577 | qos, ack, NULL); | ||
| 578 | } | ||
| 579 | |||
| 580 | /** | ||
| 581 | * zynqmp_pm_release_node() - Release a node | ||
| 582 | * @node: Node ID of the slave | ||
| 583 | * | ||
| 584 | * This function is used by master to inform firmware that master | ||
| 585 | * has released node. Once released, master must not use that node | ||
| 586 | * without re-request. | ||
| 587 | * | ||
| 588 | * Return: Returns status, either success or error+reason | ||
| 589 | */ | ||
| 590 | static int zynqmp_pm_release_node(const u32 node) | ||
| 591 | { | ||
| 592 | return zynqmp_pm_invoke_fn(PM_RELEASE_NODE, node, 0, 0, 0, NULL); | ||
| 593 | } | ||
| 594 | |||
| 595 | /** | ||
| 596 | * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves | ||
| 597 | * @node: Node ID of the slave | ||
| 598 | * @capabilities: Requested capabilities of the slave | ||
| 599 | * @qos: Quality of service (not supported) | ||
| 600 | * @ack: Flag to specify whether acknowledge is requested | ||
| 601 | * | ||
| 602 | * This API function is to be used for slaves a PU already has requested | ||
| 603 | * to change its capabilities. | ||
| 604 | * | ||
| 605 | * Return: Returns status, either success or error+reason | ||
| 606 | */ | ||
| 607 | static int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, | ||
| 608 | const u32 qos, | ||
| 609 | const enum zynqmp_pm_request_ack ack) | ||
| 610 | { | ||
| 611 | return zynqmp_pm_invoke_fn(PM_SET_REQUIREMENT, node, capabilities, | ||
| 612 | qos, ack, NULL); | ||
| 613 | } | ||
| 614 | |||
| 560 | static const struct zynqmp_eemi_ops eemi_ops = { | 615 | static const struct zynqmp_eemi_ops eemi_ops = { |
| 561 | .get_api_version = zynqmp_pm_get_api_version, | 616 | .get_api_version = zynqmp_pm_get_api_version, |
| 562 | .get_chipid = zynqmp_pm_get_chipid, | 617 | .get_chipid = zynqmp_pm_get_chipid, |
| @@ -575,6 +630,9 @@ static const struct zynqmp_eemi_ops eemi_ops = { | |||
| 575 | .reset_get_status = zynqmp_pm_reset_get_status, | 630 | .reset_get_status = zynqmp_pm_reset_get_status, |
| 576 | .init_finalize = zynqmp_pm_init_finalize, | 631 | .init_finalize = zynqmp_pm_init_finalize, |
| 577 | .set_suspend_mode = zynqmp_pm_set_suspend_mode, | 632 | .set_suspend_mode = zynqmp_pm_set_suspend_mode, |
| 633 | .request_node = zynqmp_pm_request_node, | ||
| 634 | .release_node = zynqmp_pm_release_node, | ||
| 635 | .set_requirement = zynqmp_pm_set_requirement, | ||
| 578 | }; | 636 | }; |
| 579 | 637 | ||
| 580 | /** | 638 | /** |
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 56b2108a2148..642dab10f65d 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h | |||
| @@ -40,8 +40,19 @@ | |||
| 40 | /* Payload size (consists of callback API ID + arguments) */ | 40 | /* Payload size (consists of callback API ID + arguments) */ |
| 41 | #define CB_PAYLOAD_SIZE (CB_ARG_CNT + 1) | 41 | #define CB_PAYLOAD_SIZE (CB_ARG_CNT + 1) |
| 42 | 42 | ||
| 43 | #define ZYNQMP_PM_MAX_QOS 100U | ||
| 44 | |||
| 45 | /* Node capabilities */ | ||
| 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U | ||
| 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U | ||
| 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U | ||
| 49 | #define ZYNQMP_PM_CAPABILITY_POWER 0x8U | ||
| 50 | |||
| 43 | enum pm_api_id { | 51 | enum pm_api_id { |
| 44 | PM_GET_API_VERSION = 1, | 52 | PM_GET_API_VERSION = 1, |
| 53 | PM_REQUEST_NODE = 13, | ||
| 54 | PM_RELEASE_NODE, | ||
| 55 | PM_SET_REQUIREMENT, | ||
| 45 | PM_RESET_ASSERT = 17, | 56 | PM_RESET_ASSERT = 17, |
| 46 | PM_RESET_GET_STATUS, | 57 | PM_RESET_GET_STATUS, |
| 47 | PM_PM_INIT_FINALIZE = 21, | 58 | PM_PM_INIT_FINALIZE = 21, |
| @@ -224,6 +235,12 @@ enum zynqmp_pm_suspend_reason { | |||
| 224 | SUSPEND_SYSTEM_SHUTDOWN, | 235 | SUSPEND_SYSTEM_SHUTDOWN, |
| 225 | }; | 236 | }; |
| 226 | 237 | ||
| 238 | enum zynqmp_pm_request_ack { | ||
| 239 | ZYNQMP_PM_REQUEST_ACK_NO = 1, | ||
| 240 | ZYNQMP_PM_REQUEST_ACK_BLOCKING, | ||
| 241 | ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING, | ||
| 242 | }; | ||
| 243 | |||
| 227 | /** | 244 | /** |
| 228 | * struct zynqmp_pm_query_data - PM query data | 245 | * struct zynqmp_pm_query_data - PM query data |
| 229 | * @qid: query ID | 246 | * @qid: query ID |
| @@ -257,6 +274,15 @@ struct zynqmp_eemi_ops { | |||
| 257 | int (*reset_get_status)(const enum zynqmp_pm_reset reset, u32 *status); | 274 | int (*reset_get_status)(const enum zynqmp_pm_reset reset, u32 *status); |
| 258 | int (*init_finalize)(void); | 275 | int (*init_finalize)(void); |
| 259 | int (*set_suspend_mode)(u32 mode); | 276 | int (*set_suspend_mode)(u32 mode); |
| 277 | int (*request_node)(const u32 node, | ||
| 278 | const u32 capabilities, | ||
| 279 | const u32 qos, | ||
| 280 | const enum zynqmp_pm_request_ack ack); | ||
| 281 | int (*release_node)(const u32 node); | ||
| 282 | int (*set_requirement)(const u32 node, | ||
| 283 | const u32 capabilities, | ||
| 284 | const u32 qos, | ||
| 285 | const enum zynqmp_pm_request_ack ack); | ||
| 260 | }; | 286 | }; |
| 261 | 287 | ||
| 262 | int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, | 288 | int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, |
