]> git.baikalelectronics.ru Git - uboot.git/commit
ARM: stm32: Add IWDG handling into PSCI suspend code
authorMarek Vasut <marex@denx.de>
Thu, 11 May 2023 19:55:45 +0000 (21:55 +0200)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Fri, 16 Jun 2023 09:09:28 +0000 (11:09 +0200)
commitde913f77812a5844d503538a774f0753bedb1fc2
tree94ee6f427b9197ec7eaed679df48c4f27d010d4a
parent81c02b01ea67762bc62eb35fb177d9f4dd9d7457
ARM: stm32: Add IWDG handling into PSCI suspend code

In case the IWDG is enabled by either U-Boot or Linux, the IWDG can never
be disabled again. That includes low power states, which means that if the
IWDG is enabled, the SoC would reset itself after a while in suspend via
the IWDG. This is not desired behavior.

It is possible to enable IWDG pre-timeout IRQ which is routed into the EXTI,
and use that IRQ to wake the CPU up before the IWDG timeout is reached and
reset is triggered. This pre-timeout IRQ can be used to reload the WDT and
then suspend the CPU again every once in a while.

Implement this functionality for both IWDG1 and IWDG2 by reading out all
the unmasked IRQs, comparing the list with currently pending IRQs in GICv3:
- If any IRQ is pending and it is NOT IWDG1 or IWDG2 pre-timeout IRQ,
  wake up and let OS handle the IRQs
- If IWDG1 or IWDG2 IRQ is pending and no other IRQ is pending,
  ping the respective IWDG and suspend again

This does not seem to have any adverse impact on power consumption in suspend.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
arch/arm/mach-stm32mp/include/mach/stm32.h
arch/arm/mach-stm32mp/psci.c