Skip to content

Commit 6a6c7b0

Browse files
zevweissWim Van Sebroeck
authored andcommitted
watchdog: aspeed: Add support for aspeed,reset-mask DT property
This property allows the device-tree to specify how the Aspeed watchdog timer's reset mask register(s) should be set, so that peripherals can be individually exempted from (or opted in to) being reset when the watchdog timer expires. Signed-off-by: Zev Weiss <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 9931be2 commit 6a6c7b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/watchdog/aspeed_wdt.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
7979
#define WDT_TIMEOUT_STATUS_BOOT_SECONDARY BIT(1)
8080
#define WDT_CLEAR_TIMEOUT_STATUS 0x14
8181
#define WDT_CLEAR_TIMEOUT_AND_BOOT_CODE_SELECTION BIT(0)
82+
#define WDT_RESET_MASK1 0x1c
83+
#define WDT_RESET_MASK2 0x20
8284

8385
/*
8486
* WDT_RESET_WIDTH controls the characteristics of the external pulse (if
@@ -402,6 +404,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
402404

403405
if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) ||
404406
(of_device_is_compatible(np, "aspeed,ast2600-wdt"))) {
407+
u32 reset_mask[2];
408+
size_t nrstmask = of_device_is_compatible(np, "aspeed,ast2600-wdt") ? 2 : 1;
405409
u32 reg = readl(wdt->base + WDT_RESET_WIDTH);
406410

407411
reg &= wdt->cfg->ext_pulse_width_mask;
@@ -419,6 +423,13 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
419423
reg |= WDT_OPEN_DRAIN_MAGIC;
420424

421425
writel(reg, wdt->base + WDT_RESET_WIDTH);
426+
427+
ret = of_property_read_u32_array(np, "aspeed,reset-mask", reset_mask, nrstmask);
428+
if (!ret) {
429+
writel(reset_mask[0], wdt->base + WDT_RESET_MASK1);
430+
if (nrstmask > 1)
431+
writel(reset_mask[1], wdt->base + WDT_RESET_MASK2);
432+
}
422433
}
423434

424435
if (!of_property_read_u32(np, "aspeed,ext-pulse-duration", &duration)) {

0 commit comments

Comments
 (0)