diff options
author | Mirela Simonovic <mirela.simonovic@aggios.com> | 2018-09-13 12:49:46 +0200 |
---|---|---|
committer | Rajan Vaja <rajan.vaja@xilinx.com> | 2020-12-15 03:03:46 -0800 |
commit | 10a346d9ce3889715dce21f8a1873a94912df41c (patch) | |
tree | 285067bde16f44daa0a28e7e80d39d30bb2e4394 /plat/xilinx | |
parent | 43a029cb97630c69a897de10c582b98cb15a3204 (diff) | |
download | trusted-firmware-a-10a346d9ce3889715dce21f8a1873a94912df41c.tar.gz |
zynqmp: pm: Reimplement pinctrl set/get function EEMI API
Functions are reimplemented to issue system-level pinctrl EEMI calls
to the PMU-FW rather than using MMIO read/write. Macros and functions
that appear to be unused after the change is made are removed.
Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Change-Id: I21b8fda855aa69090b85d6aaf411e19560201cb5
Diffstat (limited to 'plat/xilinx')
-rw-r--r-- | plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c | 106 | ||||
-rw-r--r-- | plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.h | 4 | ||||
-rw-r--r-- | plat/xilinx/zynqmp/pm_service/pm_api_sys.c | 23 |
3 files changed, 13 insertions, 120 deletions
diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c b/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c index 05bbe722da..a9ab6e1536 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.c @@ -19,9 +19,7 @@ #include "pm_common.h" #include "pm_ipi.h" -#define PINCTRL_FUNCTION_MASK U(0xFE) #define PINCTRL_VOLTAGE_STATUS_MASK U(0x01) -#define NFUNCS_PER_PIN U(13) #define PINCTRL_NUM_MIOS U(78) #define MAX_PIN_PER_REG U(26) #define PINCTRL_BANK_ADDR_STEP U(28) @@ -46,12 +44,6 @@ #define PINCTRL_REGVAL_TO_PIN_CONFIG(_pin, _val) \ (((_val) >> PINCTRL_PIN_OFFSET(_pin)) & 0x1) -static uint8_t pm_pinctrl_mux[NFUNCS_PER_PIN] = { - 0x02, 0x04, 0x08, 0x10, 0x18, - 0x00, 0x20, 0x40, 0x60, 0x80, - 0xA0, 0xC0, 0xE0 -}; - struct pinctrl_function { char name[FUNCTION_NAME_LEN]; uint16_t (*groups)[]; @@ -2710,104 +2702,6 @@ enum pm_ret_status pm_api_pinctrl_get_pin_groups(unsigned int pin, } /** - * pm_api_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_api_pinctrl_get_function(unsigned int pin, - unsigned int *id) -{ - unsigned int i = 0, j = 0; - enum pm_ret_status ret = PM_RET_SUCCESS; - unsigned int ctrlreg, val, gid; - uint16_t *grps; - - ctrlreg = IOU_SLCR_BASEADDR + 4U * pin; - ret = pm_mmio_read(ctrlreg, &val); - if (ret != PM_RET_SUCCESS) - return ret; - - val &= PINCTRL_FUNCTION_MASK; - - for (i = 0; i < NFUNCS_PER_PIN; i++) - if (val == pm_pinctrl_mux[i]) - break; - - if (i == NFUNCS_PER_PIN) - return PM_RET_ERROR_NOTSUPPORTED; - - gid = *(*zynqmp_pin_groups[pin].groups + i); - - for (i = 0; i < MAX_FUNCTION; i++) { - grps = *pinctrl_functions[i].groups; - if (grps == NULL) - continue; - if (val != pinctrl_functions[i].regval) - continue; - - for (j = 0; grps[j] != (uint16_t)END_OF_GROUPS; j++) { - if (gid == grps[j]) { - *id = i; - goto done; - } - } - } - if (i == MAX_FUNCTION) - ret = PM_RET_ERROR_ARGS; -done: - return ret; -} - -/** - * pm_api_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_api_pinctrl_set_function(unsigned int pin, - unsigned int fid) -{ - int i, j; - unsigned int ctrlreg, val; - uint16_t *pgrps, *fgrps; - - ctrlreg = IOU_SLCR_BASEADDR + 4U * pin; - val = pinctrl_functions[fid].regval; - - for (i = 0; i < NFUNCS_PER_PIN; i++) - if (val == pm_pinctrl_mux[i]) - break; - - if (i == NFUNCS_PER_PIN) - return PM_RET_ERROR_NOTSUPPORTED; - - pgrps = *zynqmp_pin_groups[pin].groups; - if (!pgrps) - return PM_RET_ERROR_NOTSUPPORTED; - - fgrps = *pinctrl_functions[fid].groups; - if (!fgrps) - return PM_RET_ERROR_NOTSUPPORTED; - - for (i = 0; fgrps[i] != (uint16_t)END_OF_GROUPS; i++) - for (j = 0; pgrps[j] != (uint16_t)END_OF_GROUPS; j++) - if (fgrps[i] == pgrps[j]) - goto match; - - return PM_RET_ERROR_NOTSUPPORTED; - -match: - return pm_mmio_write(ctrlreg, PINCTRL_FUNCTION_MASK, val); -} - -/** * pm_api_pinctrl_set_config() - Set configuration parameter for given pin * @pin: Pin for which configuration is to be set * @param: Configuration parameter to be set diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.h b/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.h index 414a27334c..7ce61b0492 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_pinctrl.h @@ -709,10 +709,6 @@ enum { #define PINCTRL_DRIVE_STRENGTH_8MA 2U #define PINCTRL_DRIVE_STRENGTH_12MA 3U -enum pm_ret_status pm_api_pinctrl_set_function(unsigned int pin, - unsigned int fid); -enum pm_ret_status pm_api_pinctrl_get_function(unsigned int pin, - unsigned int *id); enum pm_ret_status pm_api_pinctrl_set_config(unsigned int pin, unsigned int param, unsigned int value); diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c index d6e0369dfa..1c5d1acc3e 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c @@ -682,31 +682,34 @@ enum pm_ret_status pm_pinctrl_release(unsigned int pin) /** * 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 + * @fid 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) +enum pm_ret_status pm_pinctrl_get_function(unsigned int pin, unsigned int *fid) { - return pm_api_pinctrl_get_function(pin, nid); + uint32_t payload[PAYLOAD_ARG_CNT]; + + PM_PACK_PAYLOAD2(payload, PM_PINCTRL_GET_FUNCTION, pin); + return pm_ipi_send_sync(primary_proc, payload, fid, 1); } /** * 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. + * @fid ID of function to set for 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) +enum pm_ret_status pm_pinctrl_set_function(unsigned int pin, unsigned int fid) { - return pm_api_pinctrl_set_function(pin, (unsigned int)nid); + uint32_t payload[PAYLOAD_ARG_CNT]; + + /* Send request to the PMU */ + PM_PACK_PAYLOAD3(payload, PM_PINCTRL_SET_FUNCTION, pin, fid); + return pm_ipi_send_sync(primary_proc, payload, NULL, 0); } /** |