Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2352060rwi; Thu, 3 Nov 2022 16:11:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xyvp/gai9Bm3k334vHNazkk64+UIPxQo0u1mvqPxXG/RH3IwQpBOvXonSCRUT8Haipcq1 X-Received: by 2002:a05:6402:d5:b0:464:7023:634 with SMTP id i21-20020a05640200d500b0046470230634mr141490edu.165.1667517091193; Thu, 03 Nov 2022 16:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667517091; cv=none; d=google.com; s=arc-20160816; b=g4lesS1C3FAtl3jilWFyXqbw7wcJCnj6bNpsx2cCOa2FoJA68ILuaQKf8IWwAYvNss +bc9fQQbvdJrnnU7/YzEEceZ9QBtkEigP1bQEUesJ0qj5mpCie+SlQN2SsG7P9knI3Rx eVME07dhJeEmoaBT9t40rSzGVgITl37I0OHeGCO6kUiXNr0KJBjZcl7szc3vrvcih8hc /CbIxcWY3QLt1270QvdNTNLNXvAt021PwT62SrLk81hXd+tnrPBDXeTLPcXj2mvOlU+J 0dDiMgzGb7dH5gMqn2Ydxj3wRnWTNeZSaYIzt6TrB+dl6aWEOPaL/XHC0IsVgdtRutrO 1nkA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho7-20020a1709070e8700b007ad855bc09csi3076390ejc.595.2022.11.03.16.11.08; Thu, 03 Nov 2022 16:11:31 -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 + 97 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 ); 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 To: Rob Herring , Krzysztof Kozlowski , Wim Van Sebroeck , Guenter Roeck , Geert Uytterhoeven Cc: Fabrizio Castro , Magnus Damm , Biju Das , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Chris Paterson , Biju Das , Fabrizio Castro , Laurent Pinchart , Jacopo Mondi 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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