From nobody Mon Oct 6 06:47:31 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 B1078274FC8 for ; Thu, 24 Jul 2025 08:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344823; cv=none; b=Tmg1QaD89u4BYyThPGp1n+USgZXLzV0N+HFvQdAuDchynuzWIKjUka4kz67wXn2V1PspUqh3HLLQFoZFRFOju6fDaSJPCis0BR4ce1aLIJIL8xbxo8kEQiZAVXoo/YOFbJgmsZlD/sSIjfGSsw91pvysBMPgZGkH0UAplRK40qM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344823; c=relaxed/simple; bh=l1zppUoGsgYQuvWfeE9ZII+mvExfI8uZ5tf9ENz9M9I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=Eu9YoK0cujdZ9Z9Lz1tnpgNR4CLG/sF4BGfH8VT+SwavFoW4jIlNmOgzYJAs3hiYsrU1JQAOmzwgkM9nCGNkYLb2VAAMlRQM1YwCTE4r9WwftlnECuGI3GkGWKBT/J/84owFwYtG3/rmo0m3wt1fIJLCuHBCSxOfZtkPcCzuOi0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=AXm13xJe; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="AXm13xJe" Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250724081339epoutp0204d56fadb3bebeecb7d0b1be98552ce1~VIdLHfNRB0996009960epoutp02u for ; Thu, 24 Jul 2025 08:13:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250724081339epoutp0204d56fadb3bebeecb7d0b1be98552ce1~VIdLHfNRB0996009960epoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1753344819; bh=iF7XGLKPcudkWLwpYz/z12ZVFINWFvDEkKGpP/Zh/5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXm13xJeTCW/AiCRFHqspPSGPJO+CCfEUCo8UX/K8dEy1wuTnM0v4YDZhW6GTiU8Y 0gXBlCxq2Zt6ZJwrxp1TZpZqqb2oZ8IoqfZ+wPS1hs1NdQCIBOvYHzaRtxyze2B1wN GEN0azR/OXydwJt/PIntC0jc3KTAww4fHyYFN0U0= Received: from epsnrtp02.localdomain (unknown [182.195.42.154]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPS id 20250724081338epcas2p1c5b87ad2c7f81672871aa73c3c54b2b9~VIdKS6ZcI2457124571epcas2p1V; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) Received: from epcas2p4.samsung.com (unknown [182.195.36.92]) by epsnrtp02.localdomain (Postfix) with ESMTP id 4bnkKY41TSz2SSKX; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epcas2p31c2e3cbed1d3a7bf30a9fb664e6cb92b~VIdJDvoPV0904009040epcas2p3O; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) Received: from localhost.localdomain (unknown [10.229.9.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epsmtip1409ff895c9cab7adc3f5a208f246cd16~VIdI95Fg-2042020420epsmtip1S; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) From: Sangwook Shin To: krzk@kernel.org, alim.akhtar@samsung.com, wim@linux-watchdog.org, linux@roeck-us.net, semen.protsenko@linaro.org, khwan.seo@samsung.com, dongil01.park@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Sangwook Shin Subject: [PATCH v4 1/4] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions Date: Thu, 24 Jul 2025 17:08:51 +0900 Message-Id: <20250724080854.3866566-2-sw617.shin@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250724080854.3866566-1-sw617.shin@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250724081336epcas2p31c2e3cbed1d3a7bf30a9fb664e6cb92b X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P cpgsPolicy: CPGSC10-234,N X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250724081336epcas2p31c2e3cbed1d3a7bf30a9fb664e6cb92b References: <20250724080854.3866566-1-sw617.shin@samsung.com> Modify the code to utilize macro-defined values instead of hardcoded values. The value 0x100 in the s3c2410wdt_set_heartbeat function represents S3C2410_WTCON_PRESCALE_MAX + 1, but it is hardcoded, making its meaning difficult to understand and reducing code readability. Reviewed-by: Sam Protsenko Reviewed-by: Alim Akhtar Signed-off-by: Sangwook Shin --- drivers/watchdog/s3c2410_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 40901bdac426..95f7207e390a 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -587,7 +587,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_dev= ice *wdd, if (count >=3D 0x10000) { divisor =3D DIV_ROUND_UP(count, 0xffff); =20 - if (divisor > 0x100) { + if (divisor > S3C2410_WTCON_PRESCALE_MAX + 1) { dev_err(wdt->dev, "timeout %d too big\n", timeout); return -EINVAL; } --=20 2.25.1 From nobody Mon Oct 6 06:47:31 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 74BE42749DE for ; Thu, 24 Jul 2025 08:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344822; cv=none; b=iv5EfuqsCE0s7ZirjoWwEBF8Z20Z80qzQ/Qe4nKsyoS3BgZekDLhPh2aY1dt3O8hY32pjFAujySx4X0Ks1F3AjyVCUZBYaBOQoabDh5UHrZ0sAg1rVycyHqLETX2FFoutKF7yRFdFz3fwbWOxBLW1cMgf9uUI2Z9/jZWL/qe9tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344822; c=relaxed/simple; bh=Y5pH19HmSiQddiETs6OYDLNHfOX27xGom9eX1MuqH38=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=BQxfGLCHUNf8Cq2r8f+btOjOuJzPWGfI2GEYDy1tOFDTKf3jYzOpL6MTKHFKoCRqj0714hPD2c3D8+dYqU56cLvZSRvBHgWOKcFdSjyfAuhzYlx+shq9FyJBGTHtjwvB4c7L33MyUSP+0RDC3FVJUAg2OezqsdKgn6DwZrwzKr4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=mlfnrnGL; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="mlfnrnGL" Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250724081338epoutp029daa8272d9fb0263dbcfbe81e1777556~VIdKbf62Y0996109961epoutp02g for ; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250724081338epoutp029daa8272d9fb0263dbcfbe81e1777556~VIdKbf62Y0996109961epoutp02g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1753344818; bh=Mp1uEyU7lbaGGVz3c4DfJHeeiGKIH/ejywxPc0mBmk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mlfnrnGL6sGacusIhqRCqhDaQj1vJc7jh0SJ7R2dqKYlaQGuUyLzB5s/oCgkBnPzd bq5ggpz2IZn3MMJmLIn8+ZxcxfSOY4443O7GGEVSkK6edVx+oSG311b/yStNUY3Vb7 eXNpQl3poVg10pXAFimbf/KBTob4d9ajWxRGfFpI= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPS id 20250724081338epcas2p38cd1b2986e4d286abc157f9a24c44881~VIdKGGLg20887108871epcas2p3O; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) Received: from epcas2p4.samsung.com (unknown [182.195.36.88]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4bnkKY4p1yz6B9m6; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epcas2p38e95932ddc5c702e05a6436f05582993~VIdJHibIJ1011010110epcas2p3D; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) Received: from localhost.localdomain (unknown [10.229.9.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epsmtip150ded574fc6f000f3cb609dd969de014~VIdJEWCh42170021700epsmtip1L; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) From: Sangwook Shin To: krzk@kernel.org, alim.akhtar@samsung.com, wim@linux-watchdog.org, linux@roeck-us.net, semen.protsenko@linaro.org, khwan.seo@samsung.com, dongil01.park@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Sangwook Shin Subject: [PATCH v4 2/4] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger Date: Thu, 24 Jul 2025 17:08:52 +0900 Message-Id: <20250724080854.3866566-3-sw617.shin@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250724080854.3866566-1-sw617.shin@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250724081336epcas2p38e95932ddc5c702e05a6436f05582993 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P cpgsPolicy: CPGSC10-234,N X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250724081336epcas2p38e95932ddc5c702e05a6436f05582993 References: <20250724080854.3866566-1-sw617.shin@samsung.com> Fix the issue of max_timeout being calculated larger than actual value. The calculation result of freq / (S3C2410_WTCON_PRESCALE_MAX + 1) / S3C2410_WTCON_MAXDIV is smaller than the actual value because the remainder is discarded during the calculation process. This leads to a larger calculated value for max_timeout compared to the actual settable value. A ceiling operation is applied in the calculation process to resolve this. Reviewed-by: Alim Akhtar Signed-off-by: Sangwook Shin --- drivers/watchdog/s3c2410_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 95f7207e390a..31f7e1ec779e 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -411,8 +411,8 @@ static inline unsigned int s3c2410wdt_max_timeout(struc= t s3c2410_wdt *wdt) { const unsigned long freq =3D s3c2410wdt_get_freq(wdt); =20 - return S3C2410_WTCNT_MAXCNT / (freq / (S3C2410_WTCON_PRESCALE_MAX + 1) - / S3C2410_WTCON_MAXDIV); + return S3C2410_WTCNT_MAXCNT / DIV_ROUND_UP(freq, + (S3C2410_WTCON_PRESCALE_MAX + 1) * S3C2410_WTCON_MAXDIV); } =20 static int s3c2410wdt_disable_wdt_reset(struct s3c2410_wdt *wdt, bool mask) --=20 2.25.1 From nobody Mon Oct 6 06:47:31 2025 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (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 04897274FD1 for ; Thu, 24 Jul 2025 08:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344824; cv=none; b=JEfzk2fbKenyDU6MTWqhUqebZQm7kF2/GMlPwCHCGcDMTKc9mTVv6PbMWPavkq9kK1X4uaZAlUPikcUcVf0KLlPfP6JZz4Hmlard0uhdZLC9+GHbp+DbUXz9VuYI/egIA02SVUN1nd/iXnh13PQDS9eSgTxfPDuLLiEmT2Ur55g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344824; c=relaxed/simple; bh=ZWAOaUKXYWIvDq+6G8cPvKKClMClTEQPjUFi2Q8Lf8s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=rc34HC/uu5sUVLORI90nr6QZoI/NeNOFWWWasOaqWb2npqi4PaszJJCVVRz6HfgKRyB/0AomxHQzOuo9tu4OYUNJVOZmUYLic58PjXAdNf5OuNBvoA+71HAVfI6FeVwIICvKS0CNhCy7VOZDk9yjD584aXQM0ih89ZcMWk0On1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=tjFHGU7k; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="tjFHGU7k" Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20250724081339epoutp04d314c12aec58a280a39cbaeb65ab855e~VIdLCFKp61577115771epoutp04b for ; Thu, 24 Jul 2025 08:13:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20250724081339epoutp04d314c12aec58a280a39cbaeb65ab855e~VIdLCFKp61577115771epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1753344819; bh=z8gPAdqSivNJX5FYTy2hqPX+3c1Wy7tfFAMQewiXsxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tjFHGU7ktg1oQy6J87dXI/DLF7C0QS7LKEkZdw3oNqc/D1KA5k/I0/owk3MfJ/V+T YA/lZ0LYNuBXL9qBQXEyO1RR4ilj0KToztmlh3SLXhs0NRtfXmfMytlsKojP3tgDDM biZg5/SnHa7pf6DvI9+SlS9rxvh9//SorMKJudOs= Received: from epsnrtp04.localdomain (unknown [182.195.42.156]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPS id 20250724081338epcas2p2a4d064debb2709b0a9221043a8c93464~VIdKgxGZ90806808068epcas2p2J; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) Received: from epcas2p2.samsung.com (unknown [182.195.36.92]) by epsnrtp04.localdomain (Postfix) with ESMTP id 4bnkKY5MnJz6B9m6; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20250724081337epcas2p31f594b6e9ab87e24c94f11dea4070956~VIdJOVTH-0887108871epcas2p3J; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from localhost.localdomain (unknown [10.229.9.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epsmtip1c4cf361d5b8edd7c5b43dc5ea8a301dd~VIdJIOtO12042020420epsmtip1T; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) From: Sangwook Shin To: krzk@kernel.org, alim.akhtar@samsung.com, wim@linux-watchdog.org, linux@roeck-us.net, semen.protsenko@linaro.org, khwan.seo@samsung.com, dongil01.park@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Sangwook Shin Subject: [PATCH v4 3/4] watchdog: s3c2410_wdt: Increase max timeout value of watchdog Date: Thu, 24 Jul 2025 17:08:53 +0900 Message-Id: <20250724080854.3866566-4-sw617.shin@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250724080854.3866566-1-sw617.shin@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250724081337epcas2p31f594b6e9ab87e24c94f11dea4070956 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P cpgsPolicy: CPGSC10-234,N X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250724081337epcas2p31f594b6e9ab87e24c94f11dea4070956 References: <20250724080854.3866566-1-sw617.shin@samsung.com> Increase max_timeout value from 55s to 3664647s (1017h 57min 27s) with 38400000 frequency system if the system has 32-bit WTCNT register. cat /sys/devices/platform/10060000.watchdog_cl0/watchdog/watchdog0/max_time= out 3664647 [ 0.302473] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat: count=3D109939= 4100000, timeout=3D3664647, freq=3D300000 [ 0.302479] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat: timeout=3D3664= 647, divisor=3D256, count=3D1099394100000 (fff8feac) [ 0.302510] s3c2410-wdt 10060000.watchdog_cl0: starting watchdog timer [ 0.302722] s3c2410-wdt 10060000.watchdog_cl0: watchdog active, reset en= abled, irq disabled If system has 32-bit WTCNT, add QUIRK_HAS_32BIT_MAXCNT to its quirk flags, = then it will operation with 32-bit counter. If not, with 16-bit counter like pre= vious. Reviewed-by: Alim Akhtar Signed-off-by: Sangwook Shin --- drivers/watchdog/s3c2410_wdt.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 31f7e1ec779e..184b1ad46ca6 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -34,6 +34,7 @@ #define S3C2410_WTCLRINT 0x0c =20 #define S3C2410_WTCNT_MAXCNT 0xffff +#define S3C2410_WTCNT_MAXCNT_32 0xffffffff =20 #define S3C2410_WTCON_RSTEN BIT(0) #define S3C2410_WTCON_INTEN BIT(2) @@ -123,6 +124,10 @@ * %QUIRK_HAS_DBGACK_BIT: WTCON register has DBGACK_MASK bit. Setting the * DBGACK_MASK bit disables the watchdog outputs when the SoC is in debug = mode. * Debug mode is determined by the DBGACK CPU signal. + * + * %QUIRK_HAS_32BIT_MAXCNT: WTDAT and WTCNT are 32-bit registers. With the= se + * 32-bit registers, larger values to be set, which means that larger time= outs + * value can be set. */ #define QUIRK_HAS_WTCLRINT_REG BIT(0) #define QUIRK_HAS_PMU_MASK_RESET BIT(1) @@ -130,6 +135,7 @@ #define QUIRK_HAS_PMU_AUTO_DISABLE BIT(3) #define QUIRK_HAS_PMU_CNT_EN BIT(4) #define QUIRK_HAS_DBGACK_BIT BIT(5) +#define QUIRK_HAS_32BIT_MAXCNT BIT(6) =20 /* These quirks require that we have a PMU register map */ #define QUIRKS_HAVE_PMUREG \ @@ -198,6 +204,7 @@ struct s3c2410_wdt { struct notifier_block freq_transition; const struct s3c2410_wdt_variant *drv_data; struct regmap *pmureg; + unsigned int max_cnt; }; =20 static const struct s3c2410_wdt_variant drv_data_s3c2410 =3D { @@ -349,7 +356,7 @@ static const struct s3c2410_wdt_variant drv_data_exynos= autov920_cl0 =3D { .cnt_en_bit =3D 8, .quirks =3D QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET | QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN | - QUIRK_HAS_DBGACK_BIT, + QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_32BIT_MAXCNT, }; =20 static const struct s3c2410_wdt_variant drv_data_exynosautov920_cl1 =3D { @@ -362,7 +369,7 @@ static const struct s3c2410_wdt_variant drv_data_exynos= autov920_cl1 =3D { .cnt_en_bit =3D 8, .quirks =3D QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET | QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN | - QUIRK_HAS_DBGACK_BIT, + QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_32BIT_MAXCNT, }; =20 static const struct of_device_id s3c2410_wdt_match[] =3D { @@ -411,7 +418,7 @@ static inline unsigned int s3c2410wdt_max_timeout(struc= t s3c2410_wdt *wdt) { const unsigned long freq =3D s3c2410wdt_get_freq(wdt); =20 - return S3C2410_WTCNT_MAXCNT / DIV_ROUND_UP(freq, + return wdt->max_cnt / DIV_ROUND_UP(freq, (S3C2410_WTCON_PRESCALE_MAX + 1) * S3C2410_WTCON_MAXDIV); } =20 @@ -566,7 +573,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_dev= ice *wdd, { struct s3c2410_wdt *wdt =3D watchdog_get_drvdata(wdd); unsigned long freq =3D s3c2410wdt_get_freq(wdt); - unsigned int count; + unsigned long count; unsigned int divisor =3D 1; unsigned long wtcon; =20 @@ -576,7 +583,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_dev= ice *wdd, freq =3D DIV_ROUND_UP(freq, 128); count =3D timeout * freq; =20 - dev_dbg(wdt->dev, "Heartbeat: count=3D%d, timeout=3D%d, freq=3D%lu\n", + dev_dbg(wdt->dev, "Heartbeat: count=3D%lu, timeout=3D%d, freq=3D%lu\n", count, timeout, freq); =20 /* if the count is bigger than the watchdog register, @@ -584,8 +591,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_dev= ice *wdd, actually make this value */ =20 - if (count >=3D 0x10000) { - divisor =3D DIV_ROUND_UP(count, 0xffff); + if (count > wdt->max_cnt) { + divisor =3D DIV_ROUND_UP(count, wdt->max_cnt); =20 if (divisor > S3C2410_WTCON_PRESCALE_MAX + 1) { dev_err(wdt->dev, "timeout %d too big\n", timeout); @@ -593,7 +600,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_dev= ice *wdd, } } =20 - dev_dbg(wdt->dev, "Heartbeat: timeout=3D%d, divisor=3D%d, count=3D%d (%08= x)\n", + dev_dbg(wdt->dev, "Heartbeat: timeout=3D%d, divisor=3D%d, count=3D%lu (%0= 8lx)\n", timeout, divisor, count, DIV_ROUND_UP(count, divisor)); =20 count =3D DIV_ROUND_UP(count, divisor); @@ -801,6 +808,10 @@ static int s3c2410wdt_probe(struct platform_device *pd= ev) if (IS_ERR(wdt->src_clk)) return dev_err_probe(dev, PTR_ERR(wdt->src_clk), "failed to get source c= lock\n"); =20 + wdt->max_cnt =3D S3C2410_WTCNT_MAXCNT; + if ((wdt->drv_data->quirks & QUIRK_HAS_32BIT_MAXCNT)) + wdt->max_cnt =3D S3C2410_WTCNT_MAXCNT_32; + wdt->wdt_device.min_timeout =3D 1; wdt->wdt_device.max_timeout =3D s3c2410wdt_max_timeout(wdt); =20 --=20 2.25.1 From nobody Mon Oct 6 06:47:31 2025 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (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 9901D274B5D for ; Thu, 24 Jul 2025 08:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344824; cv=none; b=qC88YWqrd5lr4zdH8usyYVP88OyDR2UAdm6uB5FyOPGiupm1YXrFmxnJWZBIvSKcZX96gX00jcqYNNZ33ba+tQc1AMFSq5uF9G1pgmklYLbXjXDNjKDnNdbkXuZgrxGr9BocPyJNzjLcSHNESN+5wxEm0zmoY0yZzl8b2XwGgGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344824; c=relaxed/simple; bh=SZ0ix64LWkWmOzE/oZMmtvn15B1pYoikVjlEZIQ43Po=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=rw94tGKmlhxqI+TgoO/wLMR+t/7t56RC68BF57Y4TegkKhbu6wLp9OVVoPahrxiAZqFjp35skgHG9otKA3lXFVT+nhWkPIpIQ2ME3u72HfyEiddlJqcqiLXmdrVKYLMOWzXAERwEOtJMIwa5vMT04hFwTvx8qVG9JZD9B0nZbxo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=IE/PiPjC; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="IE/PiPjC" Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20250724081338epoutp0169fcb8235965b593e71d9b565e5fb31c~VIdK6k_711400414004epoutp01S for ; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20250724081338epoutp0169fcb8235965b593e71d9b565e5fb31c~VIdK6k_711400414004epoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1753344818; bh=QsQQNaYSRD2U8LOrlkyZxDfezSoAFEk1Vqrj9+PASX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IE/PiPjCu4yG3f3DRwt1j54cxsgRyc7ra0+WkQTkBuu+hb+T4ACthfPWLeUKgHBtB Q8Rw1AEZEri4Wf+f+B5Zb3lO/c0ptVaVHmIMlDjJh0hgs5HV+6/rgrMEL7oJ2OcUl+ S80RyNeco0x3Z2nCxuLBEr1QSbAlRMHdQQNWLgxs= Received: from epsnrtp03.localdomain (unknown [182.195.42.155]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPS id 20250724081338epcas2p25a24d73f6497f2b680918d4f8e2ca4df~VIdKgCcht0557505575epcas2p2B; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) Received: from epcas2p1.samsung.com (unknown [182.195.36.102]) by epsnrtp03.localdomain (Postfix) with ESMTP id 4bnkKY5n7Mz3hhTB; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20250724081337epcas2p430db7d7514b8cc05e41001f17b8b0d45~VIdJSia0H1004510045epcas2p4C; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from localhost.localdomain (unknown [10.229.9.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250724081337epsmtip15995237414cebf3f8f4d85e133d21737~VIdJO8PAw1874118741epsmtip1K; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) From: Sangwook Shin To: krzk@kernel.org, alim.akhtar@samsung.com, wim@linux-watchdog.org, linux@roeck-us.net, semen.protsenko@linaro.org, khwan.seo@samsung.com, dongil01.park@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Sangwook Shin Subject: [PATCH v4 4/4] watchdog: s3c2410_wdt: exynosautov9: Enable supported features Date: Thu, 24 Jul 2025 17:08:54 +0900 Message-Id: <20250724080854.3866566-5-sw617.shin@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250724080854.3866566-1-sw617.shin@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250724081337epcas2p430db7d7514b8cc05e41001f17b8b0d45 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P cpgsPolicy: CPGSC10-234,N X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250724081337epcas2p430db7d7514b8cc05e41001f17b8b0d45 References: <20250724080854.3866566-1-sw617.shin@samsung.com> Enable supported features for ExynosAutov9 SoC. - QUIRK_HAS_DBGACK_BIT - QUIRK_HAS_32BIT_MAXCNT Reviewed-by: Alim Akhtar Signed-off-by: Sangwook Shin Reviewed-by: Sam Protsenko --- drivers/watchdog/s3c2410_wdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 184b1ad46ca6..16a845f41e74 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -305,7 +305,8 @@ static const struct s3c2410_wdt_variant drv_data_exynos= autov9_cl0 =3D { .cnt_en_reg =3D EXYNOS850_CLUSTER0_NONCPU_OUT, .cnt_en_bit =3D 7, .quirks =3D QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET | - QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN, + QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN | + QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_32BIT_MAXCNT, }; =20 static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 =3D { @@ -317,7 +318,8 @@ static const struct s3c2410_wdt_variant drv_data_exynos= autov9_cl1 =3D { .cnt_en_reg =3D EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT, .cnt_en_bit =3D 7, .quirks =3D QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET | - QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN, + QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN | + QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_32BIT_MAXCNT, }; =20 static const struct s3c2410_wdt_variant drv_data_gs101_cl0 =3D { --=20 2.25.1