[PATCH v4] watchdog: stm32_iwdg: Add pretimeout support
Clement LE GOFFIC
clement.legoffic at foss.st.com
Wed Dec 11 01:02:17 PST 2024
On 4/15/24 15:48, 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 3/4 of the WDT timeout cycle.
>
> Reviewed-by: Clément Le Goffic <clement.legoffic at foss.st.com>
> Tested-by: Clément Le Goffic <clement.legoffic at foss.st.com>
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Alexandre Torgue <alexandre.torgue at foss.st.com>
> Cc: Guenter Roeck <linux at roeck-us.net>
> Cc: Maxime Coquelin <mcoquelin.stm32 at gmail.com>
> Cc: Wim Van Sebroeck <wim at linux-watchdog.org>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-stm32 at st-md-mailman.stormreply.com
> Cc: linux-watchdog at vger.kernel.org
> ---
> V2: - Subtract the pretimeout value from timeout value before writing it
> into the IWDG pretimeout register, because the watchdog counter
> register is counting down, and the pretimeout interrupt triggers
> when watchdog counter register matches the pretimeout register
> content.
> - Set default pretimeout to 3/4 of timeout .
> V3: - Use dev instead of pdev->dev
> - Swap order of ret/return 0
> - Split this from the DT changes, which are orthogonal
> - Uh, this patch got stuck in upstreaming queue, sorry
> V4: - Update commit message to match V2 default pretimeout to 3/4
> - Add RB/TB from Clément
> ---
> drivers/watchdog/stm32_iwdg.c | 95 ++++++++++++++++++++++++++++++++++-
> 1 file changed, 94 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
> index 5404e03876202..d700e0d49bb95 100644
> --- a/drivers/watchdog/stm32_iwdg.c
> +++ b/drivers/watchdog/stm32_iwdg.c
>
> [.....]
>
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq <= 0)
> + return 0;
Hi Marek,
After re-evaluating this patch, it seems it lacks of a dt-bindings
update that tackles the 'interrupts' property you are adding.
That said, the interrupt line should not be mandatory for the driver to
probe. For backward compatibility with existing DT, I recommend to use
the 'platform_get_irq_optional()' API to not fail during the probe of
the driver.
Best regards,
Clément
More information about the linux-arm-kernel
mailing list