Re: [PATCH 2/2] watchdog: Add Nuvoton NPCM watchdog driver

From: Joel Stanley
Date: Mon Mar 05 2018 - 00:43:56 EST


On Sat, Mar 3, 2018 at 12:29 AM, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
>> +static int npcm_wdt_start(struct watchdog_device *wdd)
>> +{
>> + struct npcm_wdt *wdt = to_npcm_wdt(wdd);
>> + u32 val;
>> +
>> + val = NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE;
>> +
>> + if (wdd->timeout < 2)
>> + val |= 0x800;
>> + else if (wdd->timeout < 3)
>> + val |= 0x420;
>> + else if (wdd->timeout < 6)
>> + val |= 0x810;
>> + else if (wdd->timeout < 11)
>> + val |= 0x430;
>> + else if (wdd->timeout < 22)
>> + val |= 0x820;
>> + else if (wdd->timeout < 44)
>> + val |= 0xC00;
>> + else if (wdd->timeout < 87)
>> + val |= 0x830;
>> + else if (wdd->timeout < 173)
>> + val |= 0xC10;
>> + else if (wdd->timeout < 688)
>> + val |= 0xC20;
>> + else if (wdd->timeout < 2751)
>> + val |= 0xC30;
>> + else
>> + val |= 0x830;
>
>
> I am lost here. If the requested timeout is 2751, the actual timeout
> is set to 85.6 seconds. Why ?
>

I suspect this was the default, so the original code decided to fall
back to this value.

I think it would make more sense to use 2750.

Cheers,

Joel