aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-06-17 09:26:13 -0600
committerTom Rini <trini@konsulko.com>2024-06-17 09:26:13 -0600
commit4d07da333313f1c652f1224502cdb48e4e8ad03e (patch)
tree3fadc7887145af855885f90aa881bd870e060dea
parent7d602334f6222d46804e59ba0596607f81f82e07 (diff)
parent9968e8dbf3887c692dd7f2f83bd43678acd394a5 (diff)
downloadu-boot-4d07da333313f1c652f1224502cdb48e4e8ad03e.zip
u-boot-4d07da333313f1c652f1224502cdb48e4e8ad03e.tar.gz
u-boot-4d07da333313f1c652f1224502cdb48e4e8ad03e.tar.bz2
Merge tag 'u-boot-stm32-20240617' of https://source.denx.de/u-boot/custodians/u-boot-stm
STM32MP1: - Ping IWDG on exit from PSCI suspend code
-rw-r--r--arch/arm/mach-stm32mp/stm32mp1/psci.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-stm32mp/stm32mp1/psci.c b/arch/arm/mach-stm32mp/stm32mp1/psci.c
index 4f2379d..e991039 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/psci.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/psci.c
@@ -809,6 +809,27 @@ void __secure psci_system_suspend(u32 __always_unused function_id,
clrbits_le32(STM32_SYSCFG_BASE + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
/*
+ * Make sure the OS would not get any spurious IWDG pretimeout IRQ
+ * right after the system wakes up. This may happen in case the SoC
+ * got woken up by another source than the IWDG pretimeout and the
+ * pretimeout IRQ arrived immediately afterward, but too late to be
+ * handled by the main loop above. In case either of the IWDG is
+ * enabled, ping it first and then return to the OS.
+ */
+
+ /* Ping IWDG1 and ACK pretimer IRQ */
+ if (gic_enabled[4] & BIT(22)) {
+ writel(IWDG_KR_RELOAD_KEY, STM32_IWDG1_BASE + IWDG_KR);
+ writel(IWDG_EWCR_EWIC, STM32_IWDG1_BASE + IWDG_EWCR);
+ }
+
+ /* Ping IWDG2 and ACK pretimer IRQ */
+ if (gic_enabled[4] & BIT(23)) {
+ writel(IWDG_KR_RELOAD_KEY, STM32_IWDG2_BASE + IWDG_KR);
+ writel(IWDG_EWCR_EWIC, STM32_IWDG2_BASE + IWDG_EWCR);
+ }
+
+ /*
* The system has resumed successfully. Rewrite LR register stored
* on stack with 'ep' value, so that on return from this PSCI call,
* the code would jump to that 'ep' resume entry point code path