Message ID | 20221103223956.50575-2-fabrizio.castro.jz@renesas.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp36677wru; Thu, 3 Nov 2022 15:48:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4S/O6axioEenwpEfbPkHi8LJGNSp2Iz57qyrPK43nYIWoIe70PJ1SxZknjeqZCK5yYebXw X-Received: by 2002:a17:903:120d:b0:178:a6ca:b974 with SMTP id l13-20020a170903120d00b00178a6cab974mr32091672plh.8.1667515691602; Thu, 03 Nov 2022 15:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667515691; cv=none; d=google.com; s=arc-20160816; b=Pr8dtrMHibO18aqc+mSyyWUmhYdZCYeQHeXXj8zT6L/Zr/Jc6102IjpnjgxIPm0i/h zo9D7oQEY/kNbNNGFyjmKhSWAZO0Nsk2GwyqQxqX87hZ9/lQC2w5SVRxLdaCOGkqbtNM ey5IOkxapfS+V/+Z131K9YXybgpn2WgdKR/O4TJJ2xAnQUtGGICTsV4tskfj4qNwQXLr 5Fd8mdTzcJbIeM/dFR/gOuhR24lVK/+BcueUXgMnHpQLmd7z6djMEjeoihySS41g/p5E A4fC+bJOnV8s5926q4+61mAF5OPFB1OZE/TT4HWOLQT+OpdAwhEPWhPLJS/DmhYVSq4E SP8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/74co7dZaPrNez9YuUf4LRh/SMhk6N9VYsDxDvbTr80=; b=tilwsInSkH9d8Iv0NZDnvKINtPHhPy4iICzz0JNmnzJRZvMG+Z8FNwyA6AhiEQZAr+ zStZFU2k06Caf/8k2k3Eoknp7BKOoRFtDm0kmabD220kKjCbq0XD4YvBoMyF6kIRJDPl fXVOH87GR0hlnupwTXPrwsaaNUVzth4ggVUNECMmh2400xG5l/lTCZIqJYo+feDMonjR arbyHLnLBwALhnia8Gyo1bNKYTAuIUdRPhN/jaFD9r1XOVCwhqPZl4I5xtMO2uvG4Xqg +NJioggTa5bYmR3Q5Iptk8FBggb4bVgsgZzrPAR3z3DIUYCZxviMO/J6IKEvC7SWcZz6 csnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a17090332c700b001869fc56c40si2560288plr.103.2022.11.03.15.47.14; Thu, 03 Nov 2022 15:48:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbiKCWkV (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 18:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiKCWkR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 18:40:17 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38C731EEC7; Thu, 3 Nov 2022 15:40:16 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.96,135,1665414000"; d="scan'208";a="141405070" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 04 Nov 2022 07:40:15 +0900 Received: from mulinux.home (unknown [10.226.92.174]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 41EFA400A8BF; Fri, 4 Nov 2022 07:40:09 +0900 (JST) From: Fabrizio Castro <fabrizio.castro.jz@renesas.com> To: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Wim Van Sebroeck <wim@linux-watchdog.org>, Guenter Roeck <linux@roeck-us.net>, Geert Uytterhoeven <geert+renesas@glider.be> Cc: Fabrizio Castro <fabrizio.castro.jz@renesas.com>, Magnus Damm <magnus.damm@gmail.com>, Biju Das <biju.das.jz@bp.renesas.com>, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Chris Paterson <Chris.Paterson2@renesas.com>, Biju Das <biju.das@bp.renesas.com>, Fabrizio Castro <fabrizio.castro@bp.renesas.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Jacopo Mondi <jacopo@jmondi.org> Subject: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M Date: Thu, 3 Nov 2022 22:39:54 +0000 Message-Id: <20221103223956.50575-2-fabrizio.castro.jz@renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103223956.50575-1-fabrizio.castro.jz@renesas.com> References: <20221103223956.50575-1-fabrizio.castro.jz@renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748516934260537283?= X-GMAIL-MSGID: =?utf-8?q?1748516934260537283?= |
Series |
Add Watchdog support for RZ/V2M EVK v2
|
|
Commit Message
Fabrizio Castro
Nov. 3, 2022, 10:39 p.m. UTC
The setting for the RZ/V2M watchdog cannot be changed once
the watchdog has been enabled, unless the IP gets reset.
The current implementation of the restart callback assumes
that the watchdog is not enabled, but that's not always the
case, and it leads to longer than necessary reboot times if
the watchdog is already running.
Always reset the RZ/V2M watchdog first, so that we can always
restart quickly.
Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support")
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
drivers/watchdog/rzg2l_wdt.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Comments
On Thu, Nov 3, 2022 at 11:40 PM Fabrizio Castro <fabrizio.castro.jz@renesas.com> wrote: > The setting for the RZ/V2M watchdog cannot be changed once > the watchdog has been enabled, unless the IP gets reset. > The current implementation of the restart callback assumes > that the watchdog is not enabled, but that's not always the > case, and it leads to longer than necessary reboot times if > the watchdog is already running. > > Always reset the RZ/V2M watchdog first, so that we can always > restart quickly. > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote: > The setting for the RZ/V2M watchdog cannot be changed once > the watchdog has been enabled, unless the IP gets reset. > The current implementation of the restart callback assumes > that the watchdog is not enabled, but that's not always the > case, and it leads to longer than necessary reboot times if > the watchdog is already running. > > Always reset the RZ/V2M watchdog first, so that we can always > restart quickly. > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > index 974a4194a8fd..00438ceed17a 100644 > --- a/drivers/watchdog/rzg2l_wdt.c > +++ b/drivers/watchdog/rzg2l_wdt.c > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, > { > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > - clk_prepare_enable(priv->pclk); > - clk_prepare_enable(priv->osc_clk); > - > if (priv->devtype == WDT_RZG2L) { > + clk_prepare_enable(priv->pclk); > + clk_prepare_enable(priv->osc_clk); > + > /* Generate Reset (WDTRSTB) Signal on parity error */ > rzg2l_wdt_write(priv, 0, PECR); > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, > } else { > /* RZ/V2M doesn't have parity error registers */ > > + reset_control_reset(priv->rstc); > + > + clk_prepare_enable(priv->pclk); > + clk_prepare_enable(priv->osc_clk); > + > wdev->timeout = 0; > > /* Initialize time out */ > -- > 2.34.1 >
Hi Geert and Guenter, Thank you for your reviews! As it turns out, the rzg2l_wdt driver has some reset related issues (currently not addressed by the driver) for the RZ/V2M and RZ/Five SoCs. More specifically to this patch, there is a better way to fix the restart callback by addressing the way the reset is handled for the watchdog IP. I am dropping this patch, and I'll send out a series to address the above concerns (which will tackle the issues with the restart callback in a better way). Thanks, Fab > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck > Sent: 15 November 2022 13:28 > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote: > > The setting for the RZ/V2M watchdog cannot be changed once > > the watchdog has been enabled, unless the IP gets reset. > > The current implementation of the restart callback assumes > > that the watchdog is not enabled, but that's not always the > > case, and it leads to longer than necessary reboot times if > > the watchdog is already running. > > > > Always reset the RZ/V2M watchdog first, so that we can always > > restart quickly. > > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > > > --- > > drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > > index 974a4194a8fd..00438ceed17a 100644 > > --- a/drivers/watchdog/rzg2l_wdt.c > > +++ b/drivers/watchdog/rzg2l_wdt.c > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct > watchdog_device *wdev, > > { > > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > > > - clk_prepare_enable(priv->pclk); > > - clk_prepare_enable(priv->osc_clk); > > - > > if (priv->devtype == WDT_RZG2L) { > > + clk_prepare_enable(priv->pclk); > > + clk_prepare_enable(priv->osc_clk); > > + > > /* Generate Reset (WDTRSTB) Signal on parity error */ > > rzg2l_wdt_write(priv, 0, PECR); > > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device > *wdev, > > } else { > > /* RZ/V2M doesn't have parity error registers */ > > > > + reset_control_reset(priv->rstc); > > + > > + clk_prepare_enable(priv->pclk); > > + clk_prepare_enable(priv->osc_clk); > > + > > wdev->timeout = 0; > > > > /* Initialize time out */ > > -- > > 2.34.1 > >
Hi Fabrizio, Based on below e-mail I excluded this patch from the merge window. I saw that Guenter still has it in his branch. So can we have an update on this please? Thanks in advance, Wim. > Hi Geert and Guenter, > > Thank you for your reviews! > > As it turns out, the rzg2l_wdt driver has some reset related issues > (currently not addressed by the driver) for the RZ/V2M and RZ/Five > SoCs. More specifically to this patch, there is a better way to fix > the restart callback by addressing the way the reset is handled > for the watchdog IP. > > I am dropping this patch, and I'll send out a series to address > the above concerns (which will tackle the issues with the restart > callback in a better way). > > > Thanks, > Fab > > > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck > > Sent: 15 November 2022 13:28 > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M > > > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote: > > > The setting for the RZ/V2M watchdog cannot be changed once > > > the watchdog has been enabled, unless the IP gets reset. > > > The current implementation of the restart callback assumes > > > that the watchdog is not enabled, but that's not always the > > > case, and it leads to longer than necessary reboot times if > > > the watchdog is already running. > > > > > > Always reset the RZ/V2M watchdog first, so that we can always > > > restart quickly. > > > > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> > > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > > > > > --- > > > drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > > > index 974a4194a8fd..00438ceed17a 100644 > > > --- a/drivers/watchdog/rzg2l_wdt.c > > > +++ b/drivers/watchdog/rzg2l_wdt.c > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct > > watchdog_device *wdev, > > > { > > > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > > > > > - clk_prepare_enable(priv->pclk); > > > - clk_prepare_enable(priv->osc_clk); > > > - > > > if (priv->devtype == WDT_RZG2L) { > > > + clk_prepare_enable(priv->pclk); > > > + clk_prepare_enable(priv->osc_clk); > > > + > > > /* Generate Reset (WDTRSTB) Signal on parity error */ > > > rzg2l_wdt_write(priv, 0, PECR); > > > > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device > > *wdev, > > > } else { > > > /* RZ/V2M doesn't have parity error registers */ > > > > > > + reset_control_reset(priv->rstc); > > > + > > > + clk_prepare_enable(priv->pclk); > > > + clk_prepare_enable(priv->osc_clk); > > > + > > > wdev->timeout = 0; > > > > > > /* Initialize time out */ > > > -- > > > 2.34.1 > > >
On Sun, May 07, 2023 at 05:36:25PM +0200, Wim Van Sebroeck wrote: > Hi Fabrizio, > > Based on below e-mail I excluded this patch from the merge window. > I saw that Guenter still has it in his branch. Thanks for the note. I'll drop it. Guenter > So can we have an update on this please? > > Thanks in advance, > Wim. > > > Hi Geert and Guenter, > > > > Thank you for your reviews! > > > > As it turns out, the rzg2l_wdt driver has some reset related issues > > (currently not addressed by the driver) for the RZ/V2M and RZ/Five > > SoCs. More specifically to this patch, there is a better way to fix > > the restart callback by addressing the way the reset is handled > > for the watchdog IP. > > > > I am dropping this patch, and I'll send out a series to address > > the above concerns (which will tackle the issues with the restart > > callback in a better way). > > > > > > Thanks, > > Fab > > > > > > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck > > > Sent: 15 November 2022 13:28 > > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M > > > > > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote: > > > > The setting for the RZ/V2M watchdog cannot be changed once > > > > the watchdog has been enabled, unless the IP gets reset. > > > > The current implementation of the restart callback assumes > > > > that the watchdog is not enabled, but that's not always the > > > > case, and it leads to longer than necessary reboot times if > > > > the watchdog is already running. > > > > > > > > Always reset the RZ/V2M watchdog first, so that we can always > > > > restart quickly. > > > > > > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > > > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> > > > > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > > > > > > > --- > > > > drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- > > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > > > > index 974a4194a8fd..00438ceed17a 100644 > > > > --- a/drivers/watchdog/rzg2l_wdt.c > > > > +++ b/drivers/watchdog/rzg2l_wdt.c > > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct > > > watchdog_device *wdev, > > > > { > > > > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > > > > > > > - clk_prepare_enable(priv->pclk); > > > > - clk_prepare_enable(priv->osc_clk); > > > > - > > > > if (priv->devtype == WDT_RZG2L) { > > > > + clk_prepare_enable(priv->pclk); > > > > + clk_prepare_enable(priv->osc_clk); > > > > + > > > > /* Generate Reset (WDTRSTB) Signal on parity error */ > > > > rzg2l_wdt_write(priv, 0, PECR); > > > > > > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device > > > *wdev, > > > > } else { > > > > /* RZ/V2M doesn't have parity error registers */ > > > > > > > > + reset_control_reset(priv->rstc); > > > > + > > > > + clk_prepare_enable(priv->pclk); > > > > + clk_prepare_enable(priv->osc_clk); > > > > + > > > > wdev->timeout = 0; > > > > > > > > /* Initialize time out */ > > > > -- > > > > 2.34.1 > > > >
Hi Wim, Thanks for checking on this. This patch was superseded by: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f769f97917c1e756e12ff042a93f6e3167254b5b Therefore, the right thing to do is to get rid of this patch. Thanks, Fab > From: Wim Van Sebroeck <wim@linux-watchdog.org> > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M > > Hi Fabrizio, > > Based on below e-mail I excluded this patch from the merge window. > I saw that Guenter still has it in his branch. > So can we have an update on this please? > > Thanks in advance, > Wim. > > > Hi Geert and Guenter, > > > > Thank you for your reviews! > > > > As it turns out, the rzg2l_wdt driver has some reset related issues > > (currently not addressed by the driver) for the RZ/V2M and RZ/Five > > SoCs. More specifically to this patch, there is a better way to fix > > the restart callback by addressing the way the reset is handled > > for the watchdog IP. > > > > I am dropping this patch, and I'll send out a series to address > > the above concerns (which will tackle the issues with the restart > > callback in a better way). > > > > > > Thanks, > > Fab > > > > > > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck > > > Sent: 15 November 2022 13:28 > > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for > RZ/V2M > > > > > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote: > > > > The setting for the RZ/V2M watchdog cannot be changed once > > > > the watchdog has been enabled, unless the IP gets reset. > > > > The current implementation of the restart callback assumes > > > > that the watchdog is not enabled, but that's not always the > > > > case, and it leads to longer than necessary reboot times if > > > > the watchdog is already running. > > > > > > > > Always reset the RZ/V2M watchdog first, so that we can always > > > > restart quickly. > > > > > > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > > > > Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> > > > > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > > > > > > > --- > > > > drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- > > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c > b/drivers/watchdog/rzg2l_wdt.c > > > > index 974a4194a8fd..00438ceed17a 100644 > > > > --- a/drivers/watchdog/rzg2l_wdt.c > > > > +++ b/drivers/watchdog/rzg2l_wdt.c > > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct > > > watchdog_device *wdev, > > > > { > > > > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > > > > > > > - clk_prepare_enable(priv->pclk); > > > > - clk_prepare_enable(priv->osc_clk); > > > > - > > > > if (priv->devtype == WDT_RZG2L) { > > > > + clk_prepare_enable(priv->pclk); > > > > + clk_prepare_enable(priv->osc_clk); > > > > + > > > > /* Generate Reset (WDTRSTB) Signal on parity error */ > > > > rzg2l_wdt_write(priv, 0, PECR); > > > > > > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct > watchdog_device > > > *wdev, > > > > } else { > > > > /* RZ/V2M doesn't have parity error registers */ > > > > > > > > + reset_control_reset(priv->rstc); > > > > + > > > > + clk_prepare_enable(priv->pclk); > > > > + clk_prepare_enable(priv->osc_clk); > > > > + > > > > wdev->timeout = 0; > > > > > > > > /* Initialize time out */ > > > > -- > > > > 2.34.1 > > > >
Thanks Guenter. Fab > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for RZ/V2M > > On Sun, May 07, 2023 at 05:36:25PM +0200, Wim Van Sebroeck wrote: > > Hi Fabrizio, > > > > Based on below e-mail I excluded this patch from the merge window. > > I saw that Guenter still has it in his branch. > > Thanks for the note. I'll drop it. > > Guenter > > > So can we have an update on this please? > > > > Thanks in advance, > > Wim. > > > > > Hi Geert and Guenter, > > > > > > Thank you for your reviews! > > > > > > As it turns out, the rzg2l_wdt driver has some reset related > issues > > > (currently not addressed by the driver) for the RZ/V2M and RZ/Five > > > SoCs. More specifically to this patch, there is a better way to > fix > > > the restart callback by addressing the way the reset is handled > > > for the watchdog IP. > > > > > > I am dropping this patch, and I'll send out a series to address > > > the above concerns (which will tackle the issues with the restart > > > callback in a better way). > > > > > > > > > Thanks, > > > Fab > > > > > > > > > > From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter > Roeck > > > > Sent: 15 November 2022 13:28 > > > > Subject: Re: [PATCH 1/3] watchdog: rzg2l_wdt: Fix reboot for > RZ/V2M > > > > > > > > On Thu, Nov 03, 2022 at 10:39:54PM +0000, Fabrizio Castro wrote: > > > > > The setting for the RZ/V2M watchdog cannot be changed once > > > > > the watchdog has been enabled, unless the IP gets reset. > > > > > The current implementation of the restart callback assumes > > > > > that the watchdog is not enabled, but that's not always the > > > > > case, and it leads to longer than necessary reboot times if > > > > > the watchdog is already running. > > > > > > > > > > Always reset the RZ/V2M watchdog first, so that we can always > > > > > restart quickly. > > > > > > > > > > Fixes: ec122fd94eeb ("watchdog: rzg2l_wdt: Add rzv2m support") > > > > > Signed-off-by: Fabrizio Castro > <fabrizio.castro.jz@renesas.com> > > > > > > > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > > > > > > > > > --- > > > > > drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- > > > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/drivers/watchdog/rzg2l_wdt.c > b/drivers/watchdog/rzg2l_wdt.c > > > > > index 974a4194a8fd..00438ceed17a 100644 > > > > > --- a/drivers/watchdog/rzg2l_wdt.c > > > > > +++ b/drivers/watchdog/rzg2l_wdt.c > > > > > @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct > > > > watchdog_device *wdev, > > > > > { > > > > > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > > > > > > > > > - clk_prepare_enable(priv->pclk); > > > > > - clk_prepare_enable(priv->osc_clk); > > > > > - > > > > > if (priv->devtype == WDT_RZG2L) { > > > > > + clk_prepare_enable(priv->pclk); > > > > > + clk_prepare_enable(priv->osc_clk); > > > > > + > > > > > /* Generate Reset (WDTRSTB) Signal on parity error */ > > > > > rzg2l_wdt_write(priv, 0, PECR); > > > > > > > > > > @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct > watchdog_device > > > > *wdev, > > > > > } else { > > > > > /* RZ/V2M doesn't have parity error registers */ > > > > > > > > > > + reset_control_reset(priv->rstc); > > > > > + > > > > > + clk_prepare_enable(priv->pclk); > > > > > + clk_prepare_enable(priv->osc_clk); > > > > > + > > > > > wdev->timeout = 0; > > > > > > > > > > /* Initialize time out */ > > > > > -- > > > > > 2.34.1 > > > > >
diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 974a4194a8fd..00438ceed17a 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -145,10 +145,10 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, { struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); - clk_prepare_enable(priv->pclk); - clk_prepare_enable(priv->osc_clk); - if (priv->devtype == WDT_RZG2L) { + clk_prepare_enable(priv->pclk); + clk_prepare_enable(priv->osc_clk); + /* Generate Reset (WDTRSTB) Signal on parity error */ rzg2l_wdt_write(priv, 0, PECR); @@ -157,6 +157,11 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, } else { /* RZ/V2M doesn't have parity error registers */ + reset_control_reset(priv->rstc); + + clk_prepare_enable(priv->pclk); + clk_prepare_enable(priv->osc_clk); + wdev->timeout = 0; /* Initialize time out */