Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: aspeed: Support variable number of reset mask registers

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>

authored by

Chin-Ting Kuo and committed by
Wim Van Sebroeck
0eb54296 b3bc229b

+8 -6
+8 -6
drivers/watchdog/aspeed_wdt.c
··· 35 35 u32 irq_shift; 36 36 u32 irq_mask; 37 37 struct aspeed_wdt_scu scu; 38 + u32 num_reset_masks; 38 39 }; 39 40 40 41 struct aspeed_wdt { ··· 67 66 .wdt_reset_mask = 0x1, 68 67 .wdt_reset_mask_shift = 2, 69 68 }, 69 + .num_reset_masks = 1, 70 70 }; 71 71 72 72 static const struct aspeed_wdt_config ast2600_config = { ··· 80 78 .wdt_reset_mask = 0xf, 81 79 .wdt_reset_mask_shift = 16, 82 80 }, 81 + .num_reset_masks = 2, 83 82 }; 84 83 85 84 static const struct of_device_id aspeed_wdt_of_table[] = { ··· 482 479 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); 483 480 } 484 481 485 - if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) || 486 - (of_device_is_compatible(np, "aspeed,ast2600-wdt"))) { 482 + if (!of_device_is_compatible(np, "aspeed,ast2400-wdt")) { 487 483 u32 reset_mask[2]; 488 - size_t nrstmask = of_device_is_compatible(np, "aspeed,ast2600-wdt") ? 2 : 1; 484 + size_t nrstmask = wdt->cfg->num_reset_masks; 489 485 u32 reg = readl(wdt->base + WDT_RESET_WIDTH); 486 + int i; 490 487 491 488 reg &= wdt->cfg->ext_pulse_width_mask; 492 489 if (of_property_read_bool(np, "aspeed,ext-active-high")) ··· 506 503 507 504 ret = of_property_read_u32_array(np, "aspeed,reset-mask", reset_mask, nrstmask); 508 505 if (!ret) { 509 - writel(reset_mask[0], wdt->base + WDT_RESET_MASK1); 510 - if (nrstmask > 1) 511 - writel(reset_mask[1], wdt->base + WDT_RESET_MASK2); 506 + for (i = 0; i < nrstmask; i++) 507 + writel(reset_mask[i], wdt->base + WDT_RESET_MASK1 + i * 4); 512 508 } 513 509 } 514 510