From 981a0f37f9c2d8e9cdff5bf34c80c3dd7e1128ae Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Thu, 18 Mar 2021 22:55:15 -0500 Subject: [PATCH] allwinner: Choose PSCI states to avoid translation By aligning the PSCI and SCPI power states, we can avoid some code to translate between the two. This also makes room for a second retention state, for future growth. Signed-off-by: Samuel Holland Change-Id: I26691085f277a96bd405e3305ab0fe390a92b418 --- plat/allwinner/common/include/platform_def.h | 7 ++++--- plat/allwinner/common/sunxi_scpi_pm.c | 17 +++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/plat/allwinner/common/include/platform_def.h b/plat/allwinner/common/include/platform_def.h index 4893368c2..fc9c966ba 100644 --- a/plat/allwinner/common/include/platform_def.h +++ b/plat/allwinner/common/include/platform_def.h @@ -57,9 +57,10 @@ #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE \ (SUNXI_SRAM_A2_BASE + SUNXI_SRAM_A2_SIZE - 0x200) -#define PLAT_MAX_PWR_LVL_STATES U(2) -#define PLAT_MAX_RET_STATE U(1) -#define PLAT_MAX_OFF_STATE U(2) +/* These states are used directly for SCPI communication. */ +#define PLAT_MAX_PWR_LVL_STATES U(3) +#define PLAT_MAX_RET_STATE U(2) +#define PLAT_MAX_OFF_STATE U(3) #define PLAT_MAX_PWR_LVL U(2) #define PLAT_NUM_PWR_DOMAINS (U(1) + \ diff --git a/plat/allwinner/common/sunxi_scpi_pm.c b/plat/allwinner/common/sunxi_scpi_pm.c index 74763ef7e..89c834aa9 100644 --- a/plat/allwinner/common/sunxi_scpi_pm.c +++ b/plat/allwinner/common/sunxi_scpi_pm.c @@ -44,17 +44,6 @@ #define SYSTEM_PWR_STATE(state) \ ((state)->pwr_domain_state[SYSTEM_PWR_LVL]) -static inline scpi_power_state_t scpi_map_state(plat_local_state_t psci_state) -{ - if (is_local_state_run(psci_state)) { - return scpi_power_on; - } - if (is_local_state_retn(psci_state)) { - return scpi_power_retention; - } - return scpi_power_off; -} - static void sunxi_cpu_standby(plat_local_state_t cpu_state) { u_register_t scr = read_scr_el3(); @@ -87,9 +76,9 @@ static void sunxi_pwr_domain_off(const psci_power_state_t *target_state) } scpi_set_css_power_state(read_mpidr(), - scpi_map_state(cpu_pwr_state), - scpi_map_state(cluster_pwr_state), - scpi_map_state(system_pwr_state)); + cpu_pwr_state, + cluster_pwr_state, + system_pwr_state); } static void sunxi_pwr_domain_on_finish(const psci_power_state_t *target_state) -- 2.33.1