xilinx: versal: Implement pin control related PM APIs
Implement below pin control related APIs: - Request pin - Release pin - Set pin function - Get pin function - Set pin parameter value - Get pin parameter value Signed-off-by: Tejas Patel <tejas.patel@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Change-Id: Ib805cc8c936b63206d44bf1f7bebd0f03f7b3c01
This commit is contained in:
parent
9c3c5e0737
commit
0ed83c621c
|
@ -270,3 +270,111 @@ enum pm_ret_status pm_reset_get_status(uint32_t reset, uint32_t *status)
|
|||
|
||||
return pm_ipi_send_sync(primary_proc, payload, status, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_pinctrl_request() - Request a pin
|
||||
* @pin Pin ID
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_pinctrl_request(uint32_t pin)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, PM_PINCTRL_REQUEST, pin);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_pinctrl_release() - Release a pin
|
||||
* @pin Pin ID
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_pinctrl_release(uint32_t pin)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, PM_PINCTRL_RELEASE, pin);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_pinctrl_set_function() - Set pin function
|
||||
* @pin Pin ID
|
||||
* @function Function ID
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_pinctrl_set_function(uint32_t pin, uint32_t function)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD3(payload, LIBPM_MODULE_ID, PM_PINCTRL_SET_FUNCTION, pin,
|
||||
function)
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_pinctrl_get_function() - Get function set on the pin
|
||||
* @pin Pin ID
|
||||
* @function Function set on the pin
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_pinctrl_get_function(uint32_t pin, uint32_t *function)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, PM_PINCTRL_SET_FUNCTION,
|
||||
pin);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, function, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_pinctrl_set_pin_param() - Set configuration parameter for the pin
|
||||
* @pin Pin ID
|
||||
* @param Parameter ID
|
||||
* @value Parameter value
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_pinctrl_set_pin_param(uint32_t pin, uint32_t param,
|
||||
uint32_t value)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD4(payload, LIBPM_MODULE_ID, PM_PINCTRL_CONFIG_PARAM_SET,
|
||||
pin, param, value);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* pm_pinctrl_get_pin_param() - Get configuration parameter value for the pin
|
||||
* @pin Pin ID
|
||||
* @param Parameter ID
|
||||
* @value Buffer to store parameter value
|
||||
*
|
||||
* @return Returns status, either success or error+reason
|
||||
*/
|
||||
enum pm_ret_status pm_pinctrl_get_pin_param(uint32_t pin, uint32_t param,
|
||||
uint32_t *value)
|
||||
{
|
||||
uint32_t payload[PAYLOAD_ARG_CNT];
|
||||
|
||||
/* Send request to the PMC */
|
||||
PM_PACK_PAYLOAD3(payload, LIBPM_MODULE_ID, PM_PINCTRL_CONFIG_PARAM_GET,
|
||||
pin, param);
|
||||
|
||||
return pm_ipi_send_sync(primary_proc, payload, value, 1);
|
||||
}
|
||||
|
|
|
@ -32,5 +32,13 @@ enum pm_ret_status pm_set_requirement(uint32_t device_id, uint32_t capabilities,
|
|||
enum pm_ret_status pm_get_device_status(uint32_t device_id, uint32_t *response);
|
||||
enum pm_ret_status pm_reset_assert(uint32_t reset, bool assert);
|
||||
enum pm_ret_status pm_reset_get_status(uint32_t reset, uint32_t *status);
|
||||
enum pm_ret_status pm_pinctrl_request(uint32_t pin);
|
||||
enum pm_ret_status pm_pinctrl_release(uint32_t pin);
|
||||
enum pm_ret_status pm_pinctrl_set_function(uint32_t pin, uint32_t function);
|
||||
enum pm_ret_status pm_pinctrl_get_function(uint32_t pin, uint32_t *function);
|
||||
enum pm_ret_status pm_pinctrl_set_pin_param(uint32_t pin, uint32_t param,
|
||||
uint32_t value);
|
||||
enum pm_ret_status pm_pinctrl_get_pin_param(uint32_t pin, uint32_t param,
|
||||
uint32_t *value);
|
||||
|
||||
#endif /* PM_API_SYS_H */
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
#define PM_SET_REQUIREMENT 15U
|
||||
#define PM_RESET_ASSERT 17U
|
||||
#define PM_RESET_GET_STATUS 18U
|
||||
#define PM_PINCTRL_REQUEST 28U
|
||||
#define PM_PINCTRL_RELEASE 29U
|
||||
#define PM_PINCTRL_GET_FUNCTION 30U
|
||||
#define PM_PINCTRL_SET_FUNCTION 31U
|
||||
#define PM_PINCTRL_CONFIG_PARAM_GET 32U
|
||||
#define PM_PINCTRL_CONFIG_PARAM_SET 33U
|
||||
|
||||
/*********************************************************************
|
||||
* Enum definitions
|
||||
|
|
Loading…
Reference in New Issue