[Linux-stm32] [PATCH v3] watchdog: stm32_iwdg: Add pretimeout support

Clement LE GOFFIC clement.legoffic at foss.st.com
Mon Apr 15 06:10:15 PDT 2024


Hello Marek,

On 3/21/24 02:11, Marek Vasut wrote:
> The STM32MP15xx IWDG adds registers which permit this IP to generate
> pretimeout interrupt. This interrupt can also be used to wake the CPU
> from suspend. Implement support for generating this interrupt and let
> userspace configure the pretimeout. In case the pretimeout is not
> configured by user, set pretimeout to half of the WDT timeout cycle.

 From the code below I see that the pretimeout is set to 75% and not 50% 
as you said.
For the rest you can put as you want :
Reviewed-by: Clément Le Goffic <clement.legoffic at foss.st.com>
or
Tested-by: Clément Le Goffic <clement.legoffic at foss.st.com>

> ...
>   
> @@ -88,13 +97,18 @@ static inline void reg_write(void __iomem *base, u32 reg, u32 val)
>   static int stm32_iwdg_start(struct watchdog_device *wdd)
>   {
>   	struct stm32_iwdg *wdt = watchdog_get_drvdata(wdd);
> -	u32 tout, presc, iwdg_rlr, iwdg_pr, iwdg_sr;
> +	u32 tout, ptot, presc, iwdg_rlr, iwdg_ewcr, iwdg_pr, iwdg_sr;
>   	int ret;
>   
>   	dev_dbg(wdd->parent, "%s\n", __func__);
>   
> +	if (!wdd->pretimeout)
> +		wdd->pretimeout = 3 * wdd->timeout / 4;
> +
> ...
Here is the 75% pretimeout.

Best regards,

Clément



More information about the linux-arm-kernel mailing list