mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 02:54:24 +00:00
allwinner: psci: Improve system shutdown/reset sequence
- When the SCPI shutdown/reset command returns success, the SCP is still waiting for the CPU to enter WFI. Do that. - Peform board-level poweroff before CPU poweroff. If there is a PMIC available, it will turn everything off including the CPUs, so doing CPU poweroff first is a waste of cycles. - During poweroff, attempt to turn off the local CPU using the ARISC. This should use slightly less power than just an infinite WFI. - Drop the WFI in the reset failure path. The panic will hang anyway. Change-Id: I897efecb3fe4e77a56041b97dd273156ec51ef8e Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
parent
975d076d4a
commit
dae98b3a98
1 changed files with 15 additions and 12 deletions
|
@ -125,19 +125,20 @@ static void __dead2 sunxi_system_off(void)
|
|||
/* Send the power down request to the SCP */
|
||||
uint32_t ret = scpi_sys_power_state(scpi_system_shutdown);
|
||||
|
||||
if (ret != SCP_OK)
|
||||
ERROR("PSCI: SCPI %s failed: %d\n", "shutdown", ret);
|
||||
if (ret == SCP_OK) {
|
||||
wfi();
|
||||
}
|
||||
|
||||
ERROR("PSCI: SCPI %s failed: %d\n", "shutdown", ret);
|
||||
}
|
||||
|
||||
/* Turn off all secondary CPUs */
|
||||
sunxi_cpu_power_off_others();
|
||||
|
||||
/* Attempt to power down the board (may not return) */
|
||||
sunxi_power_down();
|
||||
|
||||
udelay(1000);
|
||||
ERROR("PSCI: Cannot turn off system, halting\n");
|
||||
wfi();
|
||||
panic();
|
||||
/* Turn off all CPUs */
|
||||
sunxi_cpu_power_off_others();
|
||||
sunxi_cpu_power_off_self();
|
||||
psci_power_down_wfi();
|
||||
}
|
||||
|
||||
static void __dead2 sunxi_system_reset(void)
|
||||
|
@ -148,8 +149,11 @@ static void __dead2 sunxi_system_reset(void)
|
|||
/* Send the system reset request to the SCP */
|
||||
uint32_t ret = scpi_sys_power_state(scpi_system_reboot);
|
||||
|
||||
if (ret != SCP_OK)
|
||||
ERROR("PSCI: SCPI %s failed: %d\n", "reboot", ret);
|
||||
if (ret == SCP_OK) {
|
||||
wfi();
|
||||
}
|
||||
|
||||
ERROR("PSCI: SCPI %s failed: %d\n", "reboot", ret);
|
||||
}
|
||||
|
||||
/* Reset the whole system when the watchdog times out */
|
||||
|
@ -160,7 +164,6 @@ static void __dead2 sunxi_system_reset(void)
|
|||
mdelay(1000);
|
||||
|
||||
ERROR("PSCI: System reset failed\n");
|
||||
wfi();
|
||||
panic();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue