From b911dddcec2bf9cd2b39ac86547e1f08e6fef82a Mon Sep 17 00:00:00 2001 From: Chandni Cherukuri Date: Thu, 11 Oct 2018 14:08:08 +0530 Subject: [PATCH] plat/arm/scmi: introduce plat_css_get_scmi_info API The default values of 'plat_css_scmi_plat_info' is not applicable for all the platforms. There should be a provision to let platform code to register a platform specific instance of scmi_channel_plat_info_t. Add a new API 'plat_css_get_scmi_info' which lets the platform to register a platform specific instance of scmi_channel_plat_info_t and remove the default values. In addition to this, the existing 'plat_css_scmi_plat_info' structure is removed from the common code and instantiated for the platforms that need it. This allows for a consistent provisioning of the SCMI channel information across all the existing and upcoming platforms. Change-Id: I4fb65d7f2f165b78697b4677f1e8d81edebeac06 Signed-off-by: Chandni Cherukuri --- plat/arm/board/juno/juno_topology.c | 15 +++++++++++++++ plat/arm/css/drivers/scmi/scmi.h | 3 +++ plat/arm/css/drivers/scp/css_pm_scmi.c | 11 +---------- plat/arm/css/sgi/sgi_bl31_setup.c | 15 +++++++++++++++ plat/arm/css/sgm/sgm_bl31_setup.c | 15 +++++++++++++++ 5 files changed, 49 insertions(+), 10 deletions(-) diff --git a/plat/arm/board/juno/juno_topology.c b/plat/arm/board/juno/juno_topology.c index 72bb92e0..6d8fc05c 100644 --- a/plat/arm/board/juno/juno_topology.c +++ b/plat/arm/board/juno/juno_topology.c @@ -9,6 +9,21 @@ #include #include #include "juno_def.h" +#include "../../css/drivers/scmi/scmi.h" +#include "../../css/drivers/mhu/css_mhu_doorbell.h" + +static scmi_channel_plat_info_t juno_scmi_plat_info = { + .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE, + .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF, + .db_preserve_mask = 0xfffffffe, + .db_modify_mask = 0x1, + .ring_doorbell = &mhu_ring_doorbell, +}; + +scmi_channel_plat_info_t *plat_css_get_scmi_info() +{ + return &juno_scmi_plat_info; +} /* * On Juno, the system power level is the highest power level. diff --git a/plat/arm/css/drivers/scmi/scmi.h b/plat/arm/css/drivers/scmi/scmi.h index 71a8c2d0..7f892291 100644 --- a/plat/arm/css/drivers/scmi/scmi.h +++ b/plat/arm/css/drivers/scmi/scmi.h @@ -159,4 +159,7 @@ int scmi_sys_pwr_state_get(void *p, uint32_t *system_state); int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr); int scmi_ap_core_get_reset_addr(void *p, uint64_t *reset_addr, uint32_t *attr); +/* API to get the platform specific SCMI channel information. */ +scmi_channel_plat_info_t *plat_css_get_scmi_info(); + #endif /* __CSS_SCMI_H__ */ diff --git a/plat/arm/css/drivers/scp/css_pm_scmi.c b/plat/arm/css/drivers/scp/css_pm_scmi.c index 9297e9fe..956f583c 100644 --- a/plat/arm/css/drivers/scp/css_pm_scmi.c +++ b/plat/arm/css/drivers/scp/css_pm_scmi.c @@ -13,7 +13,6 @@ #include #include #include "../scmi/scmi.h" -#include "../mhu/css_mhu_doorbell.h" #include "css_scp.h" /* @@ -298,14 +297,6 @@ void __dead2 css_scp_sys_reboot(void) css_scp_system_off(SCMI_SYS_PWR_COLD_RESET); } -static scmi_channel_plat_info_t plat_css_scmi_plat_info = { - .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE, - .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF, - .db_preserve_mask = 0xfffffffe, - .db_modify_mask = 0x1, - .ring_doorbell = &mhu_ring_doorbell, -}; - static int scmi_ap_core_init(scmi_channel_t *ch) { #if PROGRAMMABLE_RESET_ADDRESS @@ -330,7 +321,7 @@ static int scmi_ap_core_init(scmi_channel_t *ch) void __init plat_arm_pwrc_setup(void) { - channel.info = &plat_css_scmi_plat_info; + channel.info = plat_css_get_scmi_info(); channel.lock = ARM_SCMI_LOCK_GET_INSTANCE; scmi_handle = scmi_init(&channel); if (scmi_handle == NULL) { diff --git a/plat/arm/css/sgi/sgi_bl31_setup.c b/plat/arm/css/sgi/sgi_bl31_setup.c index 09f493ed..3b651f3d 100644 --- a/plat/arm/css/sgi/sgi_bl31_setup.c +++ b/plat/arm/css/sgi/sgi_bl31_setup.c @@ -9,6 +9,21 @@ #include #include #include +#include "../../css/drivers/scmi/scmi.h" +#include "../../css/drivers/mhu/css_mhu_doorbell.h" + +static scmi_channel_plat_info_t sgi575_scmi_plat_info = { + .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE, + .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF, + .db_preserve_mask = 0xfffffffe, + .db_modify_mask = 0x1, + .ring_doorbell = &mhu_ring_doorbell, +}; + +scmi_channel_plat_info_t *plat_css_get_scmi_info() +{ + return &sgi575_scmi_plat_info; +} void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) diff --git a/plat/arm/css/sgm/sgm_bl31_setup.c b/plat/arm/css/sgm/sgm_bl31_setup.c index a55176a7..29c32e7c 100644 --- a/plat/arm/css/sgm/sgm_bl31_setup.c +++ b/plat/arm/css/sgm/sgm_bl31_setup.c @@ -8,6 +8,21 @@ #include #include #include +#include "../../css/drivers/scmi/scmi.h" +#include "../../css/drivers/mhu/css_mhu_doorbell.h" + +static scmi_channel_plat_info_t sgm775_scmi_plat_info = { + .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE, + .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF, + .db_preserve_mask = 0xfffffffe, + .db_modify_mask = 0x1, + .ring_doorbell = &mhu_ring_doorbell, +}; + +scmi_channel_plat_info_t *plat_css_get_scmi_info() +{ + return &sgm775_scmi_plat_info; +} void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) -- 2.30.2