From: Vince Chang <vince_chang@aspeedtech.com>
To: <openbmc@lists.ozlabs.org>, <andrew@codeconstruct.com.au>,
<tan.siewert@9elements.com>
Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>, <joel@jms.id.au>,
"Guenter Roeck" <linux@roeck-us.net>,
Wim Van Sebroeck <wim@linux-watchdog.org>
Subject: [PATCH linux dev-6.18 2/4] watchdog: aspeed: Support variable number of reset mask registers
Date: Thu, 29 Oct 2026 13:08:43 +0800 [thread overview]
Message-ID: <20261029050847.810331-3-vince_chang@aspeedtech.com> (raw)
In-Reply-To: <20261029050847.810331-1-vince_chang@aspeedtech.com>
From: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
Starting from the AST2600 platform, the SoC design has become more
complex, with an increased number of reset mask registers.
To support this, introduce a new field 'num_reset_masks' in the
'aspeed_wdt_config' structure to specify the number of reset mask
registers per platform. This change removes the need for hardcoded
platform-specific logic and improves scalability for future SoCs.
Signed-off-by: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
(cherry picked from commit 0eb54296dc784de757724055983d32b03c9e2df1)
Signed-off-by: Vince Chang <vince_chang@aspeedtech.com>
---
drivers/watchdog/aspeed_wdt.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index 837e15701c0e..d23e565f30a8 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -35,6 +35,7 @@ struct aspeed_wdt_config {
u32 irq_shift;
u32 irq_mask;
struct aspeed_wdt_scu scu;
+ u32 num_reset_masks;
};
struct aspeed_wdt {
@@ -66,6 +67,7 @@ static const struct aspeed_wdt_config ast2500_config = {
.wdt_reset_mask = 0x1,
.wdt_reset_mask_shift = 2,
},
+ .num_reset_masks = 1,
};
static const struct aspeed_wdt_config ast2600_config = {
@@ -78,6 +80,7 @@ static const struct aspeed_wdt_config ast2600_config = {
.wdt_reset_mask = 0xf,
.wdt_reset_mask_shift = 16,
},
+ .num_reset_masks = 2,
};
static const struct of_device_id aspeed_wdt_of_table[] = {
@@ -479,11 +482,11 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
}
- if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) ||
- (of_device_is_compatible(np, "aspeed,ast2600-wdt"))) {
+ if (!of_device_is_compatible(np, "aspeed,ast2400-wdt")) {
u32 reset_mask[2];
- size_t nrstmask = of_device_is_compatible(np, "aspeed,ast2600-wdt") ? 2 : 1;
+ size_t nrstmask = wdt->cfg->num_reset_masks;
u32 reg = readl(wdt->base + WDT_RESET_WIDTH);
+ int i;
reg &= wdt->cfg->ext_pulse_width_mask;
if (of_property_read_bool(np, "aspeed,ext-active-high"))
@@ -503,9 +506,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
ret = of_property_read_u32_array(np, "aspeed,reset-mask", reset_mask, nrstmask);
if (!ret) {
- writel(reset_mask[0], wdt->base + WDT_RESET_MASK1);
- if (nrstmask > 1)
- writel(reset_mask[1], wdt->base + WDT_RESET_MASK2);
+ for (i = 0; i < nrstmask; i++)
+ writel(reset_mask[i], wdt->base + WDT_RESET_MASK1 + i * 4);
}
}
--
2.43.0
next prev parent reply other threads:[~2026-10-29 5:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 5:08 [PATCH linux dev-6.18 0/4] Backport ASPEED AST2700 watchdog support Vince Chang
2026-10-29 5:08 ` [PATCH linux dev-6.18 1/4] dt-bindings: watchdog: aspeed,ast2400-wdt: Add support for AST2700 Vince Chang
2026-10-29 5:08 ` Vince Chang [this message]
2026-10-29 5:08 ` [PATCH linux dev-6.18 3/4] watchdog: aspeed: Add support for AST2700 platform Vince Chang
2026-10-29 5:08 ` [PATCH linux dev-6.18 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup Vince Chang
2026-10-29 23:59 ` [PATCH linux dev-6.18 0/4] Backport ASPEED AST2700 watchdog support Andrew Jeffery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261029050847.810331-3-vince_chang@aspeedtech.com \
--to=vince_chang@aspeedtech.com \
--cc=andrew@codeconstruct.com.au \
--cc=chin-ting_kuo@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=linux@roeck-us.net \
--cc=openbmc@lists.ozlabs.org \
--cc=tan.siewert@9elements.com \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.