[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f455295-9c48-c9a7-8d70-90339833eb94@roeck-us.net>
Date: Wed, 11 Nov 2020 06:41:59 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>,
"mazziesaccount@...il.com" <mazziesaccount@...il.com>
Cc: "wim@...ux-watchdog.org" <wim@...ux-watchdog.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
linux-power <linux-power@...rohmeurope.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lee.jones@...aro.org" <lee.jones@...aro.org>,
"linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>
Subject: Re: [PATCH v5 3/4] wdt: Support wdt on ROHM BD9576MUF and BD9573MUF
On 11/11/20 6:01 AM, Vaittinen, Matti wrote:
> On Thu, 2020-11-05 at 13:38 +0200, Matti Vaittinen wrote:
>> Add Watchdog support for ROHM BD9576MUF and BD9573MUF PMICs which are
>> mainly used to power the R-Car series processors. The watchdog is
>> pinged using a GPIO and enabled using another GPIO. Additionally
>> watchdog time-out can be configured to HW prior starting the
>> watchdog.
>> Watchdog timeout can be configured to detect only delayed ping or in
>> a window mode where also too fast pings are detected.
>>
>> Signed-off-by: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
>> Reviewed-by: Guenter Roeck <linux@...ck-us.net>
>> ---
>>
>
> //snip
>
>> + ret = of_property_read_variable_u32_array(np, "rohm,hw-timeout-
>> ms",
>> + &hw_margin[0], 1, 2);
>> + if (ret < 0 && ret != -EINVAL)
>> + return ret;
>> +
>> + if (ret == 1)
>> + hw_margin_max = hw_margin[0];
>> +
>> + if (ret == 2) {
>> + hw_margin_max = hw_margin[1];
>> + hw_margin_min = hw_margin[0];
>> + }
>> +
>> + ret = bd957x_set_wdt_mode(priv, hw_margin_max, hw_margin_min);
>> + if (ret)
>> + return ret;
>> +
>> + priv->always_running = of_property_read_bool(np, "always-
>> running");
>> +
>> + watchdog_set_drvdata(&priv->wdd, priv);
>> +
>> + priv->wdd.info = &bd957x_wdt_ident;
>> + priv->wdd.ops = &bd957x_wdt_ops;
>> + priv->wdd.min_hw_heartbeat_ms = hw_margin_min;
>> + priv->wdd.max_hw_heartbeat_ms = hw_margin_max;
>> + priv->wdd.parent = dev;
>> + priv->wdd.timeout = (hw_margin_max / 2) * 1000;
>
> Hmm. Just noticed this value does not make sense, right?
> Maximum hw_margin is 4416 ms. If I read this correctly timeout should
> be in seconds - so result is around 2 000 000 seconds here. I think it
> is useless value...
>
> Perhaps
> priv->wdd.timeout = (hw_margin_max / 2) / 1000;
> if (!priv->wdd.timeout)
> priv->wdd.timeout = 1;
> would be more appropriate.
>
Yes. Good catch. Actually, since max_hw_heartbeat_ms is specified,
it can and should be a reasonable constant (like the usual 30 seconds).
It does not and should not be bound by max_hw_heartbeat_ms.
> I need to do some testing when I get the HW at my hands - please don't
> apply this patch just yet. I will respin this after some testing - or
> if other patches are applied then I will just send this one alone.
>
> Sorry for the hassle...
>
No worries. Thanks for noticing.
Guenter
> --Matti
>
> --
> Matti Vaittinen, Linux device drivers
> ROHM Semiconductors, Finland SWDC
> Kiviharjunlenkki 1E
> 90220 OULU
> FINLAND
>
> ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
>
> Simon says - in Latin please.
> "non cogito me" dixit Rene Descarte, deinde evanescavit
>
> (Thanks for the translation Simon)
>
Powered by blists - more mailing lists