Skip to content

Commit 63d2398

Browse files
committed
wdt: Disarm secondary watchdog on t814x
M4 and A18 Pro and reset with iboot from macOS 26.x after 120 seconds. This is caused by secondary watchdogs living at offset 0x8000. The ADT contains for all devices since M1 4 byte sized reg entries at those offsets. This seems to be secondary watchdogs with a different MMIO layout. Setting the offset 0x8008 to 0x0 from its initial value of 0x7b seems to disable the watchdog. This watchdog doesn't seem to have a programmable count register and uses the raw count at 0x2000. The alarm value might reside at 0x8018. The value there is close to 120 seconds with a clock 2.4 MHz. Discovered-by: @MiyakoYakota Signed-off-by: Janne Grunau <[email protected]>
1 parent bcee7f2 commit 63d2398

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/wdt.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#define WDT_ALARM 0x14
1010
#define WDT_CTL 0x1c
1111

12+
#define WDT_2ND_OFFSET 0x8008
13+
1214
static u64 wdt_base = 0;
1315

1416
void wdt_disable(void)
@@ -26,9 +28,17 @@ void wdt_disable(void)
2628
return;
2729
}
2830

29-
printf("WDT registers @ 0x%lx\n", wdt_base);
31+
u64 wdt_2nd = 0;
32+
if (adt_get_reg(adt, path, "reg", 2, &wdt_2nd, NULL)) {
33+
printf("Failed to get WDT reg[2] property!\n");
34+
}
35+
36+
printf("WDT registers @ 0x%lx (0x%lx)\n", wdt_base, wdt_2nd);
3037

3138
write32(wdt_base + WDT_CTL, 0);
39+
// disable seconmdary watchdog enabled on M4 / A18 Pro with macOS 26
40+
if ((wdt_2nd - wdt_base) == WDT_2ND_OFFSET)
41+
write32(wdt_2nd, 0);
3242

3343
printf("WDT disabled\n");
3444
}

0 commit comments

Comments
 (0)