From 849ba7f7308f05159e0cc2fb8b281d926009394c Mon Sep 17 00:00:00 2001 From: Rajan Vaja Date: Wed, 17 Jan 2018 02:39:20 -0800 Subject: [PATCH] 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 Signed-off-by: Jolly Shah --- plat/xilinx/zynqmp/pm_service/pm_api_sys.c | 92 ++++++++++++++++++++- plat/xilinx/zynqmp/pm_service/pm_api_sys.h | 14 +++- plat/xilinx/zynqmp/pm_service/pm_defs.h | 8 +- plat/xilinx/zynqmp/pm_service/pm_svc_main.c | 34 +++++++- 4 files changed, 144 insertions(+), 4 deletions(-) diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c index 9e2106774..5bc344227 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c @@ -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; +} diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h index af7b2523a..f240d4915 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h @@ -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_ */ diff --git a/plat/xilinx/zynqmp/pm_service/pm_defs.h b/plat/xilinx/zynqmp/pm_service/pm_defs.h index 8f455d4e6..7b26c1587 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_defs.h +++ b/plat/xilinx/zynqmp/pm_service/pm_defs.h @@ -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 }; diff --git a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c index fb64bc5cc..22b6bc39f 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c +++ b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c @@ -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);