ARM: stm32: Add IWDG handling into PSCI suspend code
Subsystems (3)
PATCH 1/1 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.
---
Cc: Ilias Apalodimas <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- arch/arm/mach-stm32mp/include/mach/stm32.h | 2 + arch/arm/mach-stm32mp/psci.c | 66 ++++++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-)
arch/arm/mach-stm32mp/include/mach/stm32.h +2 -0
@@ -21,8 +21,10 @@#define STM32_DBGMCU_BASE 0x50081000#endif #define STM32_FMC2_BASE 0x58002000 +#define STM32_IWDG2_BASE 0x5A002000#define STM32_DDRCTRL_BASE 0x5A003000#define STM32_DDRPHYC_BASE 0x5A004000 +#define STM32_IWDG1_BASE 0x5C003000#define STM32_TZC_BASE 0x5C006000#define STM32_ETZPC_BASE 0x5C007000#define STM32_STGEN_BASE 0x5C008000
arch/arm/mach-stm32mp/psci.c +61 -5
85 lines not on this page · raw message
Signature · 1 line
2.39.2
Quoted 130 lines · Marek Vasut
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 againThis does not seem to have any adverse impact on power consumption in suspend.
Signed-off-by Marek Vasut <[email protected]>---
Cc: Ilias Apalodimas <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: [email protected]
Cc: [email protected]--- arch/arm/mach-stm32mp/include/mach/stm32.h | 2 + arch/arm/mach-stm32mp/psci.c | 66 ++++++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-)arch/arm/mach-stm32mp/include/mach/stm32.h +2
-0@@ -21,8 +21,10 @@#define STM32_DBGMCU_BASE 0x50081000#endif #define STM32_FMC2_BASE 0x58002000 +#define STM32_IWDG2_BASE 0x5A002000#define STM32_DDRCTRL_BASE 0x5A003000#define STM32_DDRPHYC_BASE 0x5A004000 +#define STM32_IWDG1_BASE 0x5C003000#define STM32_TZC_BASE 0x5C006000#define STM32_ETZPC_BASE 0x5C007000#define STM32_STGEN_BASE 0x5C008000arch/arm/mach-stm32mp/psci.c +54
-5@@ -161,6 +161,12 @@#define RCC_MP_GRSTCSETR_MPUP0RST BIT(4)#define RCC_MP_GRSTCSETR_MPUP1RST BIT(5) +/* IWDG */ +#define IWDG_KR 0x00 +#define IWDG_KR_RELOAD_KEY 0xaaaa +#define IWDG_EWCR 0x14 +#define IWDG_EWCR_EWIC BIT(14) +#define STM32MP1_PSCI_NR_CPUS 2#if STM32MP1_PSCI_NR_CPUS >CONFIG_ARMV7_PSCI_NR_CPUS #error "invalid value for CONFIG_ARMV7_PSCI_NR_CPUS"@@ -696,7 +702,18 @@ void __secure psci_system_suspend(u32 __always_unused function_id, u32 ep, u32 context_id) {u32 saved_mcudivr, saved_pll3cr, saved_pll4cr, saved_mssckselr; +u32 gicd_addr =stm32mp_get_gicd_base_address (); +bool iwdg1_wake = false; +bool iwdg2_wake = false; +bool other_wake = false;u32 saved_pwrctl, reg; +u32 gic_enabled[8 ]; +u32 irqs; +int i; + +/* Cache enable mask of all 256 SPI */ +for (i =0 ; i <ARRAY_SIZE (gic_enabled); i++) + gic_enabled[i] =readl (gicd_addr + GICD_ISENABLERn +0x4 +4 * i);/* Disable IO compensation */ @@ -725,11 +742,50 @@ void __secure psci_system_suspend(u32 __always_unused function_id,setbits_le32 (STM32_PWR_BASE +PWR_CR3 ,PWR_CR3_DDRSREN );writel (0x3 ,STM32_RCC_BASE +RCC_MP_SREQSETR ); -/* Zzz, enter stop mode */ - asmvolatile ( -"isb\n" -"dsb\n" -"wfi\n" ); +for (;;) { +/* Zzz, enter stop mode */ + asmvolatile ( +"isb\n" +"dsb\n" +"wfi\n" ); + +/* Determine the wake up source */ +for (i =0 ; i <ARRAY_SIZE (gic_enabled); i++) { + irqs =readl (gicd_addr + GICR_IGROUPMODRn +0x4 +4 * i); + irqs &= gic_enabled[i]; +if (!irqs) +continue ; + +/* Test whether IWDG pretimeout triggered the wake up. */ +if (i ==4 ) {/* SPI Num 128..159 */ + iwdg1_wake = !!(irqs &BIT (22 ));/* SPI 150 */ + iwdg2_wake = !!(irqs &BIT (23 ));/* SPI 151 */ + irqs &= ~(BIT (22 ) |BIT (23 )); + } + +/* Test whether there is any other wake up trigger. */ +if (irqs) { + other_wake = true; +break ; + } + } + +/* Other wake up triggers pending, let OS deal with all of it. */ +if (other_wake) +break ; + +/* Ping IWDG1 and ACK pretimer IRQ */ +if (iwdg1_wake) { +writel (IWDG_KR_RELOAD_KEY ,STM32_IWDG1_BASE +IWDG_KR ); +writel (IWDG_EWCR_EWIC ,STM32_IWDG1_BASE +IWDG_EWCR ); + }
arch/arm/mach-stm32mp/psci.c void __secure psci_system_suspend(u32 __always_unused function_id, · line 791
Quoted 10 lines
arch/arm/mach-stm32mp/psci.c +7
-0+ +/* Ping IWDG2 and ACK pretimer IRQ */ +if (iwdg2_wake) { +writel (IWDG_KR_RELOAD_KEY ,STM32_IWDG2_BASE +IWDG_KR ); +writel (IWDG_EWCR_EWIC ,STM32_IWDG2_BASE +IWDG_EWCR ); + } + }writel (0x3 ,STM32_RCC_BASE +RCC_MP_SREQCLRR );ddr_sw_self_refresh_exit ();
Thanks
Patrice
Ilias Apalodimas
Acked-byQuoted 142 lines · Patrice CHOTARD
Quoted 138 lines · Marek Vasut
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 againThis does not seem to have any adverse impact on power consumption in suspend.
Signed-off-by Marek Vasut <[email protected]>---
Cc: Ilias Apalodimas <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: [email protected]
Cc: [email protected]--- arch/arm/mach-stm32mp/include/mach/stm32.h | 2 + arch/arm/mach-stm32mp/psci.c | 66 ++++++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-)arch/arm/mach-stm32mp/include/mach/stm32.h +2
-0@@ -21,8 +21,10 @@#define STM32_DBGMCU_BASE 0x50081000#endif #define STM32_FMC2_BASE 0x58002000 +#define STM32_IWDG2_BASE 0x5A002000#define STM32_DDRCTRL_BASE 0x5A003000#define STM32_DDRPHYC_BASE 0x5A004000 +#define STM32_IWDG1_BASE 0x5C003000#define STM32_TZC_BASE 0x5C006000#define STM32_ETZPC_BASE 0x5C007000#define STM32_STGEN_BASE 0x5C008000arch/arm/mach-stm32mp/psci.c +61
-5@@ -161,6 +161,12 @@#define RCC_MP_GRSTCSETR_MPUP0RST BIT(4)#define RCC_MP_GRSTCSETR_MPUP1RST BIT(5) +/* IWDG */ +#define IWDG_KR 0x00 +#define IWDG_KR_RELOAD_KEY 0xaaaa +#define IWDG_EWCR 0x14 +#define IWDG_EWCR_EWIC BIT(14) +#define STM32MP1_PSCI_NR_CPUS 2#if STM32MP1_PSCI_NR_CPUS >CONFIG_ARMV7_PSCI_NR_CPUS #error "invalid value for CONFIG_ARMV7_PSCI_NR_CPUS"@@ -696,7 +702,18 @@ void __secure psci_system_suspend(u32 __always_unused function_id, u32 ep, u32 context_id) {u32 saved_mcudivr, saved_pll3cr, saved_pll4cr, saved_mssckselr; +u32 gicd_addr =stm32mp_get_gicd_base_address (); +bool iwdg1_wake = false; +bool iwdg2_wake = false; +bool other_wake = false;u32 saved_pwrctl, reg; +u32 gic_enabled[8 ]; +u32 irqs; +int i; + +/* Cache enable mask of all 256 SPI */ +for (i =0 ; i <ARRAY_SIZE (gic_enabled); i++) + gic_enabled[i] =readl (gicd_addr + GICD_ISENABLERn +0x4 +4 * i);/* Disable IO compensation */ @@ -725,11 +742,50 @@ void __secure psci_system_suspend(u32 __always_unused function_id,setbits_le32 (STM32_PWR_BASE +PWR_CR3 ,PWR_CR3_DDRSREN );writel (0x3 ,STM32_RCC_BASE +RCC_MP_SREQSETR ); -/* Zzz, enter stop mode */ - asmvolatile ( -"isb\n" -"dsb\n" -"wfi\n" ); +for (;;) { +/* Zzz, enter stop mode */ + asmvolatile ( +"isb\n" +"dsb\n" +"wfi\n" ); + +/* Determine the wake up source */ +for (i =0 ; i <ARRAY_SIZE (gic_enabled); i++) { + irqs =readl (gicd_addr + GICR_IGROUPMODRn +0x4 +4 * i); + irqs &= gic_enabled[i]; +if (!irqs) +continue ; + +/* Test whether IWDG pretimeout triggered the wake up. */ +if (i ==4 ) {/* SPI Num 128..159 */ + iwdg1_wake = !!(irqs &BIT (22 ));/* SPI 150 */ + iwdg2_wake = !!(irqs &BIT (23 ));/* SPI 151 */ + irqs &= ~(BIT (22 ) |BIT (23 )); + } + +/* Test whether there is any other wake up trigger. */ +if (irqs) { + other_wake = true; +break ; + } + } + +/* Other wake up triggers pending, let OS deal with all of it. */ +if (other_wake) +break ; + +/* Ping IWDG1 and ACK pretimer IRQ */ +if (iwdg1_wake) { +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 (iwdg2_wake) { +writel (IWDG_KR_RELOAD_KEY ,STM32_IWDG2_BASE +IWDG_KR ); +writel (IWDG_EWCR_EWIC ,STM32_IWDG2_BASE +IWDG_EWCR ); + } + }
Quoted 8 lines
arch/arm/mach-stm32mp/psci.c void __secure psci_system_suspend(u32 __always_unused function_id, · line 791
Quoted 2 lines
arch/arm/mach-stm32mp/psci.c +0
-0writel (0x3 ,STM32_RCC_BASE +RCC_MP_SREQCLRR );ddr_sw_self_refresh_exit ();Reviewed-by Patrice Chotard <[email protected]>Thanks
Patrice
On 5/11/23 08:39, Patrice CHOTARD wrote:
Hi,
Quoted 19 lines · Marek Vasut
Quoted 18 lines
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 againThis does not seem to have any adverse impact on power consumption in suspend.
[...]
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-stm32mp/psci.c +6
-0+/* Ping IWDG2 and ACK pretimer IRQ */ +if (iwdg2_wake) { +writel (IWDG_KR_RELOAD_KEY ,STM32_IWDG2_BASE +IWDG_KR ); +writel (IWDG_EWCR_EWIC ,STM32_IWDG2_BASE +IWDG_EWCR ); + } + }
Quoted 5 lines
Quoted 2 lines
writel(0x3, STM32_RCC_BASE + RCC_MP_SREQCLRR); ddr_sw_self_refresh_exit();Reviewed-by Patrice Chotard <[email protected]>
I feel like maybe I need to whack the IWDG also BEFORE entering suspend, expect a V2 shortly.
Do you think this IWDG approach is fine to keep the system from rebooting in suspend ? Or do you see any better option for the MP1 ?
Hi,
Quoted 36 lines · Marek Vasut
On 5/11/23 08:39, Patrice CHOTARD wrote:
Hi,
Quoted 19 lines · Marek Vasut
Quoted 18 lines
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 againThis does not seem to have any adverse impact on power consumption in suspend.
[...]
Quoted 10 lines
Quoted 8 lines
+ /* Ping IWDG2 and ACK pretimer IRQ */
+ if (iwdg2_wake) {
+writel(IWDG_KR_RELOAD_KEY, STM32_IWDG2_BASE + IWDG_KR); +writel(IWDG_EWCR_EWIC, STM32_IWDG2_BASE + IWDG_EWCR); + }
+ }
writel(0x3, STM32_RCC_BASE + RCC_MP_SREQCLRR);ddr_sw_self_refresh_exit();
Quoted 5 lines
Quoted 1 line
Reviewed-by Patrice Chotard <[email protected]>I feel like maybe I need to whack the IWDG also BEFORE entering suspend, expect a V2 shortly.
Do you think this IWDG approach is fine to keep the system from rebooting in suspend ? Or do you see any better option for the MP1 ?
I think it is fine if you want to have watchdog running in STANDBY even this patch force a wakeup.
but if IWDG 1 or 2 should be not running in STANDBY (but also for STOP) for your product,
it can be managed directly by the hardware with OTP, to freeze watchdog.
=> it is a decision for each product of the desired behavior of the IWDG in low power mode.
See Ref Manual: 48.3 IWDG implementation
Table 332. STM32MP157x IWDG features
Option bytes to control the activity in Standby mode (6)
6. Controlled via option bytes OTP_IWDG1_FZ_STANDBY and OTP_IWDG2_FZ_STANDBY, respectively, for IWDG1 and IWDG2.
and in Table17 => OTP 18 = HW2 bit 5 to 8
Regards
Patrick
Quoted 1 line · Patrick DELAUNAY
Hi,
Hi,
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
+ /* Ping IWDG2 and ACK pretimer IRQ */
+ if (iwdg2_wake) {
+writel(IWDG_KR_RELOAD_KEY, STM32_IWDG2_BASE + IWDG_KR); +writel(IWDG_EWCR_EWIC, STM32_IWDG2_BASE + IWDG_EWCR); + }
+ }
writel(0x3, STM32_RCC_BASE + RCC_MP_SREQCLRR);ddr_sw_self_refresh_exit();Reviewed-by Patrice Chotard <[email protected]>
Quoted 8 lines
Quoted 3 lines
I feel like maybe I need to whack the IWDG also BEFORE entering suspend, expect a V2 shortly.
Do you think this IWDG approach is fine to keep the system from rebooting in suspend ? Or do you see any better option for the MP1 ?
I think it is fine if you want to have watchdog running in STANDBY even this patch force a wakeup.
but if IWDG 1 or 2 should be not running in STANDBY (but also for STOP) for your product,
Why ?
I want the watchdog to monitor that the platform is still OK, even in suspend. Also, as far as I can tell, once the IWDG is started, it cannot be stopped, right ?
Quoted 7 lines
it can be managed directly by the hardware with OTP, to freeze watchdog.
=> it is a decision for each product of the desired behavior of the IWDG in low power mode.
See Ref Manual: 48.3 IWDG implementation
Quoted 7 lines
Table 332. STM32MP157x IWDG features
Option bytes to control the activity in Standby mode (6)
6. Controlled via option bytes
OTP_IWDG1_FZ_STANDBYandOTP_IWDG2_FZ_STANDBY, respectively, for IWDG1 and IWDG2.and in Table17 => OTP 18 = HW2 bit 5 to 8
I saw the OTP fuses, but I don't want to blow them. Or is that really the suggestion ST would provide for suspend/resume, blow the fuses ?
(I wonder, why isn't the logic of those fuses inverted then, i.e. by default stop the watchdog in suspend AND blow fuses to keep it running in suspend?)
Hi
Quoted 22 lines · Marek Vasut
Quoted 1 line · Patrick DELAUNAY
Hi,
Hi,
Quoted 17 lines
Quoted 15 lines
Quoted 11 lines
Quoted 8 lines
+ /* Ping IWDG2 and ACK pretimer IRQ */
+ if (iwdg2_wake) {
+writel(IWDG_KR_RELOAD_KEY, STM32_IWDG2_BASE + IWDG_KR); +writel(IWDG_EWCR_EWIC, STM32_IWDG2_BASE + IWDG_EWCR); + }
+ }
writel(0x3, STM32_RCC_BASE + RCC_MP_SREQCLRR);ddr_sw_self_refresh_exit();Reviewed-by Patrice Chotard <[email protected]>I feel like maybe I need to whack the IWDG also BEFORE entering suspend, expect a V2 shortly.
Do you think this IWDG approach is fine to keep the system from rebooting in suspend ? Or do you see any better option for the MP1 ?
Quoted 7 lines
Quoted 3 lines
I think it is fine if you want to have watchdog running in STANDBY even this patch force a wakeup.
but if IWDG 1 or 2 should be not running in STANDBY (but also for STOP) for your product,
Why ?
I want the watchdog to monitor that the platform is still OK, even in suspend. Also, as far as I can tell, once the IWDG is started, it cannot be stopped, right ?
without change OTP (so with the default behavior)
=> yes the watchdog IWDG is running without way to stop it.
Quoted 12 lines
Quoted 12 lines
it can be managed directly by the hardware with OTP, to freeze watchdog.
=> it is a decision for each product of the desired behavior of the IWDG in low power mode.
See Ref Manual: 48.3 IWDG implementation
Table 332. STM32MP157x IWDG features
Option bytes to control the activity in Standby mode (6)
Quoted 7 lines
Quoted 3 lines
6. Controlled via option bytes
OTP_IWDG1_FZ_STANDBYandOTP_IWDG2_FZ_STANDBY, respectively, for IWDG1 and IWDG2.and in Table17 => OTP 18 = HW2 bit 5 to 8
I saw the OTP fuses, but I don't want to blow them. Or is that really the suggestion ST would provide for suspend/resume, blow the fuses ?
(I wonder, why isn't the logic of those fuses inverted then, i.e. by default stop the watchdog in suspend AND blow fuses to keep it running in suspend?)
it is a SoC design choice => the default behavior is watchdog is running in standby and stop, so you need to reload it
That imply the limit of the duration of max duration of standby to avoid reset....
and the usage of IWDG pre-timeout in this case it a good place to wakeup the SoC
and add sanity checks (check the system is still running) before to reload it.
Patrick
Quoted 1 line · Patrick DELAUNAY
Hi
Hello Patrick,
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
+ /* Ping IWDG2 and ACK pretimer IRQ */
+ if (iwdg2_wake) {
+writel(IWDG_KR_RELOAD_KEY, STM32_IWDG2_BASE + IWDG_KR); +writel(IWDG_EWCR_EWIC, STM32_IWDG2_BASE + IWDG_EWCR); + }
+ }
writel(0x3, STM32_RCC_BASE + RCC_MP_SREQCLRR);ddr_sw_self_refresh_exit();Quoted 5 lines
Quoted 1 line
Reviewed-by Patrice Chotard <[email protected]>I feel like maybe I need to whack the IWDG also BEFORE entering suspend, expect a V2 shortly.
Do you think this IWDG approach is fine to keep the system from rebooting in suspend ? Or do you see any better option for the MP1 ?
I think it is fine if you want to have watchdog running in STANDBY even this patch force a wakeup.
but if IWDG 1 or 2 should be not running in STANDBY (but also for STOP) for your product,
Quoted 8 lines
Quoted 3 lines
Why ?
I want the watchdog to monitor that the platform is still OK, even in suspend. Also, as far as I can tell, once the IWDG is started, it cannot be stopped, right ?
without change OTP (so with the default behavior)
=> yes the watchdog IWDG is running without way to stop it.
ACK
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
it can be managed directly by the hardware with OTP, to freeze watchdog.
=> it is a decision for each product of the desired behavior of the IWDG in low power mode.
See Ref Manual: 48.3 IWDG implementation
Table 332. STM32MP157x IWDG features
Option bytes to control the activity in Standby mode (6)
Quoted 7 lines
Quoted 3 lines
6. Controlled via option bytes
OTP_IWDG1_FZ_STANDBYandOTP_IWDG2_FZ_STANDBY, respectively, for IWDG1 and IWDG2.and in Table17 => OTP 18 = HW2 bit 5 to 8
I saw the OTP fuses, but I don't want to blow them. Or is that really the suggestion ST would provide for suspend/resume, blow the fuses ?
(I wonder, why isn't the logic of those fuses inverted then, i.e. by default stop the watchdog in suspend AND blow fuses to keep it running in suspend?)
Quoted 7 lines
it is a SoC design choice => the default behavior is watchdog is running in standby and stop, so you need to reload it
That imply the limit of the duration of max duration of standby to avoid reset....
and the usage of IWDG pre-timeout in this case it a good place to wakeup the SoC
and add sanity checks (check the system is still running) before to reload it.
OK