From patchwork Tue Mar 5 20:19:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 10840105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B35E5922 for ; Tue, 5 Mar 2019 20:20:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A6392CACB for ; Tue, 5 Mar 2019 20:20:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AD032CBE7; Tue, 5 Mar 2019 20:20:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FEA62CACB for ; Tue, 5 Mar 2019 20:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s0iSnaG8AdOK73Chsj5QNRDnAXeqvlQP2EsIrdjf4Z0=; b=shW70cdiG3+/jv kkrp34zhNDwrVda8Jy+GwMnpZQS6MnWefFhiNbZtqbjROg06tlvb7GnGV59QvjCCygY9GTSTULGj7 LaaM4mxHP6T70GKxTmCKxMTAVwhjv5/0P2hUhbyAHhodiC+5Fj9CsT+VtJhJiwd+mlPv4sE1Gh9wI 6ihit7R9pqQ24/T2leLGC5LP4b2NvjpAYfJkpsHBTXb826d6ENLXORWsuj4JUOWxywcmgpTVgNUTj Cjj0pD2hKWanWarCA19Osz3XoTsjMVnbKiVCj2A5DWFb8TFD/H7cEJMVP89BGd1oXHNTEt/n6Ixcv 0ltPBM1DlSKaMyOd7HIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1GXh-00050F-9s; Tue, 05 Mar 2019 20:20:01 +0000 Received: from gate2.alliedtelesis.co.nz ([2001:df5:b000:5::4]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1GXV-0004q9-Gt for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 20:19:51 +0000 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id B5565891A9; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1551817172; bh=JDIzi7JyFss5+0sxv120uPEvr4G7fdX0unzBAlMeHSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lGADcDwHJq1b9UGfZ1wUtcqIFziyxivOoFje/R4clupF4N4M4DPlzn2Z2B1KxjtPF Lnj0F+ouer79csxuF/pM1mbKmX2F6UNPSXrROHKSHf3dHtnJy8xazhdAvuArLkDY6D n7iZ7NdYBPiZjQcN7KDzsdmYsg9x0zBTGXxV5xzXzMSOcuJfsI6xig0VAIKVdAJZ6S PBmh4qF0kd74k/o+MCpq2b9NFDIMdIEmMXxhfI4i4LDbAV3YjNuznO1xILmHqW5FGs vwkA/JdPzStEHXR/9WKoCfyyxlJH4yOlUysnFlGYgDDx6ozI7H2lgxBBnz01/+bMI5 MHCbO7ejUZsHA== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Wed, 06 Mar 2019 09:19:32 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id B6B4B13EF3B; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 803AC1E1D96; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) From: Chris Packham To: jason@lakedaemon.net, andrew@lunn.ch, gregory.clement@bootlin.com, linux@roeck-us.net Subject: [PATCH v2 1/3] ARM: dts: armada-38x: add interrupts for watchdog Date: Wed, 6 Mar 2019 09:19:22 +1300 Message-Id: <20190305201924.14853-2-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190305201924.14853-1-chris.packham@alliedtelesis.co.nz> References: <20190305201924.14853-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_121949_753834_5E113EAD X-CRM114-Status: GOOD ( 10.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Chris Packham , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Changes in v2: - new, split out from "watchdog: orion_wdt: use timer1 as a pretimeout" arch/arm/boot/dts/armada-38x.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index 929459c42760..fc550c640ca8 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi @@ -376,6 +376,8 @@ reg = <0x20300 0x34>, <0x20704 0x4>, <0x18260 0x4>; clocks = <&coreclk 2>, <&refclk>; clock-names = "nbclk", "fixed"; + interrupts-extended = <&gic GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; }; cpurst: cpurst@20800 { From patchwork Tue Mar 5 20:19:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 10840103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF0C21669 for ; Tue, 5 Mar 2019 20:20:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69D752863F for ; Tue, 5 Mar 2019 20:20:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59B202CACF; Tue, 5 Mar 2019 20:20:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 80B1328E86 for ; Tue, 5 Mar 2019 20:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ufn+ncFBudpK5/auxME2CdWKd2+2KHXjH3WgOpVrTDo=; b=sOyGjdr+x54qfy sMtJ5RS8Pk8X0Lyy4e9HegN4BrpfP+YeWLu7IfIYA6SYOeArY5/VqRpiEmGua+FWFIisrRANvHXd1 dP4hcDMh+ms8KjVvf+kDiOWliPaw6UzvfRp0kcRAZprTwWmq0ji2u1h3wxSou3nUrtql1eQXyF1Ob G5uH/3ySX2BxS11x5QpiCVBcY1J+IdX5PvpwcrZ1EkjaSvVUQTTaC4h3GeUKym8WJzQx02mQMdP38 0eseewgazWtABpBVePFf7mHbVXJ4RRe9wZ2NQS7TS3Y4Nqdwim+WoQ4t8yQooVSssp1sNUvlBrARS ephbQJLJGFIPT5AQngeg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1GXY-0004rV-MZ; Tue, 05 Mar 2019 20:19:52 +0000 Received: from gate2.alliedtelesis.co.nz ([2001:df5:b000:5::4]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1GXV-0004q8-Gu for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 20:19:51 +0000 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id C97A9891AA; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1551817172; bh=7BaeZd54UA75pFPzRyMdWlNw1ciq4AymcW/Yk7re/Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wDbN53zh+RBYGa11sreZjALrSY4S0wtf35/DvBv8LpjVsaSMHBGU3qH25ciYWwt72 D2cRiBLXVJGSXMf0u/19sJnGHCpoO3goX+wAImStrO0s06E2MkX9zjceKjAIqX6yk6 7SB1LywwuRVTSJF2lxBN4I3/vWDXWpsmLA1GDvpuMc3tlLxr2cAn9xC+lpxvRLb2Gz OIWzJcdayHFZJmXc7B0Tw73ssIv4kFB585SeSvbRRx8OVIqP/9ixyPZJmXjYPCKPRt 2S/PkyFOWfMrFkqTZl78BNzy8oAHSlXg1Kv5loavU2sp+p1rQyRgotcYiC3qr6P6Z0 9oXgC8yk53cMw== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Wed, 06 Mar 2019 09:19:32 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id D16B513EF3B; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 9C7F71E1D96; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) From: Chris Packham To: jason@lakedaemon.net, andrew@lunn.ch, gregory.clement@bootlin.com, linux@roeck-us.net Subject: [PATCH v2 2/3] watchdog: orion: remove orion_wdt_set_timeout Date: Wed, 6 Mar 2019 09:19:23 +1300 Message-Id: <20190305201924.14853-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190305201924.14853-1-chris.packham@alliedtelesis.co.nz> References: <20190305201924.14853-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_121949_753818_DF216FB2 X-CRM114-Status: GOOD ( 10.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham , Wim Van Sebroeck , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The watchdog core will do the same thing if no set_timeout is supplied so we can safely remove orion_wdt_set_timeout. Signed-off-by: Chris Packham Reviewed-by: Guenter Roeck --- Changes in v2: - Add Guenter's review drivers/watchdog/orion_wdt.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 9db3b09f7568..8b259c712c52 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c @@ -349,13 +349,6 @@ static unsigned int orion_wdt_get_timeleft(struct watchdog_device *wdt_dev) return readl(dev->reg + dev->data->wdt_counter_offset) / dev->clk_rate; } -static int orion_wdt_set_timeout(struct watchdog_device *wdt_dev, - unsigned int timeout) -{ - wdt_dev->timeout = timeout; - return 0; -} - static const struct watchdog_info orion_wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .identity = "Orion Watchdog", @@ -366,7 +359,6 @@ static const struct watchdog_ops orion_wdt_ops = { .start = orion_wdt_start, .stop = orion_wdt_stop, .ping = orion_wdt_ping, - .set_timeout = orion_wdt_set_timeout, .get_timeleft = orion_wdt_get_timeleft, }; From patchwork Tue Mar 5 20:19:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 10840109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 828771669 for ; Tue, 5 Mar 2019 20:20:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C9492CC68 for ; Tue, 5 Mar 2019 20:20:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AA4C2CCF1; Tue, 5 Mar 2019 20:20:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 016242CC68 for ; Tue, 5 Mar 2019 20:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gJOmvHWrvjL8Rm/+9gPkIjQ7Qo/CWZxb59E/JnE9VC8=; b=Jm3qciNYbynQlt jF1UETa1eOodDInksrURSUIwNZmzVCn1baVc0cdlpSR5TjlGHLEMfj07jQmlADmyvt9xps+Elco82 rmCObIJQfaRFRATA48Z6l9OUsnaZzR/2sNEh02uqWuR1fe58mM4D3IA90RuwCe9e0wDOHnJ4dgQmF c5509V9zcinrOMCFFOPfwtdkg7jB7Ctreo2rLyQz33aVBEADBelZayrCWHVtMjOz60BakPZwDe5Ft zGDQ7866GuO/xfO3VmrXVQMyzDe6huxPqlzaI9X6bbmLx0hpA31Y6kw9uwS5CTHFN7qGqXmCijwT5 Xmart/qzRmPtShopBmyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1GY9-0006n5-Dg; Tue, 05 Mar 2019 20:20:29 +0000 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1GXV-0004qB-Gv for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 20:19:53 +0000 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 5B3DB891AB; Wed, 6 Mar 2019 09:19:33 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1551817173; bh=0rWeG64ablQ4QcEeytKY5EW2azDS057EZOZDEMjLjMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OTZlIbAphES+CRqp2zeMn66Prvk85OM3q/xqgqoPYVk3ovmvjMuM64O23d4TgkfA6 3Q0WaCwyG1H9RhgMugdWgtAzV8d6TgFiazfTG5hR+ou+7nGArXVoGtRvS3MaJcknPU WQsiG/zjsbEo65NuwNcgwhNC6ZIr9csz4KXc4AhqStZ16vNb6cfr9kSRccGVKfB5ZI P4uMSUWLolrkMRHfMI8YOiy09WDyUP3E7SC8BVGzIYOz4sdp3aTnbc3c+hR95WsKnm jczqydAwRLr+FddC4ghcy1bW0DQPsojtBoGrQUdUoT4SFn7Jm3jK9EkaX3CtOIoKxo RAREuRSRs98IQ== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Wed, 06 Mar 2019 09:19:33 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id F17DF13EF3B; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id BC6B61E1D96; Wed, 6 Mar 2019 09:19:32 +1300 (NZDT) From: Chris Packham To: jason@lakedaemon.net, andrew@lunn.ch, gregory.clement@bootlin.com, linux@roeck-us.net Subject: [PATCH v2 3/3] watchdog: orion_wdt: use timer1 as a pretimeout Date: Wed, 6 Mar 2019 09:19:24 +1300 Message-Id: <20190305201924.14853-4-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190305201924.14853-1-chris.packham@alliedtelesis.co.nz> References: <20190305201924.14853-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_121950_061027_AAB57DC7 X-CRM114-Status: GOOD ( 18.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham , Wim Van Sebroeck , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The orion watchdog can either reset the CPU or generate an interrupt. The interrupt would be useful for debugging as it provides panic() output about the watchdog expiry, however if the interrupt is used the watchdog can't reset the CPU in the event of being stuck in a loop with interrupts disabled or if the CPU is prevented from accessing memory (e.g. an unterminated DMA). The Armada SoCs have spare timers that aren't currently used by the Linux kernel. We can use timer1 to provide a pre-timeout ahead of the watchdog timer and provide the possibility of gathering debug before the reset triggers. Signed-off-by: Chris Packham --- Changes in v2: - apply changes to armada-38x only - use watchdog_notify_pretimeout() as suggested by Andrew and Guenter drivers/watchdog/orion_wdt.c | 59 ++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 8b259c712c52..aa295f37e563 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c @@ -46,6 +46,11 @@ #define WDT_AXP_FIXED_ENABLE_BIT BIT(10) #define WDT_A370_EXPIRED BIT(31) +#define TIMER1_VAL_OFF 0x001c +#define TIMER1_ENABLE_BIT BIT(2) +#define TIMER1_FIXED_ENABLE_BIT BIT(12) +#define TIMER1_STATUS_BIT BIT(8) + static bool nowayout = WATCHDOG_NOWAYOUT; static int heartbeat = -1; /* module parameter (seconds) */ @@ -158,6 +163,7 @@ static int armadaxp_wdt_clock_init(struct platform_device *pdev, struct orion_watchdog *dev) { int ret; + u32 val; dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed"); if (IS_ERR(dev->clk)) @@ -169,38 +175,48 @@ static int armadaxp_wdt_clock_init(struct platform_device *pdev, } /* Enable the fixed watchdog clock input */ - atomic_io_modify(dev->reg + TIMER_CTRL, - WDT_AXP_FIXED_ENABLE_BIT, - WDT_AXP_FIXED_ENABLE_BIT); + val = WDT_AXP_FIXED_ENABLE_BIT | TIMER1_FIXED_ENABLE_BIT; + atomic_io_modify(dev->reg + TIMER_CTRL, val, val); dev->clk_rate = clk_get_rate(dev->clk); + return 0; } static int orion_wdt_ping(struct watchdog_device *wdt_dev) { struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); + /* Reload watchdog duration */ writel(dev->clk_rate * wdt_dev->timeout, dev->reg + dev->data->wdt_counter_offset); + if (dev->wdt.info->options & WDIOF_PRETIMEOUT) + writel(dev->clk_rate * (wdt_dev->timeout - wdt_dev->pretimeout), + dev->reg + TIMER1_VAL_OFF); + return 0; } static int armada375_start(struct watchdog_device *wdt_dev) { struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); - u32 reg; + u32 reg, val; /* Set watchdog duration */ writel(dev->clk_rate * wdt_dev->timeout, dev->reg + dev->data->wdt_counter_offset); + if (dev->wdt.info->options & WDIOF_PRETIMEOUT) + writel(dev->clk_rate * (wdt_dev->timeout - wdt_dev->pretimeout), + dev->reg + TIMER1_VAL_OFF); /* Clear the watchdog expiration bit */ 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); + val = dev->data->wdt_enable_bit; + if (dev->wdt.info->options & WDIOF_PRETIMEOUT) + val |= TIMER1_ENABLE_BIT; + atomic_io_modify(dev->reg + TIMER_CTRL, val, val); /* Enable reset on watchdog */ reg = readl(dev->rstout); @@ -277,7 +293,7 @@ static int orion_stop(struct watchdog_device *wdt_dev) static int armada375_stop(struct watchdog_device *wdt_dev) { struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); - u32 reg; + u32 reg, mask; /* Disable reset on watchdog */ atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit, @@ -287,7 +303,10 @@ static int armada375_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; } @@ -349,7 +368,7 @@ static unsigned int orion_wdt_get_timeleft(struct watchdog_device *wdt_dev) return readl(dev->reg + dev->data->wdt_counter_offset) / dev->clk_rate; } -static const struct watchdog_info orion_wdt_info = { +static struct watchdog_info orion_wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .identity = "Orion Watchdog", }; @@ -368,6 +387,16 @@ static irqreturn_t orion_wdt_irq(int irq, void *devid) return IRQ_HANDLED; } +static irqreturn_t orion_wdt_pre_irq(int irq, void *devid) +{ + struct orion_watchdog *dev = devid; + + atomic_io_modify(dev->reg + TIMER_A370_STATUS, + TIMER1_STATUS_BIT, 0); + watchdog_notify_pretimeout(&dev->wdt); + return IRQ_HANDLED; +} + /* * The original devicetree binding for this driver specified only * one memory resource, so in order to keep DT backwards compatibility @@ -591,6 +620,18 @@ static int orion_wdt_probe(struct platform_device *pdev) } } + irq = platform_get_irq(pdev, 1); + if (irq > 0) { + orion_wdt_info.options |= WDIOF_PRETIMEOUT; + ret = devm_request_irq(&pdev->dev, irq, orion_wdt_pre_irq, + 0, pdev->name, dev); + if (ret < 0) { + dev_err(&pdev->dev, "failed to request IRQ\n"); + goto disable_clk; + } + } + + watchdog_set_nowayout(&dev->wdt, nowayout); ret = watchdog_register_device(&dev->wdt); if (ret)