Backport ASPEED AST2700 watchdog support
cover Backport ASPEED AST2700 watchdog support
Backport four upstream Linux ASPEED watchdog commits to OpenBMC dev-6.18 to provide AST2700 watchdog support, device-tree bindings and reset-mask definitions, followed by the optional-IRQ error handling fix.
Chin-Ting Kuo (3):
dt-bindings: watchdog: aspeed,ast2400-wdt: Add support for AST2700
watchdog: aspeed: Support variable number of reset mask registers
watchdog: aspeed: Add support for AST2700 platform
bui duc phuc (1):
watchdog: aspeed: Propagate errors from optional IRQ lookup
.../bindings/watchdog/aspeed,ast2400-wdt.yaml | 8 +- drivers/watchdog/aspeed_wdt.c | 32 +++- include/dt-bindings/watchdog/aspeed-wdt.h | 138 ++++++++++++++++++ 3 files changed, 169 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/4 dt-bindings: watchdog: aspeed,ast2400-wdt: Add support for AST2700
From: Chin-Ting Kuo <[email protected]>
Add support for the AST2700 SoC in the ASPEED watchdog device tree bindings. This includes:
- Adding "aspeed,ast2700-wdt" to the compatible string list.
- Extending the "aspeed,reset-mask" property description for AST2700.
- Defining AST2700-specific reset mask bits in aspeed-wdt.h, covering RESET1 to RESET5.
--- .../bindings/watchdog/aspeed,ast2400-wdt.yaml | 8 +- include/dt-bindings/watchdog/aspeed-wdt.h | 138 ++++++++++++++++++ 2 files changed, 144 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/watchdog/aspeed,ast2400-wdt.yaml +6 -2
@@ -15,6 +15,7 @@ properties: - aspeed,ast2400-wdt - aspeed,ast2500-wdt - aspeed,ast2600-wdt + - aspeed,ast2700-wdt reg: maxItems: 1
@@ -87,13 +88,15 @@ properties: aspeed,reset-mask: $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 1 - maxItems: 2 + maxItems: 5 description: > A bitmask indicating which peripherals will be reset if the watchdog timer expires. On AST2500 SoCs this should be a single word defined using the AST2500_WDT_RESET_* macros; on AST2600 SoCs this should be a two-word array with the first word defined using the AST2600_WDT_RESET1_* macros, - and the second word defined using the AST2600_WDT_RESET2_* macros. + and the second word defined using the AST2600_WDT_RESET2_* macros; on + AST2700 SoCs, this should be five-word array from AST2700_WDT_RESET1_* + macros to AST2700_WDT_RESET5_* macros. required: - compatible
@@ -114,6 +117,7 @@ allOf: enum: - aspeed,ast2500-wdt - aspeed,ast2600-wdt + - aspeed,ast2700-wdt - if: required: - aspeed,ext-active-high
include/dt-bindings/watchdog/aspeed-wdt.h +138 -0
142 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 2/4 watchdog: aspeed: Support variable number of reset mask registers
In reply to Vince ChangFrom: Chin-Ting Kuo <[email protected]>
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.
--- drivers/watchdog/aspeed_wdt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/watchdog/aspeed_wdt.c +8 -6
@@ -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 ); } }
Signature · 1 line
2.43.0
PATCH 3/4 watchdog: aspeed: Add support for AST2700 platform
In reply to Vince ChangFrom: Chin-Ting Kuo <[email protected]>
Add AST2700 platform support to the ASPEED watchdog driver. This includes a new per-platform configuration with SCU reset status register at SCU1_070 and support for 5 reset mask registers.
--- drivers/watchdog/aspeed_wdt.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/watchdog/aspeed_wdt.c +15 -1
@@ -83,10 +83,24 @@ static const struct aspeed_wdt_config ast2600_config = { .num_reset_masks = 2, }; +static const struct aspeed_wdt_config ast2700_config = { + .ext_pulse_width_mask =0xfffff , + .irq_shift =0 , + .irq_mask =GENMASK (31 ,10 ), + .scu = { + .compatible ="aspeed,ast2700-scu0" , + .reset_status_reg =0x70 , + .wdt_reset_mask =0xf , + .wdt_reset_mask_shift =0 , + }, + .num_reset_masks =5 , +}; +static const struct of_device_id aspeed_wdt_of_table[] = { { .compatible ="aspeed,ast2400-wdt" , .data = &ast2400_config }, { .compatible ="aspeed,ast2500-wdt" , .data = &ast2500_config }, { .compatible ="aspeed,ast2600-wdt" , .data = &ast2600_config }, + { .compatible ="aspeed,ast2700-wdt" , .data = &ast2700_config }, { }, };MODULE_DEVICE_TABLE (of, aspeed_wdt_of_table);
@@ -483,7 +497,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev) }if (!of_device_is_compatible (np,"aspeed,ast2400-wdt" )) { -u32 reset_mask[2 ]; +u32 reset_mask[5 ];size_t nrstmask = wdt->cfg->num_reset_masks;u32 reg =readl (wdt->base +WDT_RESET_WIDTH );int i;
Signature · 1 line
2.43.0
PATCH 4/4 watchdog: aspeed: Propagate errors from optional IRQ lookup
In reply to Vince ChangFrom: bui duc phuc <[email protected]>
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated.
Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing probe without the IRQ.
--- drivers/watchdog/aspeed_wdt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/watchdog/aspeed_wdt.c +2 -0
@@ -429,6 +429,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)if (wdt->cfg->irq_mask) {int irq =platform_get_irq_optional (pdev,0 ); +if (irq <0 && irq != -ENXIO ) +return irq;if (irq >0 ) { ret = devm_request_irq(dev, irq, aspeed_wdt_irq, IRQF_SHARED, dev_name(dev),
Signature · 1 line
2.43.0
Quoted 4 lines · Vince Chang
Backport four upstream Linux ASPEED watchdog commits to OpenBMC dev-6.18 to provide AST2700 watchdog support, device-tree bindings and reset-mask definitions, followed by the optional-IRQ error handling fix.
Applied, thanks.
Andrew