xilinx: versal: Implement device related PM APIs
Implement below device related PM APIs: - Request device - Release device - Set requirement - Get device status Signed-off-by: Tejas Patel <tejas.patel@xilinx.com> Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Change-Id: I9d84b9ee1be3ee6c5f27a4d6dc324113fc1acb68
This commit is contained in:
parent
fbb32695a2
commit
cf1e56a4e7
|
@ -158,3 +158,80 @@ enum pm_ret_status pm_req_suspend(uint32_t target, uint8_t ack,
|
|||
else
|
||||
return pm_ipi_send(primary_proc, payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_request_device() - Request a device
|
||||
* @device_id Device ID
|
||||
* @capabilities Requested capabilities for the device
|
||||
* @qos Required Quality of Service
|
||||
* @ack Flag to specify whether acknowledge requested
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_request_device(uint32_t device_id, uint32_t capabilities,
|
||||
uint32_t qos, uint32_t ack)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD5(payload, LIBPM_MODULE_ID, PM_REQUEST_DEVICE,
|
||||
device_id, capabilities, qos, ack);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_release_device() - Release a device
|
||||
* @device_id Device ID
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_release_device(uint32_t device_id)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, PM_RELEASE_DEVICE,
|
||||
device_id);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_set_requirement() - Set requirement for the device
|
||||
* @device_id Device ID
|
||||
* @capabilities Requested capabilities for the device
|
||||
* @latency Requested maximum latency
|
||||
* @qos Required Quality of Service
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_set_requirement(uint32_t device_id, uint32_t capabilities,
|
||||
uint32_t latency, uint32_t qos)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD5(payload, LIBPM_MODULE_ID, PM_SET_REQUIREMENT,
|
||||
device_id, capabilities, latency, qos);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_get_device_status() - Get device's status
|
||||
* @device_id Device ID
|
||||
* @response Buffer to store device status response
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_get_device_status(uint32_t device_id, uint32_t *response)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, PM_GET_DEVICE_STATUS,
|
||||
device_id);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, response, 3);
|
||||
}
|
||||
|
|
|
@ -24,5 +24,11 @@ enum pm_ret_status pm_req_suspend(uint32_t target,
|
|||
uint8_t ack,
|
||||
unsigned int latency,
|
||||
unsigned int state);
|
||||
enum pm_ret_status pm_request_device(uint32_t device_id, uint32_t capabilities,
|
||||
uint32_t qos, uint32_t ack);
|
||||
enum pm_ret_status pm_release_device(uint32_t device_id);
|
||||
enum pm_ret_status pm_set_requirement(uint32_t device_id, uint32_t capabilities,
|
||||
uint32_t latency, uint32_t qos);
|
||||
enum pm_ret_status pm_get_device_status(uint32_t device_id, uint32_t *response);
|
||||
|
||||
#endif /* PM_API_SYS_H */
|
||||
|
|
|
@ -24,9 +24,13 @@
|
|||
|
||||
/* PM API ids */
|
||||
#define PM_GET_API_VERSION 1U
|
||||
#define PM_GET_DEVICE_STATUS 3U
|
||||
#define PM_REQ_SUSPEND 6U
|
||||
#define PM_SELF_SUSPEND 7U
|
||||
#define PM_ABORT_SUSPEND 9U
|
||||
#define PM_REQUEST_DEVICE 13U
|
||||
#define PM_RELEASE_DEVICE 14U
|
||||
#define PM_SET_REQUIREMENT 15U
|
||||
|
||||
/*********************************************************************
|
||||
* Enum definitions
|
||||
|
@ -39,6 +43,22 @@ enum pm_abort_reason {
|
|||
ABORT_REASON_UNKNOWN,
|
||||
};
|
||||
|
||||
/**
|
||||
* Subsystem IDs
|
||||
*/
|
||||
typedef enum {
|
||||
XPM_SUBSYSID_PMC,
|
||||
XPM_SUBSYSID_PSM,
|
||||
XPM_SUBSYSID_APU,
|
||||
XPM_SUBSYSID_RPU0_LOCK,
|
||||
XPM_SUBSYSID_RPU0_0,
|
||||
XPM_SUBSYSID_RPU0_1,
|
||||
XPM_SUBSYSID_DDR0,
|
||||
XPM_SUBSYSID_ME,
|
||||
XPM_SUBSYSID_PL,
|
||||
XPM_SUBSYSID_MAX,
|
||||
} XPm_SubsystemId;
|
||||
|
||||
/**
|
||||
* @PM_RET_SUCCESS: success
|
||||
* @PM_RET_ERROR_ARGS: illegal arguments provided (deprecated)
|
||||
|
|
Loading…
Reference in New Issue