From patchwork Thu Nov 3 22:39:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 13031056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EE15C4332F for ; Thu, 3 Nov 2022 22:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbiKCWkU (ORCPT ); Thu, 3 Nov 2022 18:40:20 -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 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@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 Reviewed-by: Geert Uytterhoeven Reviewed-by: Guenter Roeck --- 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 */ From patchwork Thu Nov 3 22:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 13031057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CF3FC4332F for ; Thu, 3 Nov 2022 22:40:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbiKCWk3 (ORCPT ); Thu, 3 Nov 2022 18:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbiKCWkX (ORCPT ); Thu, 3 Nov 2022 18:40:23 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 980BF1EEF9; Thu, 3 Nov 2022 15:40:21 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.96,135,1665414000"; d="scan'208";a="141405084" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 04 Nov 2022 07:40:21 +0900 Received: from mulinux.home (unknown [10.226.92.174]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id E4BA0400A8BF; Fri, 4 Nov 2022 07:40:15 +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 2/3] arm64: dts: renesas: r9a09g011: Add watchdog node Date: Thu, 3 Nov 2022 22:39:55 +0000 Message-Id: <20221103223956.50575-3-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 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org The r9a09g011 (a.k.a. RZ/V2M) comes with two watchdog IPs, but Linux is only allowed one. Add a node for the watchdog allowed to Linux to the SoC specific dtsi. Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven --- arch/arm64/boot/dts/renesas/r9a09g011.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a09g011.dtsi b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi index fb1a97202c38..9859c717bd10 100644 --- a/arch/arm64/boot/dts/renesas/r9a09g011.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi @@ -161,6 +161,19 @@ uart0: serial@a4040000 { status = "disabled"; }; + wdt0: watchdog@a4050000 { + compatible = "renesas,r9a09g011-wdt", + "renesas,rzv2m-wdt"; + reg = <0 0xa4050000 0 0x80>; + clocks = <&cpg CPG_MOD R9A09G011_WDT0_PCLK>, + <&cpg CPG_MOD R9A09G011_WDT0_CLK>; + clock-names = "pclk", "oscclk"; + interrupts = ; + resets = <&cpg R9A09G011_WDT0_PRESETN>; + power-domains = <&cpg>; + status = "disabled"; + }; + pinctrl: pinctrl@b6250000 { compatible = "renesas,r9a09g011-pinctrl"; reg = <0 0xb6250000 0 0x800>; From patchwork Thu Nov 3 22:39:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 13031058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59ADDC4332F for ; Thu, 3 Nov 2022 22:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231811AbiKCWkl (ORCPT ); Thu, 3 Nov 2022 18:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231733AbiKCWk3 (ORCPT ); Thu, 3 Nov 2022 18:40:29 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0309E20F65; Thu, 3 Nov 2022 15:40:26 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.96,135,1665414000"; d="scan'208";a="138899989" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 04 Nov 2022 07:40:26 +0900 Received: from mulinux.home (unknown [10.226.92.174]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 910F14005B31; Fri, 4 Nov 2022 07:40:21 +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 3/3] arm64: dts: renesas: v2mevk2: Enable watchdog Date: Thu, 3 Nov 2022 22:39:56 +0000 Message-Id: <20221103223956.50575-4-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 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Enable the watchdog so that we can reboot the system. Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven --- arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts index 5c15d73d059f..11e1d51c7c0e 100644 --- a/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts +++ b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts @@ -83,3 +83,7 @@ i2c2_pins: i2c2 { &uart0 { status = "okay"; }; + +&wdt0 { + status = "okay"; +};