Re: [PATCH V3] watchdog: mtk: support pre-timeout when the bark irq is available

From: Guenter Roeck
Date: Thu Apr 15 2021 - 09:29:19 EST


On 4/15/21 2:40 AM, 王擎 wrote:

>
> Yes, as mentioned before, the behavior of WDT_MODE_IRQ_EN is use irq instead of
> reset, so we must use WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN if like you said
> "the first time generating an interrupt and the second time resetting the system" .
>
> The Dual mode is mentioned in the MTK datasheet:
> In this mode, the watchdog will be AUTO-RESTART after interrupt is triggered.
> AP need to clear WDT_STA after receiving interrupt from TOPRGU, or system reset
> will be triggered after watchdog timer expires.
> Instructions for use:
> Set wdt_en = 1'b1.
> Set dual_mode = 1'b1.
> Set wdt_irq = 1'b1.
>
> We can use Dual mode to achieve pretimeout behavior, only in this way can we
> get more information during pretimeout processing, instead of directly resetting.
>

If so, the pretimeout would always be half of the full timeout, and the timeout
to configure would be timeout / 2. The code would have to adjust the pretimeout
time accordingly. Also, to avoid unexpected and changed behavior, the prefimeout
should by default be disabled.

Guenter