All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-06 11:32   ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-06 11:32 UTC (permalink / raw)
  To: Santosh Shilimkar, wim, nsekhar, linux-watchdog, devicetree
  Cc: grant.likely, rob.herring, pawel.moll, mark.rutland, swarren,
	galak, ijc+devicetree, linux-kernel, linux-arm-kernel

When watchdog timer is expired we can know about it thought
GET_STATUS ioctl option.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 6cbf2e1..a371b2d 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -144,6 +144,18 @@ static unsigned int davinci_wdt_get_timeleft(struct watchdog_device *wdd)
 	return wdd->timeout - timer_counter;
 }
 
+static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
+{
+	u32 val;
+	struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
+
+	val = ioread32(davinci_wdt->base + WDTCR);
+	if (val & WDFLAG)
+		return WDIOF_CARDRESET;
+
+	return 0;
+}
+
 static const struct watchdog_info davinci_wdt_info = {
 	.options = WDIOF_KEEPALIVEPING,
 	.identity = "DaVinci Watchdog",
@@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
 	.stop		= davinci_wdt_ping,
 	.ping		= davinci_wdt_ping,
 	.get_timeleft	= davinci_wdt_get_timeleft,
+	.status		= davinci_wdt_status,
 };
 
 static int davinci_wdt_probe(struct platform_device *pdev)
-- 
1.7.9.5




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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-06 11:32   ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-06 11:32 UTC (permalink / raw)
  To: Santosh Shilimkar, wim-IQzOog9fTRqzQB+pC5nmwQ,
	nsekhar-l0cyMroinI0, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

When watchdog timer is expired we can know about it thought
GET_STATUS ioctl option.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
---
 drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 6cbf2e1..a371b2d 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -144,6 +144,18 @@ static unsigned int davinci_wdt_get_timeleft(struct watchdog_device *wdd)
 	return wdd->timeout - timer_counter;
 }
 
+static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
+{
+	u32 val;
+	struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
+
+	val = ioread32(davinci_wdt->base + WDTCR);
+	if (val & WDFLAG)
+		return WDIOF_CARDRESET;
+
+	return 0;
+}
+
 static const struct watchdog_info davinci_wdt_info = {
 	.options = WDIOF_KEEPALIVEPING,
 	.identity = "DaVinci Watchdog",
@@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
 	.stop		= davinci_wdt_ping,
 	.ping		= davinci_wdt_ping,
 	.get_timeleft	= davinci_wdt_get_timeleft,
+	.status		= davinci_wdt_status,
 };
 
 static int davinci_wdt_probe(struct platform_device *pdev)
-- 
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-06 11:32   ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-06 11:32 UTC (permalink / raw)
  To: linux-arm-kernel

When watchdog timer is expired we can know about it thought
GET_STATUS ioctl option.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 6cbf2e1..a371b2d 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -144,6 +144,18 @@ static unsigned int davinci_wdt_get_timeleft(struct watchdog_device *wdd)
 	return wdd->timeout - timer_counter;
 }
 
+static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
+{
+	u32 val;
+	struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
+
+	val = ioread32(davinci_wdt->base + WDTCR);
+	if (val & WDFLAG)
+		return WDIOF_CARDRESET;
+
+	return 0;
+}
+
 static const struct watchdog_info davinci_wdt_info = {
 	.options = WDIOF_KEEPALIVEPING,
 	.identity = "DaVinci Watchdog",
@@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
 	.stop		= davinci_wdt_ping,
 	.ping		= davinci_wdt_ping,
 	.get_timeleft	= davinci_wdt_get_timeleft,
+	.status		= davinci_wdt_status,
 };
 
 static int davinci_wdt_probe(struct platform_device *pdev)
-- 
1.7.9.5

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
  2013-11-06 11:32   ` ivan.khoronzhuk
  (?)
@ 2013-11-12 15:38     ` Santosh Shilimkar
  -1 siblings, 0 replies; 17+ messages in thread
From: Santosh Shilimkar @ 2013-11-12 15:38 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: wim, nsekhar, linux-watchdog, devicetree, grant.likely,
	rob.herring, pawel.moll, mark.rutland, swarren, galak,
	ijc+devicetree, linux-kernel, linux-arm-kernel

On Wednesday 06 November 2013 06:32 AM, ivan.khoronzhuk wrote:
> When watchdog timer is expired we can know about it thought
> GET_STATUS ioctl option.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>


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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-12 15:38     ` Santosh Shilimkar
  0 siblings, 0 replies; 17+ messages in thread
From: Santosh Shilimkar @ 2013-11-12 15:38 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: mark.rutland, devicetree, linux-watchdog, pawel.moll, swarren,
	ijc+devicetree, nsekhar, galak, rob.herring, linux-kernel, wim,
	grant.likely, linux-arm-kernel

On Wednesday 06 November 2013 06:32 AM, ivan.khoronzhuk wrote:
> When watchdog timer is expired we can know about it thought
> GET_STATUS ioctl option.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>

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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-12 15:38     ` Santosh Shilimkar
  0 siblings, 0 replies; 17+ messages in thread
From: Santosh Shilimkar @ 2013-11-12 15:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 06 November 2013 06:32 AM, ivan.khoronzhuk wrote:
> When watchdog timer is expired we can know about it thought
> GET_STATUS ioctl option.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-17  2:24     ` Guenter Roeck
  0 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2013-11-17  2:24 UTC (permalink / raw)
  To: ivan.khoronzhuk, Santosh Shilimkar, wim, nsekhar, linux-watchdog,
	devicetree
  Cc: grant.likely, rob.herring, pawel.moll, mark.rutland, swarren,
	galak, ijc+devicetree, linux-kernel, linux-arm-kernel

On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
> When watchdog timer is expired we can know about it thought

thought -> through or with

> GET_STATUS ioctl option.
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index 6cbf2e1..a371b2d 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -144,6 +144,18 @@ static unsigned int davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>   	return wdd->timeout - timer_counter;
>   }
>
> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
> +{
> +	u32 val;
> +	struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
> +
> +	val = ioread32(davinci_wdt->base + WDTCR);
> +	if (val & WDFLAG)
> +		return WDIOF_CARDRESET;
> +
	"Card previously reset the CPU"

Is this really accurate / correct ?

My understanding is that the status is supposed to return the reason for a previous reset/reboot,
not the curent condition.

> +	return 0;
> +}
> +
>   static const struct watchdog_info davinci_wdt_info = {
>   	.options = WDIOF_KEEPALIVEPING,
>   	.identity = "DaVinci Watchdog",
> @@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
>   	.stop		= davinci_wdt_ping,
>   	.ping		= davinci_wdt_ping,
>   	.get_timeleft	= davinci_wdt_get_timeleft,
> +	.status		= davinci_wdt_status,
>   };
>
>   static int davinci_wdt_probe(struct platform_device *pdev)
>


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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-17  2:24     ` Guenter Roeck
  0 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2013-11-17  2:24 UTC (permalink / raw)
  To: ivan.khoronzhuk, Santosh Shilimkar, wim-IQzOog9fTRqzQB+pC5nmwQ,
	nsekhar-l0cyMroinI0, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
> When watchdog timer is expired we can know about it thought

thought -> through or with

> GET_STATUS ioctl option.
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
> ---
>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index 6cbf2e1..a371b2d 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -144,6 +144,18 @@ static unsigned int davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>   	return wdd->timeout - timer_counter;
>   }
>
> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
> +{
> +	u32 val;
> +	struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
> +
> +	val = ioread32(davinci_wdt->base + WDTCR);
> +	if (val & WDFLAG)
> +		return WDIOF_CARDRESET;
> +
	"Card previously reset the CPU"

Is this really accurate / correct ?

My understanding is that the status is supposed to return the reason for a previous reset/reboot,
not the curent condition.

> +	return 0;
> +}
> +
>   static const struct watchdog_info davinci_wdt_info = {
>   	.options = WDIOF_KEEPALIVEPING,
>   	.identity = "DaVinci Watchdog",
> @@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
>   	.stop		= davinci_wdt_ping,
>   	.ping		= davinci_wdt_ping,
>   	.get_timeleft	= davinci_wdt_get_timeleft,
> +	.status		= davinci_wdt_status,
>   };
>
>   static int davinci_wdt_probe(struct platform_device *pdev)
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-17  2:24     ` Guenter Roeck
  0 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2013-11-17  2:24 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
> When watchdog timer is expired we can know about it thought

thought -> through or with

> GET_STATUS ioctl option.
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index 6cbf2e1..a371b2d 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -144,6 +144,18 @@ static unsigned int davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>   	return wdd->timeout - timer_counter;
>   }
>
> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
> +{
> +	u32 val;
> +	struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
> +
> +	val = ioread32(davinci_wdt->base + WDTCR);
> +	if (val & WDFLAG)
> +		return WDIOF_CARDRESET;
> +
	"Card previously reset the CPU"

Is this really accurate / correct ?

My understanding is that the status is supposed to return the reason for a previous reset/reboot,
not the curent condition.

> +	return 0;
> +}
> +
>   static const struct watchdog_info davinci_wdt_info = {
>   	.options = WDIOF_KEEPALIVEPING,
>   	.identity = "DaVinci Watchdog",
> @@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
>   	.stop		= davinci_wdt_ping,
>   	.ping		= davinci_wdt_ping,
>   	.get_timeleft	= davinci_wdt_get_timeleft,
> +	.status		= davinci_wdt_status,
>   };
>
>   static int davinci_wdt_probe(struct platform_device *pdev)
>

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-18 14:21       ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-18 14:21 UTC (permalink / raw)
  To: Guenter Roeck, Santosh Shilimkar, wim, nsekhar, linux-watchdog,
	devicetree
  Cc: grant.likely, rob.herring, pawel.moll, mark.rutland, swarren,
	galak, ijc+devicetree, linux-kernel, linux-arm-kernel

On 11/17/2013 04:24 AM, Guenter Roeck wrote:
> On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
>> When watchdog timer is expired we can know about it thought
> 
> thought -> through or with
> 

Ok

>> GET_STATUS ioctl option.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>> ---
>>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/watchdog/davinci_wdt.c 
>> b/drivers/watchdog/davinci_wdt.c
>> index 6cbf2e1..a371b2d 100644
>> --- a/drivers/watchdog/davinci_wdt.c
>> +++ b/drivers/watchdog/davinci_wdt.c
>> @@ -144,6 +144,18 @@ static unsigned int 
>> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>>       return wdd->timeout - timer_counter;
>>   }
>>
>> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
>> +{
>> +    u32 val;
>> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
>> +
>> +    val = ioread32(davinci_wdt->base + WDTCR);
>> +    if (val & WDFLAG)
>> +        return WDIOF_CARDRESET;
>> +
>      "Card previously reset the CPU"
> 
> Is this really accurate / correct ?
> 
> My understanding is that the status is supposed to return the reason for 
> a previous reset/reboot,
> not the curent condition.
> 

Actually it is not so good correlate with the purpose, but I grasped
several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
After the WDT is overflowed it sets WDFLAG, so I can use it.
It is more useful while debugging and if it is doubtful I can drop it.

>> +    return 0;
>> +}
>> +
>>   static const struct watchdog_info davinci_wdt_info = {
>>       .options = WDIOF_KEEPALIVEPING,
>>       .identity = "DaVinci Watchdog",
>> @@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
>>       .stop        = davinci_wdt_ping,
>>       .ping        = davinci_wdt_ping,
>>       .get_timeleft    = davinci_wdt_get_timeleft,
>> +    .status        = davinci_wdt_status,
>>   };
>>
>>   static int davinci_wdt_probe(struct platform_device *pdev)
>>
> 


-- 
Regards,
Ivan Khoronzhuk

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-18 14:21       ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-18 14:21 UTC (permalink / raw)
  To: Guenter Roeck, Santosh Shilimkar, wim-IQzOog9fTRqzQB+pC5nmwQ,
	nsekhar-l0cyMroinI0, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 11/17/2013 04:24 AM, Guenter Roeck wrote:
> On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
>> When watchdog timer is expired we can know about it thought
> 
> thought -> through or with
> 

Ok

>> GET_STATUS ioctl option.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
>> ---
>>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/watchdog/davinci_wdt.c 
>> b/drivers/watchdog/davinci_wdt.c
>> index 6cbf2e1..a371b2d 100644
>> --- a/drivers/watchdog/davinci_wdt.c
>> +++ b/drivers/watchdog/davinci_wdt.c
>> @@ -144,6 +144,18 @@ static unsigned int 
>> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>>       return wdd->timeout - timer_counter;
>>   }
>>
>> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
>> +{
>> +    u32 val;
>> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
>> +
>> +    val = ioread32(davinci_wdt->base + WDTCR);
>> +    if (val & WDFLAG)
>> +        return WDIOF_CARDRESET;
>> +
>      "Card previously reset the CPU"
> 
> Is this really accurate / correct ?
> 
> My understanding is that the status is supposed to return the reason for 
> a previous reset/reboot,
> not the curent condition.
> 

Actually it is not so good correlate with the purpose, but I grasped
several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
After the WDT is overflowed it sets WDFLAG, so I can use it.
It is more useful while debugging and if it is doubtful I can drop it.

>> +    return 0;
>> +}
>> +
>>   static const struct watchdog_info davinci_wdt_info = {
>>       .options = WDIOF_KEEPALIVEPING,
>>       .identity = "DaVinci Watchdog",
>> @@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
>>       .stop        = davinci_wdt_ping,
>>       .ping        = davinci_wdt_ping,
>>       .get_timeleft    = davinci_wdt_get_timeleft,
>> +    .status        = davinci_wdt_status,
>>   };
>>
>>   static int davinci_wdt_probe(struct platform_device *pdev)
>>
> 


-- 
Regards,
Ivan Khoronzhuk
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-18 14:21       ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-18 14:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/17/2013 04:24 AM, Guenter Roeck wrote:
> On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
>> When watchdog timer is expired we can know about it thought
> 
> thought -> through or with
> 

Ok

>> GET_STATUS ioctl option.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>> ---
>>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/watchdog/davinci_wdt.c 
>> b/drivers/watchdog/davinci_wdt.c
>> index 6cbf2e1..a371b2d 100644
>> --- a/drivers/watchdog/davinci_wdt.c
>> +++ b/drivers/watchdog/davinci_wdt.c
>> @@ -144,6 +144,18 @@ static unsigned int 
>> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>>       return wdd->timeout - timer_counter;
>>   }
>>
>> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
>> +{
>> +    u32 val;
>> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
>> +
>> +    val = ioread32(davinci_wdt->base + WDTCR);
>> +    if (val & WDFLAG)
>> +        return WDIOF_CARDRESET;
>> +
>      "Card previously reset the CPU"
> 
> Is this really accurate / correct ?
> 
> My understanding is that the status is supposed to return the reason for 
> a previous reset/reboot,
> not the curent condition.
> 

Actually it is not so good correlate with the purpose, but I grasped
several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
After the WDT is overflowed it sets WDFLAG, so I can use it.
It is more useful while debugging and if it is doubtful I can drop it.

>> +    return 0;
>> +}
>> +
>>   static const struct watchdog_info davinci_wdt_info = {
>>       .options = WDIOF_KEEPALIVEPING,
>>       .identity = "DaVinci Watchdog",
>> @@ -155,6 +167,7 @@ static const struct watchdog_ops davinci_wdt_ops = {
>>       .stop        = davinci_wdt_ping,
>>       .ping        = davinci_wdt_ping,
>>       .get_timeleft    = davinci_wdt_get_timeleft,
>> +    .status        = davinci_wdt_status,
>>   };
>>
>>   static int davinci_wdt_probe(struct platform_device *pdev)
>>
> 


-- 
Regards,
Ivan Khoronzhuk

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
  2013-11-18 14:21       ` ivan.khoronzhuk
@ 2013-11-18 16:24         ` Guenter Roeck
  -1 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2013-11-18 16:24 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: Santosh Shilimkar, wim, nsekhar, linux-watchdog, devicetree,
	grant.likely, rob.herring, pawel.moll, mark.rutland, swarren,
	galak, ijc+devicetree, linux-kernel, linux-arm-kernel

On Mon, Nov 18, 2013 at 04:21:06PM +0200, ivan.khoronzhuk wrote:
> On 11/17/2013 04:24 AM, Guenter Roeck wrote:
> > On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
> >> When watchdog timer is expired we can know about it thought
> > 
> > thought -> through or with
> > 
> 
> Ok
> 
> >> GET_STATUS ioctl option.
> >>
> >> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> >> ---
> >>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
> >>   1 file changed, 13 insertions(+)
> >>
> >> diff --git a/drivers/watchdog/davinci_wdt.c 
> >> b/drivers/watchdog/davinci_wdt.c
> >> index 6cbf2e1..a371b2d 100644
> >> --- a/drivers/watchdog/davinci_wdt.c
> >> +++ b/drivers/watchdog/davinci_wdt.c
> >> @@ -144,6 +144,18 @@ static unsigned int 
> >> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
> >>       return wdd->timeout - timer_counter;
> >>   }
> >>
> >> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
> >> +{
> >> +    u32 val;
> >> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
> >> +
> >> +    val = ioread32(davinci_wdt->base + WDTCR);
> >> +    if (val & WDFLAG)
> >> +        return WDIOF_CARDRESET;
> >> +
> >      "Card previously reset the CPU"
> > 
> > Is this really accurate / correct ?
> > 
> > My understanding is that the status is supposed to return the reason for 
> > a previous reset/reboot,
> > not the curent condition.
> > 
> 
> Actually it is not so good correlate with the purpose, but I grasped
> several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
> watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
> After the WDT is overflowed it sets WDFLAG, so I can use it.
> It is more useful while debugging and if it is doubtful I can drop it.
> 
The usual reaction to a watchdog timer event is a reset, so I am somewhat
doubtful if this is of any use in practice, other than maybe to show that it
isn't working.

Anyway, I always dislike it when people point out other wrong usages of an API
(or anything, really) as argument to do the same. Speeding isn't legal either,
no matter how many people do it. FWIW, the wrong usages you pointed out should
in my opinion be removed, and if Wim agrees I'll be happy to submit patches to
do it.

If you need debugging information, there is always debugfs. There should be
no need to hijack an API which is supposed to be used for something else.

Guenter

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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-18 16:24         ` Guenter Roeck
  0 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2013-11-18 16:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 18, 2013 at 04:21:06PM +0200, ivan.khoronzhuk wrote:
> On 11/17/2013 04:24 AM, Guenter Roeck wrote:
> > On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
> >> When watchdog timer is expired we can know about it thought
> > 
> > thought -> through or with
> > 
> 
> Ok
> 
> >> GET_STATUS ioctl option.
> >>
> >> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> >> ---
> >>   drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
> >>   1 file changed, 13 insertions(+)
> >>
> >> diff --git a/drivers/watchdog/davinci_wdt.c 
> >> b/drivers/watchdog/davinci_wdt.c
> >> index 6cbf2e1..a371b2d 100644
> >> --- a/drivers/watchdog/davinci_wdt.c
> >> +++ b/drivers/watchdog/davinci_wdt.c
> >> @@ -144,6 +144,18 @@ static unsigned int 
> >> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
> >>       return wdd->timeout - timer_counter;
> >>   }
> >>
> >> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
> >> +{
> >> +    u32 val;
> >> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
> >> +
> >> +    val = ioread32(davinci_wdt->base + WDTCR);
> >> +    if (val & WDFLAG)
> >> +        return WDIOF_CARDRESET;
> >> +
> >      "Card previously reset the CPU"
> > 
> > Is this really accurate / correct ?
> > 
> > My understanding is that the status is supposed to return the reason for 
> > a previous reset/reboot,
> > not the curent condition.
> > 
> 
> Actually it is not so good correlate with the purpose, but I grasped
> several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
> watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
> After the WDT is overflowed it sets WDFLAG, so I can use it.
> It is more useful while debugging and if it is doubtful I can drop it.
> 
The usual reaction to a watchdog timer event is a reset, so I am somewhat
doubtful if this is of any use in practice, other than maybe to show that it
isn't working.

Anyway, I always dislike it when people point out other wrong usages of an API
(or anything, really) as argument to do the same. Speeding isn't legal either,
no matter how many people do it. FWIW, the wrong usages you pointed out should
in my opinion be removed, and if Wim agrees I'll be happy to submit patches to
do it.

If you need debugging information, there is always debugfs. There should be
no need to hijack an API which is supposed to be used for something else.

Guenter

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
  2013-11-18 16:24         ` Guenter Roeck
  (?)
@ 2013-11-18 16:28           ` ivan.khoronzhuk
  -1 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-18 16:28 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Santosh Shilimkar, wim, nsekhar, linux-watchdog, devicetree,
	grant.likely, rob.herring, pawel.moll, mark.rutland, swarren,
	galak, ijc+devicetree, linux-kernel, linux-arm-kernel

On 11/18/2013 06:24 PM, Guenter Roeck wrote:
> On Mon, Nov 18, 2013 at 04:21:06PM +0200, ivan.khoronzhuk wrote:
>> On 11/17/2013 04:24 AM, Guenter Roeck wrote:
>>> On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
>>>> When watchdog timer is expired we can know about it thought
>>>
>>> thought -> through or with
>>>
>>
>> Ok
>>
>>>> GET_STATUS ioctl option.
>>>>
>>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>>> ---
>>>>    drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>>>>    1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/drivers/watchdog/davinci_wdt.c
>>>> b/drivers/watchdog/davinci_wdt.c
>>>> index 6cbf2e1..a371b2d 100644
>>>> --- a/drivers/watchdog/davinci_wdt.c
>>>> +++ b/drivers/watchdog/davinci_wdt.c
>>>> @@ -144,6 +144,18 @@ static unsigned int
>>>> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>>>>        return wdd->timeout - timer_counter;
>>>>    }
>>>>
>>>> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
>>>> +{
>>>> +    u32 val;
>>>> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
>>>> +
>>>> +    val = ioread32(davinci_wdt->base + WDTCR);
>>>> +    if (val & WDFLAG)
>>>> +        return WDIOF_CARDRESET;
>>>> +
>>>       "Card previously reset the CPU"
>>>
>>> Is this really accurate / correct ?
>>>
>>> My understanding is that the status is supposed to return the reason for
>>> a previous reset/reboot,
>>> not the curent condition.
>>>
>>
>> Actually it is not so good correlate with the purpose, but I grasped
>> several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
>> watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
>> After the WDT is overflowed it sets WDFLAG, so I can use it.
>> It is more useful while debugging and if it is doubtful I can drop it.
>>
> The usual reaction to a watchdog timer event is a reset, so I am somewhat
> doubtful if this is of any use in practice, other than maybe to show that it
> isn't working.
>
> Anyway, I always dislike it when people point out other wrong usages of an API
> (or anything, really) as argument to do the same. Speeding isn't legal either,
> no matter how many people do it. FWIW, the wrong usages you pointed out should
> in my opinion be removed, and if Wim agrees I'll be happy to submit patches to
> do it.
>
> If you need debugging information, there is always debugfs. There should be
> no need to hijack an API which is supposed to be used for something else.
>
> Guenter
>

I'll drop it

-- 
Regards,
Ivan Khoronzhuk

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

* Re: Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-18 16:28           ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-18 16:28 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: mark.rutland, devicetree, linux-watchdog, pawel.moll, swarren,
	ijc+devicetree, nsekhar, galak, rob.herring, linux-kernel, wim,
	Santosh Shilimkar, grant.likely, linux-arm-kernel

On 11/18/2013 06:24 PM, Guenter Roeck wrote:
> On Mon, Nov 18, 2013 at 04:21:06PM +0200, ivan.khoronzhuk wrote:
>> On 11/17/2013 04:24 AM, Guenter Roeck wrote:
>>> On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
>>>> When watchdog timer is expired we can know about it thought
>>>
>>> thought -> through or with
>>>
>>
>> Ok
>>
>>>> GET_STATUS ioctl option.
>>>>
>>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>>> ---
>>>>    drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>>>>    1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/drivers/watchdog/davinci_wdt.c
>>>> b/drivers/watchdog/davinci_wdt.c
>>>> index 6cbf2e1..a371b2d 100644
>>>> --- a/drivers/watchdog/davinci_wdt.c
>>>> +++ b/drivers/watchdog/davinci_wdt.c
>>>> @@ -144,6 +144,18 @@ static unsigned int
>>>> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>>>>        return wdd->timeout - timer_counter;
>>>>    }
>>>>
>>>> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
>>>> +{
>>>> +    u32 val;
>>>> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
>>>> +
>>>> +    val = ioread32(davinci_wdt->base + WDTCR);
>>>> +    if (val & WDFLAG)
>>>> +        return WDIOF_CARDRESET;
>>>> +
>>>       "Card previously reset the CPU"
>>>
>>> Is this really accurate / correct ?
>>>
>>> My understanding is that the status is supposed to return the reason for
>>> a previous reset/reboot,
>>> not the curent condition.
>>>
>>
>> Actually it is not so good correlate with the purpose, but I grasped
>> several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
>> watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
>> After the WDT is overflowed it sets WDFLAG, so I can use it.
>> It is more useful while debugging and if it is doubtful I can drop it.
>>
> The usual reaction to a watchdog timer event is a reset, so I am somewhat
> doubtful if this is of any use in practice, other than maybe to show that it
> isn't working.
>
> Anyway, I always dislike it when people point out other wrong usages of an API
> (or anything, really) as argument to do the same. Speeding isn't legal either,
> no matter how many people do it. FWIW, the wrong usages you pointed out should
> in my opinion be removed, and if Wim agrees I'll be happy to submit patches to
> do it.
>
> If you need debugging information, there is always debugfs. There should be
> no need to hijack an API which is supposed to be used for something else.
>
> Guenter
>

I'll drop it

-- 
Regards,
Ivan Khoronzhuk

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

* Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support
@ 2013-11-18 16:28           ` ivan.khoronzhuk
  0 siblings, 0 replies; 17+ messages in thread
From: ivan.khoronzhuk @ 2013-11-18 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/18/2013 06:24 PM, Guenter Roeck wrote:
> On Mon, Nov 18, 2013 at 04:21:06PM +0200, ivan.khoronzhuk wrote:
>> On 11/17/2013 04:24 AM, Guenter Roeck wrote:
>>> On 11/06/2013 03:32 AM, ivan.khoronzhuk wrote:
>>>> When watchdog timer is expired we can know about it thought
>>>
>>> thought -> through or with
>>>
>>
>> Ok
>>
>>>> GET_STATUS ioctl option.
>>>>
>>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>>> ---
>>>>    drivers/watchdog/davinci_wdt.c |   13 +++++++++++++
>>>>    1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/drivers/watchdog/davinci_wdt.c
>>>> b/drivers/watchdog/davinci_wdt.c
>>>> index 6cbf2e1..a371b2d 100644
>>>> --- a/drivers/watchdog/davinci_wdt.c
>>>> +++ b/drivers/watchdog/davinci_wdt.c
>>>> @@ -144,6 +144,18 @@ static unsigned int
>>>> davinci_wdt_get_timeleft(struct watchdog_device *wdd)
>>>>        return wdd->timeout - timer_counter;
>>>>    }
>>>>
>>>> +static unsigned int davinci_wdt_status(struct watchdog_device *wdd)
>>>> +{
>>>> +    u32 val;
>>>> +    struct davinci_wdt_device *davinci_wdt = watchdog_get_drvdata(wdd);
>>>> +
>>>> +    val = ioread32(davinci_wdt->base + WDTCR);
>>>> +    if (val & WDFLAG)
>>>> +        return WDIOF_CARDRESET;
>>>> +
>>>       "Card previously reset the CPU"
>>>
>>> Is this really accurate / correct ?
>>>
>>> My understanding is that the status is supposed to return the reason for
>>> a previous reset/reboot,
>>> not the curent condition.
>>>
>>
>> Actually it is not so good correlate with the purpose, but I grasped
>> several examples like watchdog/pcwd.c; watchdog/w83977f_wdt.c;
>> watchdog/of_xilinx_wdt.c and saw that I can use it in meaning "the card initiated reset.
>> After the WDT is overflowed it sets WDFLAG, so I can use it.
>> It is more useful while debugging and if it is doubtful I can drop it.
>>
> The usual reaction to a watchdog timer event is a reset, so I am somewhat
> doubtful if this is of any use in practice, other than maybe to show that it
> isn't working.
>
> Anyway, I always dislike it when people point out other wrong usages of an API
> (or anything, really) as argument to do the same. Speeding isn't legal either,
> no matter how many people do it. FWIW, the wrong usages you pointed out should
> in my opinion be removed, and if Wim agrees I'll be happy to submit patches to
> do it.
>
> If you need debugging information, there is always debugfs. There should be
> no need to hijack an API which is supposed to be used for something else.
>
> Guenter
>

I'll drop it

-- 
Regards,
Ivan Khoronzhuk

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

end of thread, other threads:[~2013-11-18 16:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1383680783-12114-5-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-06 11:32 ` Fwd: [PATCH 4/8] watchdog: davinci: add GET_STATUS option support ivan.khoronzhuk
2013-11-06 11:32   ` ivan.khoronzhuk
2013-11-06 11:32   ` ivan.khoronzhuk
2013-11-12 15:38   ` Santosh Shilimkar
2013-11-12 15:38     ` Santosh Shilimkar
2013-11-12 15:38     ` Santosh Shilimkar
2013-11-17  2:24   ` Guenter Roeck
2013-11-17  2:24     ` Guenter Roeck
2013-11-17  2:24     ` Guenter Roeck
2013-11-18 14:21     ` ivan.khoronzhuk
2013-11-18 14:21       ` ivan.khoronzhuk
2013-11-18 14:21       ` ivan.khoronzhuk
2013-11-18 16:24       ` Guenter Roeck
2013-11-18 16:24         ` Guenter Roeck
2013-11-18 16:28         ` ivan.khoronzhuk
2013-11-18 16:28           ` ivan.khoronzhuk
2013-11-18 16:28           ` ivan.khoronzhuk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.