* [PATCH v3 RESEND 0/5] Increase max timeout value of s3c2410 watchdog
[not found] <CGME20250714055850epcas2p454265f0cc65a80e80e536a4e88819e2a@epcas2p4.samsung.com>
@ 2025-07-14 5:54 ` Sangwook Shin
[not found] ` <CGME20250714055853epcas2p1c8a30bbc61045c6a359d32989cfaf2f9@epcas2p1.samsung.com>
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Sangwook Shin @ 2025-07-14 5:54 UTC (permalink / raw)
To: krzk, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel,
Sangwook Shin
The ExynosAutoV9 and ExynosAutoV920 SoCs have a 32-bit counter register,
but due to code constraints, only 16-bit values could be used.
This series enables these SoCs to use the 32-bit counter.
Additionally, it addresses the issue where the ExynosAutoV9 SoC supports
the DBGACK bit but it was not set.
V2->V3:
- Correct the incorrect tag information.
- Link to v2:
https://lore.kernel.org/linux-watchdog/20250514094220.1561378-1-sw617.shin@samsung.com/
V1->V2:
- Modify the max_timeout calculation considering overflow
- Separate tha max_timeout calculation into a separate patch
- Add max_cnt in struct s3c2410_wdt
- Set max_cnt once in probe function
- Add patch that uses S3C2410_WTCON_PRESCALE_MAX instead of hardcoded one
- Remove unnecessary inner parentheses
- Link to v1:
https://lore.kernel.org/linux-watchdog/20250513094711.2691059-1-sw617.shin@samsung.com/
Sangwook Shin (5):
watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions
watchdog: s3c2410_wdt: Fix max_timeout being calculated larger
watchdog: s3c2410_wdt: Increase max timeout value of watchdog
watchdog: s3c2410_wdt: exynosautov920: Enable QUIRK_HAS_32BIT_MAXCNT
watchdog: s3c2410_wdt: exynosautov9: Enable supported features
drivers/watchdog/s3c2410_wdt.c | 37 +++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 12 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions
[not found] ` <CGME20250714055853epcas2p1c8a30bbc61045c6a359d32989cfaf2f9@epcas2p1.samsung.com>
@ 2025-07-14 5:54 ` Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar
2025-07-24 7:14 ` Sam Protsenko
0 siblings, 2 replies; 14+ messages in thread
From: Sangwook Shin @ 2025-07-14 5:54 UTC (permalink / raw)
To: krzk, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel,
Sangwook Shin
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.
Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
---
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_device *wdd,
if (count >= 0x10000) {
divisor = DIV_ROUND_UP(count, 0xffff);
- if (divisor > 0x100) {
+ if (divisor > S3C2410_WTCON_PRESCALE_MAX + 1) {
dev_err(wdt->dev, "timeout %d too big\n", timeout);
return -EINVAL;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger
[not found] ` <CGME20250714055857epcas2p18cb516424b84f972970eed1ac5726c54@epcas2p1.samsung.com>
@ 2025-07-14 5:54 ` Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar
0 siblings, 1 reply; 14+ messages in thread
From: Sangwook Shin @ 2025-07-14 5:54 UTC (permalink / raw)
To: krzk, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel,
Sangwook Shin
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.
Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
---
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(struct s3c2410_wdt *wdt)
{
const unsigned long freq = s3c2410wdt_get_freq(wdt);
- 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);
}
static int s3c2410wdt_disable_wdt_reset(struct s3c2410_wdt *wdt, bool mask)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog
[not found] ` <CGME20250714055858epcas2p47b849c0141fdb556288333f7abe00372@epcas2p4.samsung.com>
@ 2025-07-14 5:54 ` Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
2025-07-24 5:57 ` Alim Akhtar
0 siblings, 2 replies; 14+ messages in thread
From: Sangwook Shin @ 2025-07-14 5:54 UTC (permalink / raw)
To: krzk, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel,
Sangwook Shin
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_timeout
3664647
[ 0.302473] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat: count=1099394100000, timeout=3664647, freq=300000
[ 0.302479] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat: timeout=3664647, divisor=256, count=1099394100000 (fff8feac)
[ 0.302510] s3c2410-wdt 10060000.watchdog_cl0: starting watchdog timer
[ 0.302722] s3c2410-wdt 10060000.watchdog_cl0: watchdog active, reset enabled, 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 previous.
Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
---
drivers/watchdog/s3c2410_wdt.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 31f7e1ec779e..090b78717cd2 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -34,6 +34,7 @@
#define S3C2410_WTCLRINT 0x0c
#define S3C2410_WTCNT_MAXCNT 0xffff
+#define S3C2410_WTCNT_MAXCNT_32 0xffffffff
#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 these
+ * 32-bit registers, larger values to be set, which means that larger timeouts
+ * 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)
/* 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;
};
static const struct s3c2410_wdt_variant drv_data_s3c2410 = {
@@ -411,7 +418,7 @@ static inline unsigned int s3c2410wdt_max_timeout(struct s3c2410_wdt *wdt)
{
const unsigned long freq = s3c2410wdt_get_freq(wdt);
- return S3C2410_WTCNT_MAXCNT / DIV_ROUND_UP(freq,
+ return wdt->max_cnt / DIV_ROUND_UP(freq,
(S3C2410_WTCON_PRESCALE_MAX + 1) * S3C2410_WTCON_MAXDIV);
}
@@ -566,7 +573,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd,
{
struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd);
unsigned long freq = s3c2410wdt_get_freq(wdt);
- unsigned int count;
+ unsigned long count;
unsigned int divisor = 1;
unsigned long wtcon;
@@ -576,7 +583,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd,
freq = DIV_ROUND_UP(freq, 128);
count = timeout * freq;
- dev_dbg(wdt->dev, "Heartbeat: count=%d, timeout=%d, freq=%lu\n",
+ dev_dbg(wdt->dev, "Heartbeat: count=%lu, timeout=%d, freq=%lu\n",
count, timeout, freq);
/* if the count is bigger than the watchdog register,
@@ -584,8 +591,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd,
actually make this value
*/
- if (count >= 0x10000) {
- divisor = DIV_ROUND_UP(count, 0xffff);
+ if (count > wdt->max_cnt) {
+ divisor = DIV_ROUND_UP(count, wdt->max_cnt);
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_device *wdd,
}
}
- dev_dbg(wdt->dev, "Heartbeat: timeout=%d, divisor=%d, count=%d (%08x)\n",
+ dev_dbg(wdt->dev, "Heartbeat: timeout=%d, divisor=%d, count=%lu (%08lx)\n",
timeout, divisor, count, DIV_ROUND_UP(count, divisor));
count = DIV_ROUND_UP(count, divisor);
@@ -801,6 +808,10 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
if (IS_ERR(wdt->src_clk))
return dev_err_probe(dev, PTR_ERR(wdt->src_clk), "failed to get source clock\n");
+ wdt->max_cnt = S3C2410_WTCNT_MAXCNT;
+ if ((wdt->drv_data->quirks & QUIRK_HAS_32BIT_MAXCNT))
+ wdt->max_cnt = S3C2410_WTCNT_MAXCNT_32;
+
wdt->wdt_device.min_timeout = 1;
wdt->wdt_device.max_timeout = s3c2410wdt_max_timeout(wdt);
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 RESEND 4/5] watchdog: s3c2410_wdt: exynosautov920: Enable QUIRK_HAS_32BIT_MAXCNT
[not found] ` <CGME20250714055859epcas2p256ce350e05d8812ca2900823a1e4913d@epcas2p2.samsung.com>
@ 2025-07-14 5:54 ` Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
0 siblings, 1 reply; 14+ messages in thread
From: Sangwook Shin @ 2025-07-14 5:54 UTC (permalink / raw)
To: krzk, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel,
Sangwook Shin
Enable QUIRK_HAS_32BIT_MAXCNT to ExynosAutov920 SoC which has 32-bit WTCNT.
Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
---
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 090b78717cd2..184b1ad46ca6 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -356,7 +356,7 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov920_cl0 = {
.cnt_en_bit = 8,
.quirks = 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,
};
static const struct s3c2410_wdt_variant drv_data_exynosautov920_cl1 = {
@@ -369,7 +369,7 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov920_cl1 = {
.cnt_en_bit = 8,
.quirks = 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,
};
static const struct of_device_id s3c2410_wdt_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 RESEND 5/5] watchdog: s3c2410_wdt: exynosautov9: Enable supported features
[not found] ` <CGME20250714055900epcas2p1f082e73f1f30f7b3ec8e38c6f6501d61@epcas2p1.samsung.com>
@ 2025-07-14 5:54 ` Sangwook Shin
2025-07-24 5:58 ` Alim Akhtar
0 siblings, 1 reply; 14+ messages in thread
From: Sangwook Shin @ 2025-07-14 5:54 UTC (permalink / raw)
To: krzk, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel,
Sangwook Shin
Enable supported features for ExynosAutov9 SoC.
- QUIRK_HAS_DBGACK_BIT
- QUIRK_HAS_32BIT_MAXCNT
Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
---
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_exynosautov9_cl0 = {
.cnt_en_reg = EXYNOS850_CLUSTER0_NONCPU_OUT,
.cnt_en_bit = 7,
.quirks = 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,
};
static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
@@ -317,7 +318,8 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
.cnt_en_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT,
.cnt_en_bit = 7,
.quirks = 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,
};
static const struct s3c2410_wdt_variant drv_data_gs101_cl0 = {
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 RESEND 4/5] watchdog: s3c2410_wdt: exynosautov920: Enable QUIRK_HAS_32BIT_MAXCNT
2025-07-14 5:54 ` [PATCH v3 RESEND 4/5] watchdog: s3c2410_wdt: exynosautov920: Enable QUIRK_HAS_32BIT_MAXCNT Sangwook Shin
@ 2025-07-14 6:04 ` Krzysztof Kozlowski
0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-14 6:04 UTC (permalink / raw)
To: Sangwook Shin, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
On 14/07/2025 07:54, Sangwook Shin wrote:
> Enable QUIRK_HAS_32BIT_MAXCNT to ExynosAutov920 SoC which has 32-bit WTCNT.
>
> Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
> ---
> drivers/watchdog/s3c2410_wdt.c | 4 ++--
This should be squashed with previous patch.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog
2025-07-14 5:54 ` [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog Sangwook Shin
@ 2025-07-14 6:04 ` Krzysztof Kozlowski
2025-07-14 8:17 ` sw617.shin
2025-07-24 5:57 ` Alim Akhtar
1 sibling, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-14 6:04 UTC (permalink / raw)
To: Sangwook Shin, alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
On 14/07/2025 07:54, Sangwook Shin wrote:
> 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_timeout
> 3664647
>
> [ 0.302473] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat: count=1099394100000, timeout=3664647, freq=300000
> [ 0.302479] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat: timeout=3664647, divisor=256, count=1099394100000 (fff8feac)
> [ 0.302510] s3c2410-wdt 10060000.watchdog_cl0: starting watchdog timer
> [ 0.302722] s3c2410-wdt 10060000.watchdog_cl0: watchdog active, reset enabled, 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 previous.
I claim that this patch fixes nothing, because there is no user of
QUIRK_HAS_32BIT_MAXCNT.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog
2025-07-14 6:04 ` Krzysztof Kozlowski
@ 2025-07-14 8:17 ` sw617.shin
0 siblings, 0 replies; 14+ messages in thread
From: sw617.shin @ 2025-07-14 8:17 UTC (permalink / raw)
To: 'Krzysztof Kozlowski', alim.akhtar, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
On Mon, 14 Jul 2025 08:04:47 +0200, Krzysztof Kozlowski wrote:
> I claim that this patch fixes nothing, because there is no user of
> QUIRK_HAS_32BIT_MAXCNT.
Dear Krzysztof,
Thank you for your review.
Are you suggesting that we combine the patches labeled as [v3 3/5] and [v3 4/5] into one?
Best regards,
Sangwook Shin
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions
2025-07-14 5:54 ` [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions Sangwook Shin
@ 2025-07-24 5:53 ` Alim Akhtar
2025-07-24 7:14 ` Sam Protsenko
1 sibling, 0 replies; 14+ messages in thread
From: Alim Akhtar @ 2025-07-24 5:53 UTC (permalink / raw)
To: 'Sangwook Shin', krzk, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
Hi Sangwook
> -----Original Message-----
> From: Sangwook Shin <sw617.shin@samsung.com>
> Sent: Monday, July 14, 2025 11:25 AM
> To: krzk@kernel.org; alim.akhtar@samsung.com; wim@linux-watchdog.org;
> linux@roeck-us.net
> 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 <sw617.shin@samsung.com>
> Subject: [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded
> values with macro definitions
>
> 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.
>
> Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger
2025-07-14 5:54 ` [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger Sangwook Shin
@ 2025-07-24 5:53 ` Alim Akhtar
0 siblings, 0 replies; 14+ messages in thread
From: Alim Akhtar @ 2025-07-24 5:53 UTC (permalink / raw)
To: 'Sangwook Shin', krzk, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
> -----Original Message-----
> From: Sangwook Shin <sw617.shin@samsung.com>
> Sent: Monday, July 14, 2025 11:25 AM
> To: krzk@kernel.org; alim.akhtar@samsung.com; wim@linux-watchdog.org;
> linux@roeck-us.net
> 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 <sw617.shin@samsung.com>
> Subject: [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout
> being calculated larger
>
> 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.
>
> Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
> 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(struct s3c2410_wdt *wdt) {
> const unsigned long freq = s3c2410wdt_get_freq(wdt);
>
> - 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);
> }
>
> static int s3c2410wdt_disable_wdt_reset(struct s3c2410_wdt *wdt, bool
> mask)
> --
> 2.25.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog
2025-07-14 5:54 ` [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
@ 2025-07-24 5:57 ` Alim Akhtar
1 sibling, 0 replies; 14+ messages in thread
From: Alim Akhtar @ 2025-07-24 5:57 UTC (permalink / raw)
To: 'Sangwook Shin', krzk, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
Hi Sangwook
> -----Original Message-----
> From: Sangwook Shin <sw617.shin@samsung.com>
> Sent: Monday, July 14, 2025 11:25 AM
> To: krzk@kernel.org; alim.akhtar@samsung.com; wim@linux-watchdog.org;
> linux@roeck-us.net
> 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 <sw617.shin@samsung.com>
> Subject: [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max
> timeout value of watchdog
>
> 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_t
> imeout
> 3664647
>
> [ 0.302473] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat:
> count=1099394100000, timeout=3664647, freq=300000
> [ 0.302479] s3c2410-wdt 10060000.watchdog_cl0: Heartbeat:
> timeout=3664647, divisor=256, count=1099394100000 (fff8feac)
> [ 0.302510] s3c2410-wdt 10060000.watchdog_cl0: starting watchdog timer
> [ 0.302722] s3c2410-wdt 10060000.watchdog_cl0: watchdog active, reset
> enabled, 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
> previous.
>
As Krzysztof commented, please merge this patch with the next patch so that Quirk and it consumer is part of the same patch.
Once you have done that, feel free to add
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v3 RESEND 5/5] watchdog: s3c2410_wdt: exynosautov9: Enable supported features
2025-07-14 5:54 ` [PATCH v3 RESEND 5/5] watchdog: s3c2410_wdt: exynosautov9: Enable supported features Sangwook Shin
@ 2025-07-24 5:58 ` Alim Akhtar
0 siblings, 0 replies; 14+ messages in thread
From: Alim Akhtar @ 2025-07-24 5:58 UTC (permalink / raw)
To: 'Sangwook Shin', krzk, wim, linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-watchdog, linux-kernel
> -----Original Message-----
> From: Sangwook Shin <sw617.shin@samsung.com>
> Sent: Monday, July 14, 2025 11:25 AM
> To: krzk@kernel.org; alim.akhtar@samsung.com; wim@linux-watchdog.org;
> linux@roeck-us.net
> 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 <sw617.shin@samsung.com>
> Subject: [PATCH v3 RESEND 5/5] watchdog: s3c2410_wdt: exynosautov9:
> Enable supported features
>
> Enable supported features for ExynosAutov9 SoC.
> - QUIRK_HAS_DBGACK_BIT
> - QUIRK_HAS_32BIT_MAXCNT
>
> Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions
2025-07-14 5:54 ` [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar
@ 2025-07-24 7:14 ` Sam Protsenko
1 sibling, 0 replies; 14+ messages in thread
From: Sam Protsenko @ 2025-07-24 7:14 UTC (permalink / raw)
To: Sangwook Shin
Cc: krzk, alim.akhtar, wim, linux, linux-arm-kernel,
linux-samsung-soc, linux-watchdog, linux-kernel
On Mon, Jul 14, 2025 at 12:59 AM Sangwook Shin <sw617.shin@samsung.com> wrote:
>
> 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.
>
> Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
> ---
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
> 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_device *wdd,
> if (count >= 0x10000) {
> divisor = DIV_ROUND_UP(count, 0xffff);
>
> - if (divisor > 0x100) {
> + if (divisor > S3C2410_WTCON_PRESCALE_MAX + 1) {
> dev_err(wdt->dev, "timeout %d too big\n", timeout);
> return -EINVAL;
> }
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-07-24 7:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250714055850epcas2p454265f0cc65a80e80e536a4e88819e2a@epcas2p4.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 0/5] Increase max timeout value of s3c2410 watchdog Sangwook Shin
[not found] ` <CGME20250714055853epcas2p1c8a30bbc61045c6a359d32989cfaf2f9@epcas2p1.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar
2025-07-24 7:14 ` Sam Protsenko
[not found] ` <CGME20250714055857epcas2p18cb516424b84f972970eed1ac5726c54@epcas2p1.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar
[not found] ` <CGME20250714055858epcas2p47b849c0141fdb556288333f7abe00372@epcas2p4.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
2025-07-14 8:17 ` sw617.shin
2025-07-24 5:57 ` Alim Akhtar
[not found] ` <CGME20250714055859epcas2p256ce350e05d8812ca2900823a1e4913d@epcas2p2.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 4/5] watchdog: s3c2410_wdt: exynosautov920: Enable QUIRK_HAS_32BIT_MAXCNT Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
[not found] ` <CGME20250714055900epcas2p1f082e73f1f30f7b3ec8e38c6f6501d61@epcas2p1.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 5/5] watchdog: s3c2410_wdt: exynosautov9: Enable supported features Sangwook Shin
2025-07-24 5:58 ` Alim Akhtar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).