linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] watchdog: da9062: Correct the timeout values
@ 2021-12-03 16:35 Christoph Niedermaier
  2021-12-03 16:52 ` Guenter Roeck
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Niedermaier @ 2021-12-03 16:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Christoph Niedermaier, Support Opensource, Adam Thomson,
	Wim Van Sebroeck, Guenter Roeck, Andrej Picej, linux-watchdog,
	linux-kernel

I measured the timeout values of my DA9061 chip. According to the
information in the data sheet the formula should be:

timeout = 2.048 * 2^(regval - 1)

But my measured values differ from that.
Accoring to my measured values the formula must be:

timeout = 3.2 * 2^(regval - 1)

Is there something wrong with my chip, or has anyone else noticed this as well?

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Andrej Picej <andrej.picej@norik.com>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
To: linux-arm-kernel@lists.infradead.org
---
 drivers/watchdog/da9062_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index f02cbd530538..d2576aba9ca5 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -20,7 +20,8 @@
 #include <linux/regmap.h>
 #include <linux/of.h>
 
-static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 };
+static const unsigned int wdt_timeout[] = { 0, 3, 6, 12, 25, 51, 102, 204 };
+
 #define DA9062_TWDSCALE_DISABLE		0
 #define DA9062_TWDSCALE_MIN		1
 #define DA9062_TWDSCALE_MAX		(ARRAY_SIZE(wdt_timeout) - 1)
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] watchdog: da9062: Correct the timeout values
  2021-12-03 16:35 [RFC PATCH] watchdog: da9062: Correct the timeout values Christoph Niedermaier
@ 2021-12-03 16:52 ` Guenter Roeck
  2021-12-03 17:31   ` Christoph Niedermaier
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2021-12-03 16:52 UTC (permalink / raw)
  To: Christoph Niedermaier, linux-arm-kernel
  Cc: Support Opensource, Adam Thomson, Wim Van Sebroeck, Andrej Picej,
	linux-watchdog, linux-kernel

On 12/3/21 8:35 AM, Christoph Niedermaier wrote:
> I measured the timeout values of my DA9061 chip. According to the
> information in the data sheet the formula should be:
> 
> timeout = 2.048 * 2^(regval - 1)
> 
> But my measured values differ from that.
> Accoring to my measured values the formula must be:
> 
> timeout = 3.2 * 2^(regval - 1)
> 
> Is there something wrong with my chip, or has anyone else noticed this as well?

The driver assumes a static and well defined clock rate. Maybe that rate
is different in your system (if that is possible) ?

Guenter

> 
> Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
> Cc: Support Opensource <support.opensource@diasemi.com>
> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Andrej Picej <andrej.picej@norik.com>
> Cc: linux-watchdog@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> To: linux-arm-kernel@lists.infradead.org
> ---
>   drivers/watchdog/da9062_wdt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index f02cbd530538..d2576aba9ca5 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -20,7 +20,8 @@
>   #include <linux/regmap.h>
>   #include <linux/of.h>
>   
> -static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 };
> +static const unsigned int wdt_timeout[] = { 0, 3, 6, 12, 25, 51, 102, 204 };
> +
>   #define DA9062_TWDSCALE_DISABLE		0
>   #define DA9062_TWDSCALE_MIN		1
>   #define DA9062_TWDSCALE_MAX		(ARRAY_SIZE(wdt_timeout) - 1)
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC PATCH] watchdog: da9062: Correct the timeout values
  2021-12-03 16:52 ` Guenter Roeck
@ 2021-12-03 17:31   ` Christoph Niedermaier
  2021-12-06  7:29     ` Andrej Picej
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Niedermaier @ 2021-12-03 17:31 UTC (permalink / raw)
  To: linux-arm-kernel@lists.infradead.org
  Cc: Support Opensource, Adam Thomson, Wim Van Sebroeck, Andrej Picej,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck

From: Guenter Roeck
Sent: Friday, December 3, 2021 5:52 PM
> On 12/3/21 8:35 AM, Christoph Niedermaier wrote:
>> I measured the timeout values of my DA9061 chip. According to the
>> information in the data sheet the formula should be:
>>
>> timeout = 2.048 * 2^(regval - 1)
>>
>> But my measured values differ from that.
>> Accoring to my measured values the formula must be:
>>
>> timeout = 3.2 * 2^(regval - 1)
>>
>> Is there something wrong with my chip, or has anyone else noticed this as well?
> 
> The driver assumes a static and well defined clock rate. Maybe that rate
> is different in your system (if that is possible) ?
> 
> Guenter

@Andrej
Do the values in the driver match what your chip does?

I have not changed anything. After power on, the chip behaves like this.
So I guess it either come from an OTP value or the wiring outside the chip.
Does anyone know what needs to be checked?

Thanks and regards
Christoph

>> Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
>> Cc: Support Opensource <support.opensource@diasemi.com>
>> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
>> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
>> Cc: Guenter Roeck <linux@roeck-us.net>
>> Cc: Andrej Picej <andrej.picej@norik.com>
>> Cc: linux-watchdog@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> To: linux-arm-kernel@lists.infradead.org
>> ---
>>   drivers/watchdog/da9062_wdt.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
>> index f02cbd530538..d2576aba9ca5 100644
>> --- a/drivers/watchdog/da9062_wdt.c
>> +++ b/drivers/watchdog/da9062_wdt.c
>> @@ -20,7 +20,8 @@
>>   #include <linux/regmap.h>
>>   #include <linux/of.h>
>>
>> -static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 };
>> +static const unsigned int wdt_timeout[] = { 0, 3, 6, 12, 25, 51, 102, 204 };
>> +
>>   #define DA9062_TWDSCALE_DISABLE             0
>>   #define DA9062_TWDSCALE_MIN         1
>>   #define DA9062_TWDSCALE_MAX         (ARRAY_SIZE(wdt_timeout) - 1)
>>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] watchdog: da9062: Correct the timeout values
  2021-12-03 17:31   ` Christoph Niedermaier
@ 2021-12-06  7:29     ` Andrej Picej
  2021-12-06  7:47       ` Christoph Niedermaier
  0 siblings, 1 reply; 7+ messages in thread
From: Andrej Picej @ 2021-12-06  7:29 UTC (permalink / raw)
  To: Christoph Niedermaier, linux-arm-kernel@lists.infradead.org
  Cc: Support Opensource, Adam Thomson, Wim Van Sebroeck,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck



On 3. 12. 21 18:31, Christoph Niedermaier wrote:
> From: Guenter Roeck
> Sent: Friday, December 3, 2021 5:52 PM
>> On 12/3/21 8:35 AM, Christoph Niedermaier wrote:
>>> I measured the timeout values of my DA9061 chip. According to the
>>> information in the data sheet the formula should be:
>>>
>>> timeout = 2.048 * 2^(regval - 1)
>>>
>>> But my measured values differ from that.
>>> Accoring to my measured values the formula must be:
>>>
>>> timeout = 3.2 * 2^(regval - 1)
>>>
>>> Is there something wrong with my chip, or has anyone else noticed this as well?
>>
>> The driver assumes a static and well defined clock rate. Maybe that rate
>> is different in your system (if that is possible) ?
>>
>> Guenter
> 
> @Andrej
> Do the values in the driver match what your chip does?
> 

Just did a quick test. The values in the driver match what the chip 
does. I checked multiple timeouts 16, 32, 65 and 131 seconds. The 
timeout triggers quite accurately.

> I have not changed anything. After power on, the chip behaves like this.
> So I guess it either come from an OTP value or the wiring outside the chip.
> Does anyone know what needs to be checked?

Can't help you here, sorry.

Best regards,
Andrej

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC PATCH] watchdog: da9062: Correct the timeout values
  2021-12-06  7:29     ` Andrej Picej
@ 2021-12-06  7:47       ` Christoph Niedermaier
  2021-12-06 16:37         ` Adam Thomson
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Niedermaier @ 2021-12-06  7:47 UTC (permalink / raw)
  To: Andrej Picej, linux-arm-kernel@lists.infradead.org, Adam Thomson
  Cc: Support Opensource, Wim Van Sebroeck,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck

From: Andrej Picej
Sent: Monday, December 6, 2021 8:29 AM
>>>> I measured the timeout values of my DA9061 chip. According to the
>>>> information in the data sheet the formula should be:
>>>>
>>>> timeout = 2.048 * 2^(regval - 1)
>>>>
>>>> But my measured values differ from that.
>>>> Accoring to my measured values the formula must be:
>>>>
>>>> timeout = 3.2 * 2^(regval - 1)
>>>>
>>>> Is there something wrong with my chip, or has anyone else noticed this as well?
>>>
>>> The driver assumes a static and well defined clock rate. Maybe that rate
>>> is different in your system (if that is possible) ?
>>>
>>> Guenter
>>
>> @Andrej
>> Do the values in the driver match what your chip does?
>>
> 
> Just did a quick test. The values in the driver match what the chip
> does. I checked multiple timeouts 16, 32, 65 and 131 seconds. The
> timeout triggers quite accurately.
> 
>> I have not changed anything. After power on, the chip behaves like this.
>> So I guess it either come from an OTP value or the wiring outside the chip.
>> Does anyone know what needs to be checked?
> 
> Can't help you here, sorry.
> 

Thanks anyway, so now I know it must be
problem with my DA9061 chip.

@Adam
Where can it come from?
Can you give we a hint what to check?


Thanks and best regards
Christoph
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC PATCH] watchdog: da9062: Correct the timeout values
  2021-12-06  7:47       ` Christoph Niedermaier
@ 2021-12-06 16:37         ` Adam Thomson
  2021-12-07 15:17           ` Christoph Niedermaier
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Thomson @ 2021-12-06 16:37 UTC (permalink / raw)
  To: Christoph Niedermaier, Andrej Picej,
	linux-arm-kernel@lists.infradead.org, Adam Thomson
  Cc: Support Opensource, Wim Van Sebroeck,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck

> Thanks anyway, so now I know it must be
> problem with my DA9061 chip.
>
> @Adam
> Where can it come from?
> Can you give we a hint what to check?

I've spoken internally and have been informed that this is down to the fact that
DA9061 runs only from an internal oscillator which may be slower. The indication
is that the values for TWDSCALE describe the window where if a kick/ping occurs
within that period then the watchdog is guaranteed *not* to timeout. The actual
timeout would be at some point after the selected timeout period, assuming no
ping/kick occurred.

Table 8 in the datasheet specifies a minimum watchdog timeout of 2.5s (tWDMAX)
under specific operating conditions, so if the minimum 2s window was chosen
(TWDSCALE = 1) then earliest the watchdog would actually timeout, following a
ping, is 2.5s, assuming the conditions matched those described.

If you have further questions it probably makes sense to contact Dialog/Renesas
support as they will be able to provide more detailed info on this.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC PATCH] watchdog: da9062: Correct the timeout values
  2021-12-06 16:37         ` Adam Thomson
@ 2021-12-07 15:17           ` Christoph Niedermaier
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Niedermaier @ 2021-12-07 15:17 UTC (permalink / raw)
  To: Adam Thomson, Andrej Picej, linux-arm-kernel@lists.infradead.org
  Cc: Support Opensource, Wim Van Sebroeck,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck

From: Adam Thomson
Sent: Monday, December 6, 2021 5:38 PM
>> Thanks anyway, so now I know it must be
>> problem with my DA9061 chip.
>>
>> @Adam
>> Where can it come from?
>> Can you give we a hint what to check?
> 
> I've spoken internally and have been informed that this is down to the fact that
> DA9061 runs only from an internal oscillator which may be slower. The indication
> is that the values for TWDSCALE describe the window where if a kick/ping occurs
> within that period then the watchdog is guaranteed *not* to timeout. The actual
> timeout would be at some point after the selected timeout period, assuming no
> ping/kick occurred.
> 
> Table 8 in the datasheet specifies a minimum watchdog timeout of 2.5s (tWDMAX)
> under specific operating conditions, so if the minimum 2s window was chosen
> (TWDSCALE = 1) then earliest the watchdog would actually timeout, following a
> ping, is 2.5s, assuming the conditions matched those described.
> 
> If you have further questions it probably makes sense to contact Dialog/Renesas
> support as they will be able to provide more detailed info on this.

So a DA9061 runs only from an internal oscillator, whereas a DA9062
can run on either an internal or an external oscillator. So this
means that the DA9061 timeout values are differ from the DA9062 
with an external oscillator not only on my device but on all DA9061
devices.

This are the values (in seconds) in comparison:
DA9062 (from driver): 0  2  4   8  16  32  65 131
DA9061 (measured):    0  3  6  12  25  51 102 204
=================================================
Difference:           0 +1 +2  +4  +9 +19 +37 +73

In my opinion, the differences in the higher values are very huge.
If I expect that the watchdog triggers and I have to wait more than
a minute for that to happen I ask myself is there something wrong.

@Andrej
I guess, you are using an external oscillator, aren't you?

@Adam
Is there a way to check in the driver which oscillator is in use?

@Maintainers
Is in the driver a need to distinguish between an external and an
internal oscillator to get the timeout values more accurate?


Best regards
Christoph
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-07 15:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-03 16:35 [RFC PATCH] watchdog: da9062: Correct the timeout values Christoph Niedermaier
2021-12-03 16:52 ` Guenter Roeck
2021-12-03 17:31   ` Christoph Niedermaier
2021-12-06  7:29     ` Andrej Picej
2021-12-06  7:47       ` Christoph Niedermaier
2021-12-06 16:37         ` Adam Thomson
2021-12-07 15:17           ` Christoph Niedermaier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).