* [PATCH v3 0/3] watchdog: dw_wdt: add reset lines @ 2017-05-18 8:42 Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 1/3] watchdog: bindings: " Steffen Trumtrar ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Steffen Trumtrar @ 2017-05-18 8:42 UTC (permalink / raw) To: linux-arm-kernel Hi! This series adds support for the reset line that is (potentially) holding the watchdog in reset. As the watchdog is useless if this happens, it needs to be deasserted in the probe function. Tested on a Socrates board. Regards, Steffen Changes since v2: - use optional reset functions - add Acked-by to devicetree bindings Changes since v1: - remove reset-names property - remove warning if reset property is missing Steffen Trumtrar (3): watchdog: bindings: dw_wdt: add reset lines watchdog: dw_wdt: get reset lines from dt ARM: socfpga: dtsi: add dw-wdt reset lines Documentation/devicetree/bindings/watchdog/dw_wdt.txt | 3 +++ arch/arm/boot/dts/socfpga.dtsi | 2 ++ drivers/watchdog/dw_wdt.c | 9 +++++++++ 3 files changed, 14 insertions(+) base-commit: 2ea659a9ef488125eb46da6eb571de5eae5c43f6 -- git-series 0.9.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/3] watchdog: bindings: dw_wdt: add reset lines 2017-05-18 8:42 [PATCH v3 0/3] watchdog: dw_wdt: add reset lines Steffen Trumtrar @ 2017-05-18 8:42 ` Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 2/3] watchdog: dw_wdt: get reset lines from dt Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 3/3] ARM: socfpga: dtsi: add dw-wdt reset lines Steffen Trumtrar 2 siblings, 0 replies; 5+ messages in thread From: Steffen Trumtrar @ 2017-05-18 8:42 UTC (permalink / raw) To: linux-arm-kernel Document the reset lines holding the watchdog core in reset. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Rob Herring <robh+dt@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: linux-watchdog at vger.kernel.org Cc: devicetree at vger.kernel.org Acked-by: Rob Herring <robh@kernel.org> --- Documentation/devicetree/bindings/watchdog/dw_wdt.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/watchdog/dw_wdt.txt b/Documentation/devicetree/bindings/watchdog/dw_wdt.txt index 08e16f684f2d..eb0914420c7c 100644 --- a/Documentation/devicetree/bindings/watchdog/dw_wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/dw_wdt.txt @@ -10,6 +10,8 @@ Required Properties: Optional Properties: - interrupts : The interrupt used for the watchdog timeout warning. +- resets : phandle pointing to the system reset controller with + line index for the watchdog. Example: @@ -18,4 +20,5 @@ Example: reg = <0xffd02000 0x1000>; interrupts = <0 171 4>; clocks = <&per_base_clk>; + resets = <&rst WDT0_RESET>; }; -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] watchdog: dw_wdt: get reset lines from dt 2017-05-18 8:42 [PATCH v3 0/3] watchdog: dw_wdt: add reset lines Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 1/3] watchdog: bindings: " Steffen Trumtrar @ 2017-05-18 8:42 ` Steffen Trumtrar 2017-05-18 9:02 ` Philipp Zabel 2017-05-18 8:42 ` [PATCH v3 3/3] ARM: socfpga: dtsi: add dw-wdt reset lines Steffen Trumtrar 2 siblings, 1 reply; 5+ messages in thread From: Steffen Trumtrar @ 2017-05-18 8:42 UTC (permalink / raw) To: linux-arm-kernel The dw_wdt has an external reset line, that can keep the device in reset and therefore rendering it useless and also is the only way of stopping the watchdog once it was started. Get the reset lines for this core from the devicetree. As these lines are optional, use devm_reset_control_get_optional_shared. If the reset line is not specified in the devicetree, the reset framework will just skip deasserting and continue. This way all users of the driver will continue to function without any harm, even if the reset line is not specified in the devicetree. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-watchdog at vger.kernel.org --- drivers/watchdog/dw_wdt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 914da3a4d334..61cbae3a9331 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -29,6 +29,7 @@ #include <linux/of.h> #include <linux/pm.h> #include <linux/platform_device.h> +#include <linux/reset.h> #include <linux/watchdog.h> #define WDOG_CONTROL_REG_OFFSET 0x00 @@ -54,6 +55,7 @@ struct dw_wdt { struct clk *clk; unsigned long rate; struct watchdog_device wdd; + struct reset_control *rst; }; #define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd) @@ -234,6 +236,12 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) goto out_disable_clk; } + dw_wdt->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL); + if (IS_ERR(dw_wdt->rst)) + return PTR_ERR(dw_wdt->rst); + + reset_control_deassert(dw_wdt->rst); + wdd = &dw_wdt->wdd; wdd->info = &dw_wdt_ident; wdd->ops = &dw_wdt_ops; @@ -278,6 +286,7 @@ static int dw_wdt_drv_remove(struct platform_device *pdev) { struct dw_wdt *dw_wdt = platform_get_drvdata(pdev); + reset_control_assert(dw_wdt->rst); watchdog_unregister_device(&dw_wdt->wdd); clk_disable_unprepare(dw_wdt->clk); -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] watchdog: dw_wdt: get reset lines from dt 2017-05-18 8:42 ` [PATCH v3 2/3] watchdog: dw_wdt: get reset lines from dt Steffen Trumtrar @ 2017-05-18 9:02 ` Philipp Zabel 0 siblings, 0 replies; 5+ messages in thread From: Philipp Zabel @ 2017-05-18 9:02 UTC (permalink / raw) To: linux-arm-kernel On Thu, 2017-05-18 at 10:42 +0200, Steffen Trumtrar wrote: > The dw_wdt has an external reset line, that can keep the device in reset > and therefore rendering it useless and also is the only way of stopping > the watchdog once it was started. > > Get the reset lines for this core from the devicetree. As these lines are > optional, use devm_reset_control_get_optional_shared. If the reset line > is not specified in the devicetree, the reset framework will just skip > deasserting and continue. > This way all users of the driver will continue to function without > any harm, even if the reset line is not specified in the devicetree. > > Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> > Cc: Wim Van Sebroeck <wim@iguana.be> > Cc: Guenter Roeck <linux@roeck-us.net> > Cc: linux-watchdog at vger.kernel.org > --- > drivers/watchdog/dw_wdt.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c > index 914da3a4d334..61cbae3a9331 100644 > --- a/drivers/watchdog/dw_wdt.c > +++ b/drivers/watchdog/dw_wdt.c > @@ -29,6 +29,7 @@ > #include <linux/of.h> > #include <linux/pm.h> > #include <linux/platform_device.h> > +#include <linux/reset.h> > #include <linux/watchdog.h> > > #define WDOG_CONTROL_REG_OFFSET 0x00 > @@ -54,6 +55,7 @@ struct dw_wdt { > struct clk *clk; > unsigned long rate; > struct watchdog_device wdd; > + struct reset_control *rst; > }; > > #define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd) > @@ -234,6 +236,12 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) > goto out_disable_clk; Sorry, I didn't notice this before. > } > > + dw_wdt->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL); > + if (IS_ERR(dw_wdt->rst)) > + return PTR_ERR(dw_wdt->rst); This should either goto out_disable_clk, or the reset_control could be acquired a bit earlier before enabling the clock. > + > + reset_control_deassert(dw_wdt->rst); > + > wdd = &dw_wdt->wdd; > wdd->info = &dw_wdt_ident; > wdd->ops = &dw_wdt_ops; > @@ -278,6 +286,7 @@ static int dw_wdt_drv_remove(struct platform_device *pdev) > { > struct dw_wdt *dw_wdt = platform_get_drvdata(pdev); > > + reset_control_assert(dw_wdt->rst); And I'd move this ... > watchdog_unregister_device(&dw_wdt->wdd); ... here for symmetry. > clk_disable_unprepare(dw_wdt->clk); > Otherwise, Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] ARM: socfpga: dtsi: add dw-wdt reset lines 2017-05-18 8:42 [PATCH v3 0/3] watchdog: dw_wdt: add reset lines Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 1/3] watchdog: bindings: " Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 2/3] watchdog: dw_wdt: get reset lines from dt Steffen Trumtrar @ 2017-05-18 8:42 ` Steffen Trumtrar 2 siblings, 0 replies; 5+ messages in thread From: Steffen Trumtrar @ 2017-05-18 8:42 UTC (permalink / raw) To: linux-arm-kernel Add the reset lines to both watchdogs. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Cc: Dinh Nguyen <dinguyen@opensource.altera.com> Cc: linux-arm-kernel at lists.infradead.org --- arch/arm/boot/dts/socfpga.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index b2674bdb8e6a..547b2720abf5 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi @@ -924,6 +924,7 @@ reg = <0xffd02000 0x1000>; interrupts = <0 171 4>; clocks = <&osc1>; + resets = <&rst L4WD0_RESET>; status = "disabled"; }; @@ -932,6 +933,7 @@ reg = <0xffd03000 0x1000>; interrupts = <0 172 4>; clocks = <&osc1>; + resets = <&rst L4WD1_RESET>; status = "disabled"; }; }; -- git-series 0.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-18 9:02 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-18 8:42 [PATCH v3 0/3] watchdog: dw_wdt: add reset lines Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 1/3] watchdog: bindings: " Steffen Trumtrar 2017-05-18 8:42 ` [PATCH v3 2/3] watchdog: dw_wdt: get reset lines from dt Steffen Trumtrar 2017-05-18 9:02 ` Philipp Zabel 2017-05-18 8:42 ` [PATCH v3 3/3] ARM: socfpga: dtsi: add dw-wdt reset lines Steffen Trumtrar
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).