From patchwork Fri Feb 11 00:32:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 12742623 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 06F65C43219 for ; Fri, 11 Feb 2022 00:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245077AbiBKAdJ (ORCPT ); Thu, 10 Feb 2022 19:33:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346366AbiBKAdI (ORCPT ); Thu, 10 Feb 2022 19:33:08 -0500 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C268E5F7E for ; Thu, 10 Feb 2022 16:33:08 -0800 (PST) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 5FD042C05DB; Fri, 11 Feb 2022 00:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1644539583; bh=5d4aGdtzzJ4A4TyeCtQK+SET2xSB90uuC2RRaOEyQt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RH389wkBdkpSyWrIjzryc+KM9SHlXGakVdFyCSlCXBc6Fz3pl0lVa7ZK5TZogAUge wasWUuu2FobTFhDpGivi7cHIk+ZXmVz9NbBmo8nUgc96KOE0axptAuFkaTfKnK1ojr f8ZPMLqeHQNf4unsOWA9boYQeydnxIfxcW2XzvQ8EY6ObouMuvWA3olSvQUbjwkbPm vfiH4Wy+A9HvKOy+UIfafb2RxvvhKEr4BHla81n4OGT97bRmvfDkkcPJvIyJimu6wd Ab98EEnNW/g5QiN+ZUPkv+swHF+fJjcV5+pZGeTnKyGDeEH/vNGsnoJHNuFWJeDrfr FGmEe//CD+7qw== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Fri, 11 Feb 2022 13:33:04 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 3927013ECE9; Fri, 11 Feb 2022 13:33:03 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 1FC2A2A00D0; Fri, 11 Feb 2022 13:32:59 +1300 (NZDT) From: Chris Packham To: andrew@lunn.ch, gregory.clement@bootlin.com, robh+dt@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Chris Packham , Sebastian Hesselbarth Subject: [PATCH 1/2] ARM: dts: armada-xp: add interrupts for watchdog Date: Fri, 11 Feb 2022 13:32:56 +1300 Message-Id: <20220211003257.2037332-2-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220211003257.2037332-1-chris.packham@alliedtelesis.co.nz> References: <20220211003257.2037332-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 X-SEG-SpamProfiler-Analysis: v=2.3 cv=c43Vvi1l c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=oGFeUVbbRNcA:10 a=pDUyuL2EwPZigLCUKl4A:9 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org The first interrupt is for the regular watchdog timeout. Normally the RSTOUT line will trigger a reset before this interrupt fires but on systems with a non-standard reset it may still trigger. The second interrupt is for a timer1 which is used as a pre-timeout for the watchdog. Signed-off-by: Chris Packham Acked-by: Gregory CLEMENT Acked-by: Guenter Roeck --- arch/arm/boot/dts/armada-xp-98dx3236.dtsi | 1 + arch/arm/boot/dts/armada-xp.dtsi | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi index 38a052a0312d..0e561dfc0ca9 100644 --- a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi +++ b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi @@ -286,6 +286,7 @@ &watchdog { compatible = "marvell,armada-xp-wdt"; clocks = <&coreclk 2>, <&refclk>; clock-names = "nbclk", "fixed"; + interrupts = <93>, <38>; }; &cpurst { diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi index 6c19984d668e..4297482da62f 100644 --- a/arch/arm/boot/dts/armada-xp.dtsi +++ b/arch/arm/boot/dts/armada-xp.dtsi @@ -260,6 +260,7 @@ &watchdog { compatible = "marvell,armada-xp-wdt"; clocks = <&coreclk 2>, <&refclk>; clock-names = "nbclk", "fixed"; + interrupts = <93>, <38>; }; &cpurst { From patchwork Fri Feb 11 00:32:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 12742622 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 8BE4FC433FE for ; Fri, 11 Feb 2022 00:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346373AbiBKAdI (ORCPT ); Thu, 10 Feb 2022 19:33:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242533AbiBKAdI (ORCPT ); Thu, 10 Feb 2022 19:33:08 -0500 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EFE95F72 for ; Thu, 10 Feb 2022 16:33:07 -0800 (PST) Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 6D7EA2C0CC1; Fri, 11 Feb 2022 00:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1644539583; bh=9AoyTmrNG1bFwKaC2bK2uvY6+BloeSm9RcgQuQxez3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDGb+BFivrnojGAWg0yNCMSdEnlKISaDpNh+PYVOAqUfECfOOaZhzztZHfE/H2aVd JV1pGxUJfkgmz7D1emSfd7twrvOHK1Zrv5RDE/0VOMj8NDS2K7FRrTmtWpLO35Av7A YZBo/AT9aa2Bb4BPNEDyxw1d9pViKLH+CAN6YYTYC4XqWRmayXzfcIBVn6agrq/jAR waIGxcKRe1nEBwvalO5tTCKKkfvTCNyMf/RZYXg5WF6ssitusfr7in0zEJIpR1m874 YvNxcpdXPba3XuKUUShQ9KGHNEYf1F9+UryqYMQx1fbb+IYl6HlOn/JyNKoJM8u8PY 45shPTpJjFepw== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Fri, 11 Feb 2022 13:33:04 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 54F5F13ECE9; Fri, 11 Feb 2022 13:33:03 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 3BAE82A00D0; Fri, 11 Feb 2022 13:32:59 +1300 (NZDT) From: Chris Packham To: andrew@lunn.ch, gregory.clement@bootlin.com, robh+dt@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Chris Packham Subject: [PATCH 2/2] watchdog: orion_wdt: support pretimeout on Armada-XP Date: Fri, 11 Feb 2022 13:32:57 +1300 Message-Id: <20220211003257.2037332-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220211003257.2037332-1-chris.packham@alliedtelesis.co.nz> References: <20220211003257.2037332-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 X-SEG-SpamProfiler-Analysis: v=2.3 cv=c43Vvi1l c=1 sm=1 tr=0 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=oGFeUVbbRNcA:10 a=Moq0AktbSBU1Ap_EwrUA:9 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Commit e07a4c79ca75 ("watchdog: orion_wdt: use timer1 as a pretimeout") added support for a pretimeout on Armada-38x variants. Because the Armada-XP variants use armada370_start/armada370_stop (due to missing an explicit RSTOUT mask bit for the watchdog). Add the required pretimeout support to armada370_start/armada370_stop for Armada-XP. Signed-off-by: Chris Packham Reviewed-by: Gregory CLEMENT Reviewed-by: Guenter Roeck --- drivers/watchdog/orion_wdt.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 127eefc9161d..e25e6bf4647f 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c @@ -238,8 +238,10 @@ static int armada370_start(struct watchdog_device *wdt_dev) atomic_io_modify(dev->reg + TIMER_A370_STATUS, WDT_A370_EXPIRED, 0); /* Enable watchdog timer */ - atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, - dev->data->wdt_enable_bit); + reg = dev->data->wdt_enable_bit; + if (dev->wdt.info->options & WDIOF_PRETIMEOUT) + reg |= TIMER1_ENABLE_BIT; + atomic_io_modify(dev->reg + TIMER_CTRL, reg, reg); /* Enable reset on watchdog */ reg = readl(dev->rstout); @@ -312,7 +314,7 @@ static int armada375_stop(struct watchdog_device *wdt_dev) static int armada370_stop(struct watchdog_device *wdt_dev) { struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); - u32 reg; + u32 reg, mask; /* Disable reset on watchdog */ reg = readl(dev->rstout); @@ -320,7 +322,10 @@ static int armada370_stop(struct watchdog_device *wdt_dev) writel(reg, dev->rstout); /* Disable watchdog timer */ - atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0); + mask = dev->data->wdt_enable_bit; + if (wdt_dev->info->options & WDIOF_PRETIMEOUT) + mask |= TIMER1_ENABLE_BIT; + atomic_io_modify(dev->reg + TIMER_CTRL, mask, 0); return 0; }