73 lines
2.4 KiB
Diff
73 lines
2.4 KiB
Diff
|
From 3029a8f36df1246f781a5d10776b05c5ea7f2867 Mon Sep 17 00:00:00 2001
|
||
|
From: Samuel Holland <samuel@sholland.org>
|
||
|
Date: Thu, 18 Mar 2021 22:55:15 -0500
|
||
|
Subject: [PATCH 6/8] 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 <samuel@sholland.org>
|
||
|
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 56a2ad6f7..d771e92fe 100644
|
||
|
--- a/plat/allwinner/common/include/platform_def.h
|
||
|
+++ b/plat/allwinner/common/include/platform_def.h
|
||
|
@@ -56,9 +56,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 eb37daa63..ed1363537 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.31.1
|
||
|
|