diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c index f165fb022..9c5af88bb 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c @@ -677,6 +677,10 @@ enum pm_ret_status pm_api_ioctl(enum pm_node_id nid, case IOCTL_AFI: ret = pm_ioctl_afi(arg1, arg2); break; + case IOCTL_SET_FEATURE_CONFIG: + case IOCTL_GET_FEATURE_CONFIG: + ret = pm_feature_config(ioctl_id, arg1, arg2, value); + break; default: ret = PM_RET_ERROR_NOTSUPPORTED; break; diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h index 337f7321b..f18dc00a2 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h @@ -15,28 +15,43 @@ //ioctl id enum { - IOCTL_GET_RPU_OPER_MODE, - IOCTL_SET_RPU_OPER_MODE, - IOCTL_RPU_BOOT_ADDR_CONFIG, - IOCTL_TCM_COMB_CONFIG, - IOCTL_SET_TAPDELAY_BYPASS, - IOCTL_SET_SGMII_MODE, - IOCTL_SD_DLL_RESET, - IOCTL_SET_SD_TAPDELAY, + IOCTL_GET_RPU_OPER_MODE = 0, + IOCTL_SET_RPU_OPER_MODE = 1, + IOCTL_RPU_BOOT_ADDR_CONFIG = 2, + IOCTL_TCM_COMB_CONFIG = 3, + IOCTL_SET_TAPDELAY_BYPASS = 4, + IOCTL_SET_SGMII_MODE = 5, + IOCTL_SD_DLL_RESET = 6, + IOCTL_SET_SD_TAPDELAY = 7, /* Ioctl for clock driver */ - IOCTL_SET_PLL_FRAC_MODE, - IOCTL_GET_PLL_FRAC_MODE, - IOCTL_SET_PLL_FRAC_DATA, - IOCTL_GET_PLL_FRAC_DATA, - IOCTL_WRITE_GGS, - IOCTL_READ_GGS, - IOCTL_WRITE_PGGS, - IOCTL_READ_PGGS, + IOCTL_SET_PLL_FRAC_MODE = 8, + IOCTL_GET_PLL_FRAC_MODE = 9, + IOCTL_SET_PLL_FRAC_DATA = 10, + IOCTL_GET_PLL_FRAC_DATA = 11, + IOCTL_WRITE_GGS = 12, + IOCTL_READ_GGS = 13, + IOCTL_WRITE_PGGS = 14, + IOCTL_READ_PGGS = 15, /* IOCTL for ULPI reset */ - IOCTL_ULPI_RESET, + IOCTL_ULPI_RESET = 16, /* Set healthy bit value */ - IOCTL_SET_BOOT_HEALTH_STATUS, - IOCTL_AFI, + IOCTL_SET_BOOT_HEALTH_STATUS = 17, + IOCTL_AFI = 18, + /* Probe counter read/write */ + IOCTL_PROBE_COUNTER_READ = 19, + IOCTL_PROBE_COUNTER_WRITE = 20, + IOCTL_OSPI_MUX_SELECT = 21, + /* IOCTL for USB power request */ + IOCTL_USB_SET_STATE = 22, + /* IOCTL to get last reset reason */ + IOCTL_GET_LAST_RESET_REASON = 23, + /* AI engine NPI ISR clear */ + IOCTL_AIE_ISR_CLEAR = 24, + /* Register SGI to ATF */ + IOCTL_REGISTER_SGI = 25, + /* Runtime feature configuration */ + IOCTL_SET_FEATURE_CONFIG = 26, + IOCTL_GET_FEATURE_CONFIG = 27, }; //RPU operation mode diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c index 62260bc40..5d9408cd5 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c @@ -1648,3 +1648,36 @@ enum pm_ret_status em_send_errors(unsigned int *value) EM_PACK_PAYLOAD1(payload, EM_SEND_ERRORS); return pm_ipi_send_sync(primary_proc, payload, value, 1); } + +/** + * pm_feature_config() - feature configuration at runtime + * + * This function is used to send IPI request to PMUFW to configure feature + * at runtime. The feature can be enable or disable as well as the feature + * can be configure at runtime using an IOCTL call. + * + * @ioctl_id The ioctl id for the feature configuration + * @config_id The config id of the feature to be configured + * @value The value to be configured + * @response Return to reference pointer + * + * @return Returns 0 on success or error value on failure + */ +enum pm_ret_status pm_feature_config(unsigned int ioctl_id, + unsigned int config_id, + unsigned int value, + unsigned int *response) +{ + uint32_t payload[PAYLOAD_ARG_CNT]; + + /* Send request to the PMU */ + PM_PACK_PAYLOAD5(payload, PM_IOCTL, 0, ioctl_id, config_id, value); + + if (ioctl_id == IOCTL_GET_FEATURE_CONFIG) { + return pm_ipi_send_sync(primary_proc, payload, response, 1); + } else if (ioctl_id == IOCTL_SET_FEATURE_CONFIG) { + return pm_ipi_send_sync(primary_proc, payload, NULL, 0); + } else { + return PM_RET_ERROR_ARGS; + } +} diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h index b0c26529d..ca07cef75 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h @@ -202,4 +202,9 @@ enum pm_ret_status em_set_action(unsigned int *value); enum pm_ret_status em_remove_action(unsigned int *value); enum pm_ret_status em_send_errors(unsigned int *value); +enum pm_ret_status pm_feature_config(unsigned int ioctl_id, + unsigned int config_id, + unsigned int value, + unsigned int *response); + #endif /* PM_API_SYS_H */