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: 13978861 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49F3718E1F; Tue, 18 Feb 2025 03:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739848661; cv=none; b=Mb9UJIUtFxNzhj0Hue3FDYKvmuG+M55wU2dSQ/FuCJPTTts15KetBpv9/00nE8X5k55+pMIKX/VNgIRpxouE/ebYOsBECfqDeZGOFSSssic6VWxOhmhD3k+exaURX/iac+/70tv6jHe8mVvnXTpkNb9NGlOdl9gR6xBJ5goxW3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739848661; c=relaxed/simple; bh=hwMyPVaKVUhw8vJpzPoyTFJEveI+dSwGCqu8FTtJ6dQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZFlQTXTXdnu5ygESgEtVLvmVDMAMK5DF1ViuFd5lBLPIy/Kyc+sJXElC1RKGQ1Lq8tOAloEWdjaoC4UbCjHOIheCmXfc84bYQ8zzzMwG8wC5cMM7Jp2PFA2JMpG7UlLlB3DOZ8USP5uUhdT0507nr1A7YzXlljHuy3IvwDwOHoc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=YdKWLbyu; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="YdKWLbyu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739848649; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=f3CbPlmh3sHKCr4h2q4NBJY7IFm6y5tBiOCFjrBwvTs=; b=YdKWLbyuUwjOpMaZwsJ1QD4uC/ZUalVdV5xj/aAju4EZ3dfAR5iE1gPsj9NaUBJ1bqUN6gEw5zLRzr0awhmeE+FQZ4bpAKlrlUBmDwb+HnWWM6E37wbWFDsO5jrqnwHhxkqBp3mQs7k0cGnaOnCmnrqETpOK/xWW21hKyXcmS8Q= 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 Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13978862 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B260A155753; Tue, 18 Feb 2025 03:17:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739848676; cv=none; b=TplOHRXiOlabiJOmo8F4m+i5kBXW7q7HbX5F1rNztYLJxt5h7Xcu5S+yuMckXMdJW18bJK73dooOrHsdutLi2HoAOvU4ozXhNn7d7u00ZWiwOVoHQmOIFqkgZ3fw6US9OOYt2bqHXr6WsDzIHDGrmrLkTmuDFfX1UjszrzBJHcQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739848676; c=relaxed/simple; bh=i0mcyA/psOENHr4FwscNmeu4Dzf11VVAzwN3AbAihK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YOO/gIaaQBaQ5NnetElFNeS0ODVnoyyDGaEDG2GvCn9rhzMZikGilZ3v0qFpiGrhFDmJ3D6Kh/lyWXrQTQ8VghHA2CMktwwK66xj4iJxCzUlhEFh0IWR9E12qtJFZTSbPymDG+iyU8s/pT4ucPuC+B9ylbejvPzx7Cpv09L1NJc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=mPNYOxDI; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="mPNYOxDI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739848670; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=qcI8nIfaXpTXXB2w65+9gPwAA9jaOdswF4r0vXF6+pw=; b=mPNYOxDIJrukUsRl/ewnCfuJ85DAp9aUL9HhYMZLOpEPvmX4Pnwl8efBZTaWTLYV/zdKxwCJk3VKJ1a4wEKWJKJhnTie/gu/qrqJlYmqSpW/uSTrJ6wxcQcJAT1Jgi1VziI4Xjlxo6s7prxvuNpoTDH70CZph23MP+NdoJrf9Gk= 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> Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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"; };