From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757137AbcIVNOx (ORCPT ); Thu, 22 Sep 2016 09:14:53 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:48847 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756112AbcIVNOv (ORCPT ); Thu, 22 Sep 2016 09:14:51 -0400 Subject: Re: [PATCH 2/3] watchdog: dw_wdt: get reset lines from dt To: Steffen Trumtrar , linux-watchdog@vger.kernel.org References: <1474527753-22194-1-git-send-email-s.trumtrar@pengutronix.de> <1474527753-22194-3-git-send-email-s.trumtrar@pengutronix.de> Cc: kernel@pengutronix.de, Wim Van Sebroeck , linux-kernel@vger.kernel.org From: Guenter Roeck Message-ID: <89edac4c-a105-21df-de50-367da345806a@roeck-us.net> Date: Thu, 22 Sep 2016 06:14:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1474527753-22194-3-git-send-email-s.trumtrar@pengutronix.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/22/2016 12:02 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 > Cc: Wim Van Sebroeck > Cc: Guenter Roeck > Cc: linux-watchdog@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 2acb51cf5504..e024722e8b3b 100644 > --- a/drivers/watchdog/dw_wdt.c > +++ b/drivers/watchdog/dw_wdt.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > #include > > #define WDOG_CONTROL_REG_OFFSET 0x00 > @@ -56,6 +57,7 @@ struct dw_wdt { > struct clk *clk; > struct notifier_block restart_handler; > struct watchdog_device wdd; > + struct reset_control *rst; > }; > > #define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd) > @@ -231,6 +233,10 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) > if (ret) > return ret; > > + dw_wdt->rst = devm_reset_control_get(&pdev->dev, "dw-wdt"); > + if (IS_ERR(dw_wdt->rst)) > + dev_warn(dev, "No reset lines. Will not be able to stop once started.\n"); This situation is already handled by the driver. Actually, I don't even know what will happen, since the watchdog core will continue to ping the watchdog after close, and it won't be possible to unload the driver if the watchdog is running. I don't think a warning is warranted in this case. We did not need one before, we should not need one now. > + > wdd = &dw_wdt->wdd; > wdd->info = &dw_wdt_ident; > wdd->ops = &dw_wdt_ops; > @@ -268,6 +274,9 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) > if (ret) > pr_warn("cannot register restart handler\n"); > > + if (dw_wdt->rst) > + reset_control_deassert(dw_wdt->rst); > + > return 0; > > out_disable_clk: >