* [PATCH v9 0/8] watchdog: dt: add support for the timeout-sec dt property
@ 2013-02-14 8:14 Fabio Porcedda
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Hi all,
this patchset add the timeout-sec property to the watchdog core,
to the at91sam9_wdt driver and on all framework enabled watchdog driver
with dt support.
The at91sam9_wdt is tested on evk-pr3,
the other drivers are compile tested only.
Hi Wim,
because the first two patches are fixes for the
patch 433bf8dc344c0eacb3ff5bbc1aea42f75b170a72 already included in
watchdog-next feel free to squash them.
Best regards
Fabio Porcedda
changes:
v9:
- rebase over watchdog-next, so remove first and second patch and
add two commit to fix the commit already present in watchdog-next
- add a commit for fixing coding style
v8:
- watchdog_is_valid_timeout(): export in watchdog.h
- watchdog_is_valid_timeout(): use in watchdog_set_timeout()
- watchdog_is_valid_timeout(): split patch
- watchdog_init_timeout(): return -EINVAL for out of range values.
- watchdog_init_timeout(): use struct device instead of struct device_node
v7:
- rebase over v3.8-rc2
- remove the patch already merged
v6:
- remove patch for function of_get_timeout_sec as aked by Rob Herring
- add Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
- add Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
v5:
- fix codestyle for compilance ti checkpatch.pl about
"ERROR: do not initialise statics to 0 or NULL"
for s3c2410_wdt.c:56 and at91sam9_wdt.c:63
v4:
- add of_get_timeout_sec
- add s3c2410_wdt driver
- split driver patch
- fixed watchdog_init_timeout handling of min_timeout and max_timeout
v3:
- rename watchdog_probe_dt_timeout -> watchdog_init_timeout
- move the watchdog_init_timeout function from inline to watchdog_core.c
- add timeout parameter handling code to watchdog_init_timeout
- add timeout-sec property to the pnx4008-wdt driver
- add two small commit for fixup and cleanup
v2:
- change "timeout" to "timeout-sec" as asked by Jean-Christophe
- at91sam9_wdt: use the new helper function
- at91sam9_wdt: add bounds checking
- watchdog.h: add bounds checking
Fabio Porcedda (8):
watchdog: core: add static to watchdog_check_min_max_timeout()
watchdog: core: fix watchdog_check_min_max_timeout() return value
watchdog: orion_wdt: add timeout-sec property binding
watchdog: pnx4008: add timeout-sec property binding
watchdog: s3c2410_wdt: add timeout-sec property binding
watchdog: at91sam9_wdt: add timeout-sec property binding
watchdog: orion_wdt: move the min_timeout initialization
watchdog: code: fix the alignement of some function declarations
.../devicetree/bindings/watchdog/atmel-wdt.txt | 4 ++++
Documentation/devicetree/bindings/watchdog/marvel.txt | 5 +++++
.../devicetree/bindings/watchdog/pnx4008-wdt.txt | 4 ++++
.../devicetree/bindings/watchdog/samsung-wdt.txt | 3 +++
drivers/watchdog/Kconfig | 1 +
drivers/watchdog/at91sam9_wdt.c | 16 +++++++++++++---
drivers/watchdog/orion_wdt.c | 10 ++++------
drivers/watchdog/pnx4008_wdt.c | 7 +++----
drivers/watchdog/s3c2410_wdt.c | 6 ++++--
drivers/watchdog/watchdog_core.c | 16 +++++++++++-----
drivers/watchdog/watchdog_dev.c | 17 ++++++-----------
11 files changed, 58 insertions(+), 31 deletions(-)
--
1.8.1.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v9 1/8] watchdog: core: add static to watchdog_check_min_max_timeout()
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 2/8] watchdog: core: fix watchdog_check_min_max_timeout() return value Fabio Porcedda
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Because is an internal function is better to use static to help
the compiler.
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>
Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/watchdog/watchdog_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index a74a3ef..94590f6 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -43,7 +43,7 @@
static DEFINE_IDA(watchdog_ida);
static struct class *watchdog_class;
-void watchdog_check_min_max_timeout(struct watchdog_device *wdd)
+static void watchdog_check_min_max_timeout(struct watchdog_device *wdd)
{
/*
* Check that we have valid min and max timeout values, if
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 2/8] watchdog: core: fix watchdog_check_min_max_timeout() return value
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-14 8:14 ` [PATCH v9 1/8] watchdog: core: add static to watchdog_check_min_max_timeout() Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 3/8] watchdog: orion_wdt: add timeout-sec property binding Fabio Porcedda
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
The device tree support is not mandatory, so the function doesn't
return error when is not used.
Return -EINVAL when the module parameter or
timeout-sec property is out of bounds.
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>
Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/watchdog/watchdog_core.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 94590f6..05d18b4 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -73,22 +73,28 @@ int watchdog_init_timeout(struct watchdog_device *wdd,
unsigned int timeout_parm, struct device *dev)
{
unsigned int t = 0;
+ int ret = 0;
watchdog_check_min_max_timeout(wdd);
/* try to get the tiemout module parameter first */
if (!watchdog_timeout_invalid(wdd, timeout_parm)) {
wdd->timeout = timeout_parm;
- return 0;
+ return ret;
}
+ if (timeout_parm)
+ ret = -EINVAL;
/* try to get the timeout_sec property */
if (dev == NULL || dev->of_node == NULL)
- return -EINVAL;
+ return ret;
of_property_read_u32(dev->of_node, "timeout-sec", &t);
if (!watchdog_timeout_invalid(wdd, t))
wdd->timeout = t;
- return 0;
+ else
+ ret = -EINVAL;
+
+ return ret;
}
EXPORT_SYMBOL_GPL(watchdog_init_timeout);
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 3/8] watchdog: orion_wdt: add timeout-sec property binding
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-14 8:14 ` [PATCH v9 1/8] watchdog: core: add static to watchdog_check_min_max_timeout() Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 2/8] watchdog: core: fix watchdog_check_min_max_timeout() return value Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 4/8] watchdog: pnx4008: " Fabio Porcedda
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Only compile tested.
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
---
Documentation/devicetree/bindings/watchdog/marvel.txt | 5 +++++
drivers/watchdog/orion_wdt.c | 8 +++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/watchdog/marvel.txt b/Documentation/devicetree/bindings/watchdog/marvel.txt
index 0b2503a..5dc8d30 100644
--- a/Documentation/devicetree/bindings/watchdog/marvel.txt
+++ b/Documentation/devicetree/bindings/watchdog/marvel.txt
@@ -5,10 +5,15 @@ Required Properties:
- Compatibility : "marvell,orion-wdt"
- reg : Address of the timer registers
+Optional properties:
+
+- timeout-sec : Contains the watchdog timeout in seconds
+
Example:
wdt@20300 {
compatible = "marvell,orion-wdt";
reg = <0x20300 0x28>;
+ timeout-sec = <10>;
status = "okay";
};
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 87ed2b9..3022a38 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -164,12 +164,10 @@ static int orion_wdt_probe(struct platform_device *pdev)
wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk;
- if ((heartbeat < 1) || (heartbeat > wdt_max_duration))
- heartbeat = wdt_max_duration;
-
- orion_wdt.timeout = heartbeat;
orion_wdt.min_timeout = 1;
+ orion_wdt.timeout = wdt_max_duration;
orion_wdt.max_timeout = wdt_max_duration;
+ watchdog_init_timeout(&orion_wdt, heartbeat, &pdev->dev);
watchdog_set_nowayout(&orion_wdt, nowayout);
ret = watchdog_register_device(&orion_wdt);
@@ -179,7 +177,7 @@ static int orion_wdt_probe(struct platform_device *pdev)
}
pr_info("Initial timeout %d sec%s\n",
- heartbeat, nowayout ? ", nowayout" : "");
+ orion_wdt.timeout, nowayout ? ", nowayout" : "");
return 0;
}
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 4/8] watchdog: pnx4008: add timeout-sec property binding
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2013-02-14 8:14 ` [PATCH v9 3/8] watchdog: orion_wdt: add timeout-sec property binding Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 5/8] watchdog: s3c2410_wdt: " Fabio Porcedda
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: Masanari Iida, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
Wolfram Sang, Wenyou Yang
Only compile tested.
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Masanari Iida <standby24x7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt | 4 ++++
drivers/watchdog/pnx4008_wdt.c | 7 +++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt b/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt
index 7c7f688..556d06c 100644
--- a/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt
@@ -5,9 +5,13 @@ Required properties:
- reg: physical base address of the controller and length of memory mapped
region.
+Optional properties:
+- timeout-sec: contains the watchdog timeout in seconds.
+
Example:
watchdog@4003C000 {
compatible = "nxp,pnx4008-wdt";
reg = <0x4003C000 0x1000>;
+ timeout-sec = <10>;
};
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index dcba5da..bbc249a 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -142,6 +142,7 @@ static const struct watchdog_ops pnx4008_wdt_ops = {
static struct watchdog_device pnx4008_wdd = {
.info = &pnx4008_wdt_ident,
.ops = &pnx4008_wdt_ops,
+ .timeout = DEFAULT_HEARTBEAT,
.min_timeout = 1,
.max_timeout = MAX_HEARTBEAT,
};
@@ -151,8 +152,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
struct resource *r;
int ret = 0;
- if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
- heartbeat = DEFAULT_HEARTBEAT;
+ watchdog_init_timeout(&pnx4008_wdd, heartbeat, &pdev->dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
wdt_base = devm_request_and_ioremap(&pdev->dev, r);
@@ -167,7 +167,6 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
if (ret)
goto out;
- pnx4008_wdd.timeout = heartbeat;
pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ?
WDIOF_CARDRESET : 0;
watchdog_set_nowayout(&pnx4008_wdd, nowayout);
@@ -181,7 +180,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
}
dev_info(&pdev->dev, "PNX4008 Watchdog Timer: heartbeat %d sec\n",
- heartbeat);
+ pnx4008_wdd.timeout);
return 0;
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 5/8] watchdog: s3c2410_wdt: add timeout-sec property binding
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2013-02-14 8:14 ` [PATCH v9 4/8] watchdog: pnx4008: " Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 6/8] watchdog: at91sam9_wdt: " Fabio Porcedda
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Only compile tested.
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Cc: Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
Documentation/devicetree/bindings/watchdog/samsung-wdt.txt | 3 +++
drivers/watchdog/s3c2410_wdt.c | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
index 79ead82..451127a 100644
--- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
@@ -9,3 +9,6 @@ Required properties:
- reg : base physical address of the controller and length of memory mapped
region.
- interrupts : interrupt number to the cpu.
+
+Optional properties:
+- timeout-sec : contains the watchdog timeout in seconds.
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 6419c61..c1a221c 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -53,7 +53,7 @@
#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15)
static bool nowayout = WATCHDOG_NOWAYOUT;
-static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME;
+static int tmr_margin;
static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT;
static int soft_noboot;
static int debug;
@@ -226,6 +226,7 @@ static struct watchdog_ops s3c2410wdt_ops = {
static struct watchdog_device s3c2410_wdd = {
.info = &s3c2410_wdt_ident,
.ops = &s3c2410wdt_ops,
+ .timeout = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME,
};
/* interrupt handler code */
@@ -356,7 +357,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
/* see if we can actually set the requested timer margin, and if
* not, try the default value */
- if (s3c2410wdt_set_heartbeat(&s3c2410_wdd, tmr_margin)) {
+ watchdog_init_timeout(&s3c2410_wdd, tmr_margin, &pdev->dev);
+ if (s3c2410wdt_set_heartbeat(&s3c2410_wdd, s3c2410_wdd.timeout)) {
started = s3c2410wdt_set_heartbeat(&s3c2410_wdd,
CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 6/8] watchdog: at91sam9_wdt: add timeout-sec property binding
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (4 preceding siblings ...)
2013-02-14 8:14 ` [PATCH v9 5/8] watchdog: s3c2410_wdt: " Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 7/8] watchdog: orion_wdt: move the min_timeout initialization Fabio Porcedda
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Tested on at91sam9260 board (evk-pro3).
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Andrew Victor <linux-PelNFVqkFnVyf+4FbqDuWQ@public.gmane.org>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 4 ++++
drivers/watchdog/Kconfig | 1 +
drivers/watchdog/at91sam9_wdt.c | 16 +++++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
index 2957ebb..fcdd48f 100644
--- a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
@@ -7,9 +7,13 @@ Required properties:
- reg: physical base address of the controller and length of memory mapped
region.
+Optional properties:
+- timeout-sec: contains the watchdog timeout in seconds.
+
Example:
watchdog@fffffd40 {
compatible = "atmel,at91sam9260-wdt";
reg = <0xfffffd40 0x10>;
+ timeout-sec = <10>;
};
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 5e8a034..c36fcb0 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -125,6 +125,7 @@ config AT91RM9200_WATCHDOG
config AT91SAM9X_WATCHDOG
tristate "AT91SAM9X / AT91CAP9 watchdog"
depends on ARCH_AT91 && !ARCH_AT91RM9200
+ select WATCHDOG_CORE
help
Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will
reboot your system when the timeout is reached.
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 6dad954..29b167a 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -57,8 +57,10 @@
#define WDT_TIMEOUT (HZ/2)
/* User land timeout */
+#define MIN_HEARTBEAT 1
+#define MAX_HEARTBEAT 16
#define WDT_HEARTBEAT 15
-static int heartbeat = WDT_HEARTBEAT;
+static int heartbeat;
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. "
"(default = " __MODULE_STRING(WDT_HEARTBEAT) ")");
@@ -255,6 +257,12 @@ static struct miscdevice at91wdt_miscdev = {
.fops = &at91wdt_fops,
};
+static struct watchdog_device at91wdt_wdd __initdata = {
+ .timeout = WDT_HEARTBEAT,
+ .min_timeout = MIN_HEARTBEAT,
+ .max_timeout = MAX_HEARTBEAT,
+};
+
static int __init at91wdt_probe(struct platform_device *pdev)
{
struct resource *r;
@@ -273,6 +281,8 @@ static int __init at91wdt_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ watchdog_init_timeout(&at91wdt_wdd, heartbeat, &pdev->dev);
+
/* Set watchdog */
res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000));
if (res)
@@ -282,12 +292,12 @@ static int __init at91wdt_probe(struct platform_device *pdev)
if (res)
return res;
- at91wdt_private.next_heartbeat = jiffies + heartbeat * HZ;
+ at91wdt_private.next_heartbeat = jiffies + at91wdt_wdd.timeout * HZ;
setup_timer(&at91wdt_private.timer, at91_ping, 0);
mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT);
pr_info("enabled (heartbeat=%d sec, nowayout=%d)\n",
- heartbeat, nowayout);
+ at91wdt_wdd.timeout, nowayout);
return 0;
}
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 7/8] watchdog: orion_wdt: move the min_timeout initialization
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (5 preceding siblings ...)
2013-02-14 8:14 ` [PATCH v9 6/8] watchdog: at91sam9_wdt: " Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 8/8] watchdog: code: fix the alignement of some function declarations Fabio Porcedda
2013-02-18 20:11 ` [PATCH v9 0/8] watchdog: dt: add support for the timeout-sec dt property Wim Van Sebroeck
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Move the min_timeout initialization inside the orion_wdt definition.
Only compile tested.
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
---
drivers/watchdog/orion_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 3022a38..da57798 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -140,6 +140,7 @@ static const struct watchdog_ops orion_wdt_ops = {
static struct watchdog_device orion_wdt = {
.info = &orion_wdt_info,
.ops = &orion_wdt_ops,
+ .min_timeout = 1,
};
static int orion_wdt_probe(struct platform_device *pdev)
@@ -164,7 +165,6 @@ static int orion_wdt_probe(struct platform_device *pdev)
wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk;
- orion_wdt.min_timeout = 1;
orion_wdt.timeout = wdt_max_duration;
orion_wdt.max_timeout = wdt_max_duration;
watchdog_init_timeout(&orion_wdt, heartbeat, &pdev->dev);
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v9 8/8] watchdog: code: fix the alignement of some function declarations
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (6 preceding siblings ...)
2013-02-14 8:14 ` [PATCH v9 7/8] watchdog: orion_wdt: move the min_timeout initialization Fabio Porcedda
@ 2013-02-14 8:14 ` Fabio Porcedda
2013-02-18 20:11 ` [PATCH v9 0/8] watchdog: dt: add support for the timeout-sec dt property Wim Van Sebroeck
8 siblings, 0 replies; 10+ messages in thread
From: Fabio Porcedda @ 2013-02-14 8:14 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Nicolas Ferre,
Jean-Christophe PLAGNIOL-VILLARD, Andrew Victor, Jason Cooper,
Andrew Lunn, Ben Dooks, Kukjin Kim
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang
Signed-off-by: Fabio Porcedda <fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>
Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/watchdog/watchdog_core.c | 2 +-
drivers/watchdog/watchdog_dev.c | 17 ++++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 05d18b4..5cdd7b6 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -70,7 +70,7 @@ static void watchdog_check_min_max_timeout(struct watchdog_device *wdd)
* A zero is returned on success and -EINVAL for failure.
*/
int watchdog_init_timeout(struct watchdog_device *wdd,
- unsigned int timeout_parm, struct device *dev)
+ unsigned int timeout_parm, struct device *dev)
{
unsigned int t = 0;
int ret = 0;
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 08b48bb..776341b 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -162,8 +162,7 @@ out_stop:
* Get the watchdog's status flags.
*/
-static int watchdog_get_status(struct watchdog_device *wddev,
- unsigned int *status)
+static int watchdog_get_status(struct watchdog_device *wddev, uint *status)
{
int err = 0;
@@ -191,8 +190,7 @@ out_status:
* @timeout: timeout to set in seconds
*/
-static int watchdog_set_timeout(struct watchdog_device *wddev,
- unsigned int timeout)
+static int watchdog_set_timeout(struct watchdog_device *wddev, uint timeout)
{
int err;
@@ -225,8 +223,7 @@ out_timeout:
* Get the time before a watchdog will reboot (if not pinged).
*/
-static int watchdog_get_timeleft(struct watchdog_device *wddev,
- unsigned int *timeleft)
+static int watchdog_get_timeleft(struct watchdog_device *wddev, uint *timeleft)
{
int err = 0;
@@ -255,8 +252,7 @@ out_timeleft:
* @arg: argument pointer
*/
-static int watchdog_ioctl_op(struct watchdog_device *wddev, unsigned int cmd,
- unsigned long arg)
+static int watchdog_ioctl_op(struct watchdog_device *wddev, uint cmd, ulong arg)
{
int err;
@@ -290,7 +286,7 @@ out_ioctl:
*/
static ssize_t watchdog_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+ size_t len, loff_t *ppos)
{
struct watchdog_device *wdd = file->private_data;
size_t i;
@@ -329,8 +325,7 @@ static ssize_t watchdog_write(struct file *file, const char __user *data,
* according to their available features.
*/
-static long watchdog_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
+static long watchdog_ioctl(struct file *file, unsigned int cmd, ulong arg)
{
struct watchdog_device *wdd = file->private_data;
void __user *argp = (void __user *)arg;
--
1.8.1.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v9 0/8] watchdog: dt: add support for the timeout-sec dt property
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (7 preceding siblings ...)
2013-02-14 8:14 ` [PATCH v9 8/8] watchdog: code: fix the alignement of some function declarations Fabio Porcedda
@ 2013-02-18 20:11 ` Wim Van Sebroeck
8 siblings, 0 replies; 10+ messages in thread
From: Wim Van Sebroeck @ 2013-02-18 20:11 UTC (permalink / raw)
To: Fabio Porcedda
Cc: Andrew Lunn, Kukjin Kim, Jason Cooper,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Wenyou Yang, Ben Dooks,
Andrew Victor, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-watchdog-u79uwXL29TY76Z2rM5mHXA
Hi Fabio,
> Hi all,
> this patchset add the timeout-sec property to the watchdog core,
> to the at91sam9_wdt driver and on all framework enabled watchdog driver
> with dt support.
> The at91sam9_wdt is tested on evk-pr3,
> the other drivers are compile tested only.
>
> Hi Wim,
> because the first two patches are fixes for the
> patch 433bf8dc344c0eacb3ff5bbc1aea42f75b170a72 already included in
> watchdog-next feel free to squash them.
added to linux-watchdog-next.
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-02-18 20:11 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 8:14 [PATCH v9 0/8] watchdog: dt: add support for the timeout-sec dt property Fabio Porcedda
[not found] ` <1360829670-10418-1-git-send-email-fabio.porcedda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-14 8:14 ` [PATCH v9 1/8] watchdog: core: add static to watchdog_check_min_max_timeout() Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 2/8] watchdog: core: fix watchdog_check_min_max_timeout() return value Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 3/8] watchdog: orion_wdt: add timeout-sec property binding Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 4/8] watchdog: pnx4008: " Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 5/8] watchdog: s3c2410_wdt: " Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 6/8] watchdog: at91sam9_wdt: " Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 7/8] watchdog: orion_wdt: move the min_timeout initialization Fabio Porcedda
2013-02-14 8:14 ` [PATCH v9 8/8] watchdog: code: fix the alignement of some function declarations Fabio Porcedda
2013-02-18 20:11 ` [PATCH v9 0/8] watchdog: dt: add support for the timeout-sec dt property Wim Van Sebroeck
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).