Message ID | 20221117114907.138583-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:adf:f944:0:0:0:0:0 with SMTP id q4csp355608wrr; Thu, 17 Nov 2022 03:54:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf7vrvKvPFTK5AfNoDHEQcA31KZMKsUEqyrqxZYmkYWS4/5VuaSnD4AQIFFiyWVXBnBSaMSA X-Received: by 2002:a17:902:ab0d:b0:183:6555:38ef with SMTP id ik13-20020a170902ab0d00b00183655538efmr2288151plb.157.1668686095257; Thu, 17 Nov 2022 03:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668686095; cv=none; d=google.com; s=arc-20160816; b=OPRgSKeyR0kw/mACv0MgpqUE3RhRQFJgk9ekObAjzCJSLd2Qz0xLP5wNu/XstgrS4W bRDHZaFV/U2AcAD6nxkvf7EknwHGrkzEoeQnDixPxVIv0xfadNTb1aTJRlPjb/uGpiKd Ymb6414GMp1HVDeJsUm1HXBaZ4ZIAyUT6f/tX9cfpX1DaZbkPJRlWuPnIK56igPx7DAY 2cj1RNDaWi4Cfh+uvdH9AdDMbsrJDxTCxm6zLoCPhG6KYc3m66iajMZTDvH9DERRjkqx +lDxZNG4skgkpzUygvsGClKzcS72cC6QUJ52NBLOgrmlX4gbDvZW7q6eApQoyrciqyBZ rq+g== 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=ZlRTLhd5wv1lx+V8UVnDHuP3dnF3LGT4m1QJB6h9D1Y=; b=OZUmpt9aTKZlBWNG+EqZLFt+WLVjfmMu+GiE5/FgdL77fcugCeBPIT9WqzX03kncp3 9I5KcFiAee/8LjI3ODnKxCtdk7a0WkRkK4W4YjPQGCtQqRXCnUgC5Q7pbQjd/xqwz8u+ c80b00hZ7TVi4DQWnd109IAvc3V03ceIn+zMoHPDCAcoKglB21NCSnRyy6in/LL2rpD2 Lc7ggRvjFG43iEeIL1IH7fL7+JF0T0lwEcIlF5vxInC6A4jAADJOfc3kiRnKqwi+g3VH Va+Cv3JD3fo7jG7Y13vQMJF4bC5Amdpbum1+WgHzf21eTO6tTKQQia4qJzguR2krPXxB cNgg== 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 h63-20020a638342000000b004750a252941si767370pge.774.2022.11.17.03.54.42; Thu, 17 Nov 2022 03:54:55 -0800 (PST) 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 S239783AbiKQLtz (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Thu, 17 Nov 2022 06:49:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239376AbiKQLt0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 17 Nov 2022 06:49:26 -0500 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6BA29591; Thu, 17 Nov 2022 03:49:25 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.96,171,1665414000"; d="scan'208";a="142991208" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 17 Nov 2022 20:49:25 +0900 Received: from mulinux.example.org (unknown [10.226.93.80]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 280CE400C75F; Thu, 17 Nov 2022 20:49:20 +0900 (JST) From: Fabrizio Castro <fabrizio.castro.jz@renesas.com> To: Wim Van Sebroeck <wim@linux-watchdog.org>, Guenter Roeck <linux@roeck-us.net>, Philipp Zabel <p.zabel@pengutronix.de>, Geert Uytterhoeven <geert+renesas@glider.be> Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>, Biju Das <biju.das.jz@bp.renesas.com>, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Paterson <Chris.Paterson2@renesas.com>, Biju Das <biju.das@bp.renesas.com>, Fabrizio Castro <fabrizio.castro.jz@renesas.com>, linux-renesas-soc@vger.kernel.org, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Jacopo Mondi <jacopo@jmondi.org> Subject: [PATCH 1/2] watchdog: rzg2l_wdt: Issue a reset before we put the PM clocks Date: Thu, 17 Nov 2022 11:49:06 +0000 Message-Id: <20221117114907.138583-2-fabrizio.castro.jz@renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221117114907.138583-1-fabrizio.castro.jz@renesas.com> References: <20221117114907.138583-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?1749744190597727220?= X-GMAIL-MSGID: =?utf-8?q?1749744190597727220?= |
Series |
Reset related fixes for rzg2l_wdt
|
|
Commit Message
Fabrizio Castro
Nov. 17, 2022, 11:49 a.m. UTC
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't reset the system. The procedure described in the HW manual (Procedure for Activating Modules) for activating the target module states we need to start supply of the clock module before applying the reset signal. This patch makes sure we follow the same procedure to clear the registers of the WDT module, fixing the issues seen on RZ/Five SoC. While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as it has the same function calls. Fixes: 4055ee81009e ("watchdog: rzg2l_wdt: Add set_timeout callback") Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> --- drivers/watchdog/rzg2l_wdt.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
Comments
On 11/17/22 03:49, Fabrizio Castro wrote: > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't > reset the system. > > The procedure described in the HW manual (Procedure for Activating Modules) > for activating the target module states we need to start supply of the > clock module before applying the reset signal. This patch makes sure we > follow the same procedure to clear the registers of the WDT module, fixing > the issues seen on RZ/Five SoC. > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as it has > the same function calls. > > Fixes: 4055ee81009e ("watchdog: rzg2l_wdt: Add set_timeout callback") > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/watchdog/rzg2l_wdt.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > index 974a4194a8fd..ceca42db0837 100644 > --- a/drivers/watchdog/rzg2l_wdt.c > +++ b/drivers/watchdog/rzg2l_wdt.c > @@ -115,25 +115,23 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev) > { > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > - pm_runtime_put(wdev->parent); > reset_control_reset(priv->rstc); > + pm_runtime_put(wdev->parent); > > return 0; > } > > static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout) > { > - struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > - > wdev->timeout = timeout; > > /* > * If the watchdog is active, reset the module for updating the WDTSET > - * register so that it is updated with new timeout values. > + * register by calling rzg2l_wdt_stop() (which internally calls reset_control_reset() > + * to reset the module) so that it is updated with new timeout values. > */ > if (watchdog_active(wdev)) { > - pm_runtime_put(wdev->parent); > - reset_control_reset(priv->rstc); > + rzg2l_wdt_stop(wdev); > rzg2l_wdt_start(wdev); > } >
On Thu, Nov 17, 2022 at 12:49 PM Fabrizio Castro <fabrizio.castro.jz@renesas.com> wrote: > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't > reset the system. > > The procedure described in the HW manual (Procedure for Activating Modules) > for activating the target module states we need to start supply of the > clock module before applying the reset signal. This patch makes sure we > follow the same procedure to clear the registers of the WDT module, fixing > the issues seen on RZ/Five SoC. > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as it has > the same function calls. > > Fixes: 4055ee81009e ("watchdog: rzg2l_wdt: Add set_timeout callback") > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.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
Hi All, It looks like this patch has been reviewed by both Guenter Roeck and Geert Uytterhoeven, any chance that it can be taken for v6.3? Thanks, Fab > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) > wouldn't > reset the system. > > The procedure described in the HW manual (Procedure for Activating > Modules) > for activating the target module states we need to start supply of the > clock module before applying the reset signal. This patch makes sure we > follow the same procedure to clear the registers of the WDT module, fixing > the issues seen on RZ/Five SoC. > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as it has > the same function calls. > > Fixes: 4055ee81009e ("watchdog: rzg2l_wdt: Add set_timeout callback") > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > --- > drivers/watchdog/rzg2l_wdt.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > index 974a4194a8fd..ceca42db0837 100644 > --- a/drivers/watchdog/rzg2l_wdt.c > +++ b/drivers/watchdog/rzg2l_wdt.c > @@ -115,25 +115,23 @@ static int rzg2l_wdt_stop(struct watchdog_device > *wdev) > { > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > - pm_runtime_put(wdev->parent); > reset_control_reset(priv->rstc); > + pm_runtime_put(wdev->parent); > > return 0; > } > > static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned > int timeout) > { > - struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > - > wdev->timeout = timeout; > > /* > * If the watchdog is active, reset the module for updating the > WDTSET > - * register so that it is updated with new timeout values. > + * register by calling rzg2l_wdt_stop() (which internally calls > reset_control_reset() > + * to reset the module) so that it is updated with new timeout > values. > */ > if (watchdog_active(wdev)) { > - pm_runtime_put(wdev->parent); > - reset_control_reset(priv->rstc); > + rzg2l_wdt_stop(wdev); > rzg2l_wdt_start(wdev); > } > > -- > 2.34.1
Hi Fabrizio, Thanks for the patch. > Subject: [PATCH 1/2] watchdog: rzg2l_wdt: Issue a reset before we put the PM > clocks > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > On RZ/Five SoC it was observed that setting timeout (to say 1 sec) wouldn't > reset the system. > > The procedure described in the HW manual (Procedure for Activating Modules) > for activating the target module states we need to start supply of the clock > module before applying the reset signal. This patch makes sure we follow the > same procedure to clear the registers of the WDT module, fixing the issues > seen on RZ/Five SoC. > > While at it re-used rzg2l_wdt_stop() in rzg2l_wdt_set_timeout() as it has > the same function calls. > > Fixes: 4055ee81009e ("watchdog: rzg2l_wdt: Add set_timeout callback") > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Cheers, Biju > --- > drivers/watchdog/rzg2l_wdt.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > index 974a4194a8fd..ceca42db0837 100644 > --- a/drivers/watchdog/rzg2l_wdt.c > +++ b/drivers/watchdog/rzg2l_wdt.c > @@ -115,25 +115,23 @@ static int rzg2l_wdt_stop(struct watchdog_device > *wdev) { > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > > - pm_runtime_put(wdev->parent); > reset_control_reset(priv->rstc); > + pm_runtime_put(wdev->parent); > > return 0; > } > > static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int > timeout) { > - struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > - > wdev->timeout = timeout; > > /* > * If the watchdog is active, reset the module for updating the WDTSET > - * register so that it is updated with new timeout values. > + * register by calling rzg2l_wdt_stop() (which internally calls > reset_control_reset() > + * to reset the module) so that it is updated with new timeout values. > */ > if (watchdog_active(wdev)) { > - pm_runtime_put(wdev->parent); > - reset_control_reset(priv->rstc); > + rzg2l_wdt_stop(wdev); > rzg2l_wdt_start(wdev); > } > > -- > 2.34.1
diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 974a4194a8fd..ceca42db0837 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -115,25 +115,23 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev) { struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); - pm_runtime_put(wdev->parent); reset_control_reset(priv->rstc); + pm_runtime_put(wdev->parent); return 0; } static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout) { - struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); - wdev->timeout = timeout; /* * If the watchdog is active, reset the module for updating the WDTSET - * register so that it is updated with new timeout values. + * register by calling rzg2l_wdt_stop() (which internally calls reset_control_reset() + * to reset the module) so that it is updated with new timeout values. */ if (watchdog_active(wdev)) { - pm_runtime_put(wdev->parent); - reset_control_reset(priv->rstc); + rzg2l_wdt_stop(wdev); rzg2l_wdt_start(wdev); }