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; }