From patchwork Thu Nov 17 11:49:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 21594 Return-Path: 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 + 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 ); 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 To: Wim Van Sebroeck , Guenter Roeck , Philipp Zabel , Geert Uytterhoeven Cc: Lad Prabhakar , Biju Das , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Paterson , Biju Das , Fabrizio Castro , linux-renesas-soc@vger.kernel.org, Laurent Pinchart , Jacopo Mondi 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 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: 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?= From: Lad Prabhakar 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 Reviewed-by: Guenter Roeck Reviewed-by: Geert Uytterhoeven Reviewed-by: Biju Das --- 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); }