[PATCH v2 2/3] watchdog: dw_wdt: get reset lines from dt
Guenter Roeck
linux at roeck-us.net
Sun May 14 07:33:37 PDT 2017
On 05/12/2017 06:34 AM, 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.
> If resets are not specified just warn but don't fail probing to be compatible
> with all users.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
> Cc: Wim Van Sebroeck <wim at iguana.be>
> Cc: Guenter Roeck <linux at roeck-us.net>
> Cc: linux-watchdog at vger.kernel.org
> ---
> drivers/watchdog/dw_wdt.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 914da3a4d334..3accddf1f381 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,8 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
> goto out_disable_clk;
> }
>
> + dw_wdt->rst = devm_reset_control_get(&pdev->dev, NULL);
> +
devm_reset_control_get() does not return NULL, it returns ERR_PTR on error.
> wdd = &dw_wdt->wdd;
> wdd->info = &dw_wdt_ident;
> wdd->ops = &dw_wdt_ops;
> @@ -267,6 +271,9 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
> if (ret)
> goto out_disable_clk;
>
> + if (dw_wdt->rst)
> + reset_control_deassert(dw_wdt->rst);
Granted, this doesn't cause a crash here, but a warning with traceback.
Either case, the if() statement misses the point.
> +
> return 0;
>
> out_disable_clk:
>
More information about the linux-arm-kernel
mailing list