All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: imx2_wdt: allow setting timeout in devicetree
@ 2018-02-08 13:11 ` Marcus Folkesson
  0 siblings, 0 replies; 4+ messages in thread
From: Marcus Folkesson @ 2018-02-08 13:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Rob Herring, Mark Rutland
  Cc: Marcus Folkesson, linux-watchdog, devicetree, linux-kernel

By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set
timout-sec property in devicetree.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt | 2 ++
 drivers/watchdog/imx2_wdt.c                                | 8 ++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
index 107280ef0025..adc6b76fcb3a 100644
--- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
@@ -11,6 +11,7 @@ Optional properties:
   detail please see: Documentation/devicetree/bindings/regmap/regmap.txt.
 - fsl,ext-reset-output: If present the watchdog device is configured to
   assert its external reset (WDOG_B) instead of issuing a software reset.
+- timeout-sec : Contains the watchdog timeout in seconds
 
 Examples:
 
@@ -19,4 +20,5 @@ wdt@73f98000 {
 	reg = <0x73f98000 0x4000>;
 	interrupts = <58>;
 	big-endian;
+	timeout-sec = <20>;
 };
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 4874b0f18650..b8674c5c2d9f 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -76,7 +76,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 
-static unsigned timeout = IMX2_WDT_DEFAULT_TIME;
+static unsigned timeout;
 module_param(timeout, uint, 0);
 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
 				__MODULE_STRING(IMX2_WDT_DEFAULT_TIME) ")");
@@ -275,6 +275,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 	wdog->info		= &imx2_wdt_info;
 	wdog->ops		= &imx2_wdt_ops;
 	wdog->min_timeout	= 1;
+	wdog->timeout		= IMX2_WDT_DEFAULT_TIME;
 	wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000;
 	wdog->parent		= &pdev->dev;
 
@@ -293,11 +294,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 
 	wdev->ext_reset = of_property_read_bool(pdev->dev.of_node,
 						"fsl,ext-reset-output");
-	wdog->timeout = clamp_t(unsigned, timeout, 1, IMX2_WDT_MAX_TIME);
-	if (wdog->timeout != timeout)
-		dev_warn(&pdev->dev, "Initial timeout out of range! Clamped from %u to %u\n",
-			 timeout, wdog->timeout);
-
 	platform_set_drvdata(pdev, wdog);
 	watchdog_set_drvdata(wdog, wdev);
 	watchdog_set_nowayout(wdog, nowayout);
-- 
2.15.1

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

* [PATCH] watchdog: imx2_wdt: allow setting timeout in devicetree
@ 2018-02-08 13:11 ` Marcus Folkesson
  0 siblings, 0 replies; 4+ messages in thread
From: Marcus Folkesson @ 2018-02-08 13:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Rob Herring, Mark Rutland
  Cc: Marcus Folkesson, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set
timout-sec property in devicetree.

Signed-off-by: Marcus Folkesson <marcus.folkesson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt | 2 ++
 drivers/watchdog/imx2_wdt.c                                | 8 ++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
index 107280ef0025..adc6b76fcb3a 100644
--- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
@@ -11,6 +11,7 @@ Optional properties:
   detail please see: Documentation/devicetree/bindings/regmap/regmap.txt.
 - fsl,ext-reset-output: If present the watchdog device is configured to
   assert its external reset (WDOG_B) instead of issuing a software reset.
+- timeout-sec : Contains the watchdog timeout in seconds
 
 Examples:
 
@@ -19,4 +20,5 @@ wdt@73f98000 {
 	reg = <0x73f98000 0x4000>;
 	interrupts = <58>;
 	big-endian;
+	timeout-sec = <20>;
 };
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 4874b0f18650..b8674c5c2d9f 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -76,7 +76,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 
-static unsigned timeout = IMX2_WDT_DEFAULT_TIME;
+static unsigned timeout;
 module_param(timeout, uint, 0);
 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
 				__MODULE_STRING(IMX2_WDT_DEFAULT_TIME) ")");
@@ -275,6 +275,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 	wdog->info		= &imx2_wdt_info;
 	wdog->ops		= &imx2_wdt_ops;
 	wdog->min_timeout	= 1;
+	wdog->timeout		= IMX2_WDT_DEFAULT_TIME;
 	wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000;
 	wdog->parent		= &pdev->dev;
 
@@ -293,11 +294,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 
 	wdev->ext_reset = of_property_read_bool(pdev->dev.of_node,
 						"fsl,ext-reset-output");
-	wdog->timeout = clamp_t(unsigned, timeout, 1, IMX2_WDT_MAX_TIME);
-	if (wdog->timeout != timeout)
-		dev_warn(&pdev->dev, "Initial timeout out of range! Clamped from %u to %u\n",
-			 timeout, wdog->timeout);
-
 	platform_set_drvdata(pdev, wdog);
 	watchdog_set_drvdata(wdog, wdev);
 	watchdog_set_nowayout(wdog, nowayout);
-- 
2.15.1

--
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] 4+ messages in thread

* Re: [PATCH] watchdog: imx2_wdt: allow setting timeout in devicetree
  2018-02-08 13:11 ` Marcus Folkesson
  (?)
@ 2018-02-08 14:15 ` Guenter Roeck
  -1 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2018-02-08 14:15 UTC (permalink / raw)
  To: Marcus Folkesson, Wim Van Sebroeck, Rob Herring, Mark Rutland
  Cc: linux-watchdog, devicetree, linux-kernel

On 02/08/2018 05:11 AM, Marcus Folkesson wrote:
> By following best practice described in
> Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set
> timout-sec property in devicetree.
> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt | 2 ++
>   drivers/watchdog/imx2_wdt.c                                | 8 ++------
>   2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
> index 107280ef0025..adc6b76fcb3a 100644
> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
> @@ -11,6 +11,7 @@ Optional properties:
>     detail please see: Documentation/devicetree/bindings/regmap/regmap.txt.
>   - fsl,ext-reset-output: If present the watchdog device is configured to
>     assert its external reset (WDOG_B) instead of issuing a software reset.
> +- timeout-sec : Contains the watchdog timeout in seconds
>   
>   Examples:
>   
> @@ -19,4 +20,5 @@ wdt@73f98000 {
>   	reg = <0x73f98000 0x4000>;
>   	interrupts = <58>;
>   	big-endian;
> +	timeout-sec = <20>;
>   };
> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
> index 4874b0f18650..b8674c5c2d9f 100644
> --- a/drivers/watchdog/imx2_wdt.c
> +++ b/drivers/watchdog/imx2_wdt.c
> @@ -76,7 +76,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   
> -static unsigned timeout = IMX2_WDT_DEFAULT_TIME;
> +static unsigned timeout;
>   module_param(timeout, uint, 0);
>   MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
>   				__MODULE_STRING(IMX2_WDT_DEFAULT_TIME) ")");
> @@ -275,6 +275,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
>   	wdog->info		= &imx2_wdt_info;
>   	wdog->ops		= &imx2_wdt_ops;
>   	wdog->min_timeout	= 1;
> +	wdog->timeout		= IMX2_WDT_DEFAULT_TIME;
>   	wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000;
>   	wdog->parent		= &pdev->dev;
>   
> @@ -293,11 +294,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
>   
>   	wdev->ext_reset = of_property_read_bool(pdev->dev.of_node,
>   						"fsl,ext-reset-output");
> -	wdog->timeout = clamp_t(unsigned, timeout, 1, IMX2_WDT_MAX_TIME);
> -	if (wdog->timeout != timeout)
> -		dev_warn(&pdev->dev, "Initial timeout out of range! Clamped from %u to %u\n",
> -			 timeout, wdog->timeout);
> -
>   	platform_set_drvdata(pdev, wdog);
>   	watchdog_set_drvdata(wdog, wdev);
>   	watchdog_set_nowayout(wdog, nowayout);
> 

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

* Re: [PATCH] watchdog: imx2_wdt: allow setting timeout in devicetree
  2018-02-08 13:11 ` Marcus Folkesson
  (?)
  (?)
@ 2018-02-18 23:13 ` Rob Herring
  -1 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2018-02-18 23:13 UTC (permalink / raw)
  To: Marcus Folkesson
  Cc: Wim Van Sebroeck, Guenter Roeck, Mark Rutland, linux-watchdog,
	devicetree, linux-kernel

On Thu, Feb 08, 2018 at 02:11:08PM +0100, Marcus Folkesson wrote:
> By following best practice described in
> Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set
> timout-sec property in devicetree.
> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
>  Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt | 2 ++
>  drivers/watchdog/imx2_wdt.c                                | 8 ++------
>  2 files changed, 4 insertions(+), 6 deletions(-)

Reviewed-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2018-02-18 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 13:11 [PATCH] watchdog: imx2_wdt: allow setting timeout in devicetree Marcus Folkesson
2018-02-08 13:11 ` Marcus Folkesson
2018-02-08 14:15 ` Guenter Roeck
2018-02-18 23:13 ` Rob Herring

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.