From e01acbe903fc176a2710a335753f4d99b67e9949 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Thu, 11 Nov 2021 10:17:09 +0900 Subject: [PATCH] refactor(plat/synquacer): update PSCI system_off handling SynQuacer SoC contains a Cortex-M3 System Control Processor(SCP) which manages system power. This commit modifies the PSCI system_off handling to call SCMI, same as other PSCI calls. System power-off is done by turing off the ATX power supply through GPIO, this operation is transferred to SCP. Note that this commit modifies only the SCMI case, obsolete SCPI implementation is not updated. Signed-off-by: Masahisa Kojima Change-Id: I6c1009e67cccd1eb5d14c338c3df9103d63709dd --- plat/socionext/synquacer/drivers/scp/sq_scmi.c | 5 +++++ plat/socionext/synquacer/include/sq_common.h | 1 + plat/socionext/synquacer/sq_psci.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/plat/socionext/synquacer/drivers/scp/sq_scmi.c b/plat/socionext/synquacer/drivers/scp/sq_scmi.c index e2013cc55..0e99256ac 100644 --- a/plat/socionext/synquacer/drivers/scp/sq_scmi.c +++ b/plat/socionext/synquacer/drivers/scp/sq_scmi.c @@ -189,6 +189,11 @@ void __dead2 sq_scmi_system_off(int state) /* * Helper function to reset the system via SCMI. */ +void __dead2 sq_scmi_sys_shutdown(void) +{ + sq_scmi_system_off(SCMI_SYS_PWR_SHUTDOWN); +} + void __dead2 sq_scmi_sys_reboot(void) { sq_scmi_system_off(SCMI_SYS_PWR_COLD_RESET); diff --git a/plat/socionext/synquacer/include/sq_common.h b/plat/socionext/synquacer/include/sq_common.h index a9858229f..b09d22a03 100644 --- a/plat/socionext/synquacer/include/sq_common.h +++ b/plat/socionext/synquacer/include/sq_common.h @@ -45,6 +45,7 @@ void sq_mmap_setup(uintptr_t total_base, size_t total_size, /* SCMI API for power management by SCP */ void sq_scmi_off(const struct psci_power_state *target_state); void sq_scmi_on(u_register_t mpidr); +void __dead2 sq_scmi_sys_shutdown(void); void __dead2 sq_scmi_sys_reboot(void); void __dead2 sq_scmi_system_off(int state); /* SCMI API for vendor specific protocol */ diff --git a/plat/socionext/synquacer/sq_psci.c b/plat/socionext/synquacer/sq_psci.c index 4168df9da..3062f6318 100644 --- a/plat/socionext/synquacer/sq_psci.c +++ b/plat/socionext/synquacer/sq_psci.c @@ -113,6 +113,9 @@ void sq_pwr_domain_off(const psci_power_state_t *target_state) void __dead2 sq_system_off(void) { +#if SQ_USE_SCMI_DRIVER + sq_scmi_sys_shutdown(); +#else volatile uint32_t *gpio = (uint32_t *)PLAT_SQ_GPIO_BASE; /* set PD[9] high to power off the system */ @@ -139,6 +142,7 @@ void __dead2 sq_system_off(void) wfi(); ERROR("SQ System Off: operation not handled.\n"); panic(); +#endif } void __dead2 sq_system_reset(void)