zynqmp: pm: Add wrappers for Pin control APIs

Add wrappers for pin control APIs. Actual implementation of
these APIs would be done in subsequent changes.

Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
This commit is contained in:
Rajan Vaja 2018-01-17 02:39:20 -08:00 committed by Jolly Shah
parent f61262ac62
commit 849ba7f730
4 changed files with 144 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -545,3 +545,93 @@ void pm_get_callbackdata(uint32_t *data, size_t count)
pm_ipi_buff_read_callb(data, count);
pm_ipi_irq_clear(primary_proc);
}
/**
* pm_pinctrl_request() - Request Pin from firmware
* @pin Pin number to request
*
* This function requests pin from firmware.
*
* @return Returns status, either success or error+reason.
*/
enum pm_ret_status pm_pinctrl_request(unsigned int pin)
{
return PM_RET_SUCCESS;
}
/**
* pm_pinctrl_release() - Release Pin from firmware
* @pin Pin number to release
*
* This function releases pin from firmware.
*
* @return Returns status, either success or error+reason.
*/
enum pm_ret_status pm_pinctrl_release(unsigned int pin)
{
return PM_RET_SUCCESS;
}
/**
* pm_pinctrl_get_function() - Read function id set for the given pin
* @pin Pin number
* @nid Node ID of function currently set for given pin
*
* This function provides the function currently set for the given pin.
*
* @return Returns status, either success or error+reason
*/
enum pm_ret_status pm_pinctrl_get_function(unsigned int pin,
enum pm_node_id *nid)
{
return PM_RET_SUCCESS;
}
/**
* pm_pinctrl_set_function() - Set function id set for the given pin
* @pin Pin number
* @nid Node ID of function to set for given pin
*
* This function provides the function currently set for the given pin.
*
* @return Returns status, either success or error+reason
*/
enum pm_ret_status pm_pinctrl_set_function(unsigned int pin,
enum pm_node_id nid)
{
return PM_RET_SUCCESS;
}
/**
* pm_pinctrl_get_config() - Read value of requested config param for given pin
* @pin Pin number
* @param Parameter values to be read
* @value Buffer for configuration Parameter value
*
* This function provides the configuration parameter value for the given pin.
*
* @return Returns status, either success or error+reason
*/
enum pm_ret_status pm_pinctrl_get_config(unsigned int pin,
unsigned int param,
unsigned int *value)
{
return PM_RET_SUCCESS;
}
/**
* pm_pinctrl_set_config() - Read value of requested config param for given pin
* @pin Pin number
* @param Parameter to set
* @value Parameter value to set
*
* This function provides the configuration parameter value for the given pin.
*
* @return Returns status, either success or error+reason
*/
enum pm_ret_status pm_pinctrl_set_config(unsigned int pin,
unsigned int param,
unsigned int value)
{
return PM_RET_SUCCESS;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -93,5 +93,17 @@ enum pm_ret_status pm_fpga_get_status(unsigned int *value);
enum pm_ret_status pm_get_chipid(uint32_t *value);
void pm_get_callbackdata(uint32_t *data, size_t count);
enum pm_ret_status pm_pinctrl_request(unsigned int pin);
enum pm_ret_status pm_pinctrl_release(unsigned int pin);
enum pm_ret_status pm_pinctrl_get_function(unsigned int pin,
unsigned int *value);
enum pm_ret_status pm_pinctrl_set_function(unsigned int pin,
unsigned int value);
enum pm_ret_status pm_pinctrl_get_config(unsigned int pin,
unsigned int param,
unsigned int *value);
enum pm_ret_status pm_pinctrl_set_config(unsigned int pin,
unsigned int param,
unsigned int value);
#endif /* _PM_API_SYS_H_ */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -69,6 +69,12 @@ enum pm_api_id {
PM_SECURE_RSA_AES,
PM_SECURE_SHA,
PM_SECURE_RSA,
PM_PINCTRL_REQUEST,
PM_PINCTRL_RELEASE,
PM_PINCTRL_GET_FUNCTION,
PM_PINCTRL_SET_FUNCTION,
PM_PINCTRL_CONFIG_PARAM_GET,
PM_PINCTRL_CONFIG_PARAM_SET,
PM_API_MAX
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -248,6 +248,38 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
(uint64_t)result[2] | ((uint64_t)result[3] << 32));
}
case PM_PINCTRL_REQUEST:
ret = pm_pinctrl_request(pm_arg[0]);
SMC_RET1(handle, (uint64_t)ret);
case PM_PINCTRL_RELEASE:
ret = pm_pinctrl_release(pm_arg[0]);
SMC_RET1(handle, (uint64_t)ret);
case PM_PINCTRL_GET_FUNCTION:
{
uint32_t value;
ret = pm_pinctrl_get_function(pm_arg[0], &value);
SMC_RET1(handle, (uint64_t)ret | ((uint64_t)value) << 32);
}
case PM_PINCTRL_SET_FUNCTION:
ret = pm_pinctrl_set_function(pm_arg[0], pm_arg[1]);
SMC_RET1(handle, (uint64_t)ret);
case PM_PINCTRL_CONFIG_PARAM_GET:
{
uint32_t value;
ret = pm_pinctrl_get_config(pm_arg[0], pm_arg[1], &value);
SMC_RET1(handle, (uint64_t)ret | ((uint64_t)value) << 32);
}
case PM_PINCTRL_CONFIG_PARAM_SET:
ret = pm_pinctrl_set_config(pm_arg[0], pm_arg[1], pm_arg[2]);
SMC_RET1(handle, (uint64_t)ret);
default:
WARN("Unimplemented PM Service Call: 0x%x\n", smc_fid);
SMC_RET1(handle, SMC_UNK);