From patchwork Tue Feb 18 03:16:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heyi Guo X-Patchwork-Id: 13978863 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BC59C021A9 for ; Tue, 18 Feb 2025 03:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=f3CbPlmh3sHKCr4h2q4NBJY7IFm6y5tBiOCFjrBwvTs=; b=ylW6KjSJwPDwkSLQJCPfcas33Q rNOWXMT6z0Hhy2c0e4YBGZApvBSX4PKmwDlsz9Q3vTmz9mXrdK0nlwBb51JJhcMt/Yn2FP7f/Ss6K PNqlffbJn0vpnCiSH8XdI3AIO5lyRhX9yuA7ZDnqjWCE1VZ9bOikMPMESMXZhcIYHOY5EfyCxet9v iO0spuqYo1JIE5ydmXGWaniTCY6k31PUSHnxpCKe/OpOXEGjfJRn8EMMWpFJt36OHinph2Db7w28C Q8VBYHtBfQ6eSzWvI4+QNumt3dLeYuh9WZcJN5jP7KUVgLtDUgdBFs6REJlDzoEUYAj4f782+7/P2 w6M5015Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tkE8c-00000006bY0-3RKl; Tue, 18 Feb 2025 03:19:10 +0000 Received: from out30-100.freemail.mail.aliyun.com ([115.124.30.100]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tkE78-00000006bN3-3D98 for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2025 03:17:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739848652; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=f3CbPlmh3sHKCr4h2q4NBJY7IFm6y5tBiOCFjrBwvTs=; b=bSafPr+m0l3rw1RgKz8aasL+jcOHBSpTP/x9eGO9izMQYOIAC39Fh4dPKZoMYMnaItkTcOCWC8ai6PBDq387+HIM4nEdNpryUjV/JNPZ9FHmbqY7ZaCFaGxGJmeI3ObVCbz5piHErrGZ8XugPNbI5MrL93OF26TzXOaXkDXZ8yM= Received: from 03382176d5c3.tbsite.net(mailfrom:guoheyi@linux.alibaba.com fp:SMTPD_---0WPk8NtB_1739848638 cluster:ay36) by smtp.aliyun-inc.com; Tue, 18 Feb 2025 11:17:28 +0800 From: Heyi Guo To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: Heyi Guo , Wim Van Sebroeck , Guenter Roeck , Joel Stanley , Andrew Jeffery , Eddie James Subject: [PATCH 1/2] driver/aspeed-wdt: fix pretimeout for counting down logic Date: Tue, 18 Feb 2025 11:16:58 +0800 Message-ID: <20250218031709.103823-1-guoheyi@linux.alibaba.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250217_191739_493583_CE451CFF X-CRM114-Status: UNSURE ( 8.01 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Aspeed watchdog uses counting down logic, so the value set to register should be the value of subtracting pretimeout from total timeout. Fixes: 9ec0b7e06835 ("watchdog: aspeed: Enable pre-timeout interrupt") Signed-off-by: Heyi Guo Cc: Wim Van Sebroeck Cc: Guenter Roeck Cc: Joel Stanley Cc: Andrew Jeffery Cc: Eddie James --- drivers/watchdog/aspeed_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c index b4773a6aaf8c..520d8aba12a5 100644 --- a/drivers/watchdog/aspeed_wdt.c +++ b/drivers/watchdog/aspeed_wdt.c @@ -187,6 +187,13 @@ static int aspeed_wdt_set_pretimeout(struct watchdog_device *wdd, u32 actual = pretimeout * WDT_RATE_1MHZ; u32 s = wdt->cfg->irq_shift; u32 m = wdt->cfg->irq_mask; + u32 reload = readl(wdt->base + WDT_RELOAD_VALUE); + + if (actual >= reload) + return -EINVAL; + + /* watchdog timer is counting down */ + actual = reload - actual; wdd->pretimeout = pretimeout; wdt->ctrl &= ~m; From patchwork Tue Feb 18 03:16:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heyi Guo X-Patchwork-Id: 13978864 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03CA8C021A9 for ; Tue, 18 Feb 2025 03:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qcI8nIfaXpTXXB2w65+9gPwAA9jaOdswF4r0vXF6+pw=; b=AZ30NcNkiVrJpco0ihnjpFyA3u QBey7tKV0fIeVOfRtvCiduBw8cHYnj8vd6Z9blsv8/kkAR/2GSkk1H4q9/bnhdP+7+P03//oI0o0/ Dwc+9pBDVkkoVdVKetZ53SZYX0AfJg6qamGhszZQBkop9myB2rCF+luSKUnJAz5cw+Zv3YjbUVMY9 Der7yBaH3qybiRpUCfZBd2OSnedp5W9RnOWjgBo+5Hfra3BdfpyNjvGkBxRmmD19lROAcG3PzTd7y yHhhNtqBptuLMldb/jlQjBpGKRvURX0ND/yMSqYV2g9n56S7lvqsHQighaf4mAFcUB2DK3fh4DEnt VmYPKJJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tkEA3-00000006bhe-1uvo; Tue, 18 Feb 2025 03:20:39 +0000 Received: from out30-119.freemail.mail.aliyun.com ([115.124.30.119]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tkE7Q-00000006bQ2-2ET9 for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2025 03:17:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739848673; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=qcI8nIfaXpTXXB2w65+9gPwAA9jaOdswF4r0vXF6+pw=; b=i9CuaCzAaGuRlCrWPH4LveMk8s0UM+UGmr7862kUD++8mUSHih0G+Fz4aaTZF0ovxvTn69n8vm+OAJqbetIHwLCs5/WjBdvtctWabzan2Qlqsj6t1WSed+fmPSmXObFPY4rghlbQNOF9s91F1iKX3qFflxTwenZQKhhyVF8tZzE= Received: from 03382176d5c3.tbsite.net(mailfrom:guoheyi@linux.alibaba.com fp:SMTPD_---0WPk8Nyz_1739848648 cluster:ay36) by smtp.aliyun-inc.com; Tue, 18 Feb 2025 11:17:49 +0800 From: Heyi Guo To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org Cc: Heyi Guo , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Joel Stanley , Andrew Jeffery Subject: [PATCH 2/2] ARM: dts: aspeed: aspeed-g6.dtsi: enable IRQ for watchdogs Date: Tue, 18 Feb 2025 11:16:59 +0800 Message-ID: <20250218031709.103823-2-guoheyi@linux.alibaba.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250218031709.103823-1-guoheyi@linux.alibaba.com> References: <20250218031709.103823-1-guoheyi@linux.alibaba.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250217_191756_744072_5CDC7E90 X-CRM114-Status: UNSURE ( 6.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To finally enable watchdog pretimeout function. Signed-off-by: Heyi Guo Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Joel Stanley Cc: Andrew Jeffery --- arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi index 8ed715bd53aa..ef7ced285c44 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi @@ -538,23 +538,27 @@ uart5: serial@1e784000 { wdt1: watchdog@1e785000 { compatible = "aspeed,ast2600-wdt"; reg = <0x1e785000 0x40>; + interrupts = ; }; wdt2: watchdog@1e785040 { compatible = "aspeed,ast2600-wdt"; reg = <0x1e785040 0x40>; + interrupts = ; status = "disabled"; }; wdt3: watchdog@1e785080 { compatible = "aspeed,ast2600-wdt"; reg = <0x1e785080 0x40>; + interrupts = ; status = "disabled"; }; wdt4: watchdog@1e7850c0 { compatible = "aspeed,ast2600-wdt"; reg = <0x1e7850C0 0x40>; + interrupts = ; status = "disabled"; };