void-packages/srcpkgs/pinephone-uboot/patches/armtf/0002-allwinner-WFI-during-s...

76 lines
2.2 KiB
Diff

From c744b1b64008f4c8cd6292df058cbbbc6baf780f Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 7 May 2020 19:05:57 -0500
Subject: [PATCH 2/5] allwinner: WFI during system state transitions
Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I19fea4db03a3200014da9d41ecfdc7e54893aca2
---
plat/allwinner/common/sunxi_pm.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/plat/allwinner/common/sunxi_pm.c b/plat/allwinner/common/sunxi_pm.c
index e0fa5b3ec..17ef7bfda 100644
--- a/plat/allwinner/common/sunxi_pm.c
+++ b/plat/allwinner/common/sunxi_pm.c
@@ -12,7 +12,6 @@
#include <common/debug.h>
#include <drivers/arm/css/css_scpi.h>
#include <drivers/arm/gicv2.h>
-#include <drivers/delay_timer.h>
#include <lib/mmio.h>
#include <lib/psci/psci.h>
#include <plat/common/platform.h>
@@ -136,8 +135,10 @@ 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 */
@@ -145,9 +146,8 @@ static void __dead2 sunxi_system_off(void)
sunxi_power_down();
- udelay(1000);
- ERROR("PSCI: Cannot turn off system, halting\n");
wfi();
+ ERROR("PSCI: Cannot turn off system, halting\n");
panic();
}
@@ -159,19 +159,19 @@ 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 */
mmio_write_32(SUNXI_WDOG0_CFG_REG, 1);
/* Enable the watchdog with the shortest timeout (0.5 seconds) */
mmio_write_32(SUNXI_WDOG0_MODE_REG, (0 << 4) | 1);
- /* Wait for twice the watchdog timeout before panicking */
- mdelay(1000);
- ERROR("PSCI: System reset failed\n");
wfi();
+ ERROR("PSCI: System reset failed\n");
panic();
}
--
2.28.0