[PATCH 1/4 v5] watchdog: Implement generic watchdog_reset() version

Stefan Roese sr at denx.de
Thu Feb 20 07:43:30 CET 2020


On 20.02.20 07:38, Christophe Leroy wrote:

<snip>

>>>> +void watchdog_reset(void)
>>>> +{
>>>> +    static ulong next_reset;
>>>> +    ulong now;
>>>> +
>>>> +    /* Exit if GD is not ready or watchdog is not initialized yet */
>>>> +    if (!gd || !(gd->flags & GD_FLG_WDT_READY))
>>>> +        return;
>>>> +
>>>> +    /* Do not reset the watchdog too often */
>>>> +    now = get_timer(0);
>>>> +    if (now > next_reset) {
>>>> +        next_reset = now + 1000;    /* reset every 1000ms */
>>>> +        wdt_reset(gd->watchdog_dev);
>>>> +    }
>>>
>>> This is a problem for the MPC8xx.
>>>
>>> When running with a MPC8xx at 132MHz clock, the watchdog will fire 
>>> about 1s after the last refresh. So the above makes the board unusable.
>>
>> So you need a shorted delay between the wdt_reset() calls? Is this
>> correct? We could introduce a new Kconfig option which defaults to
>> 1000 (ms) and you can "select" a shorter value for MPC8xx.
> 
> Exactly. However, why is this limitation needed at all ? Why is it a 
> problem to refresh more often ?

Very likely its not. What is a reasonable value for your platform? 100
or 500ms? I think we could change it to default to a shorter value, but
such a change should go in early in the merge window, so that other
platforms have a bit of time to test it.

Please feel free to send a patch for this and please add a comment to
explain, why the delay is this "short".

Thanks,
Stefan


More information about the U-Boot mailing list