]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sunxi: spl: add support for Allwinner A523 watchdog
authorAndre Przywara <andre.przywara@arm.com>
Sun, 29 Dec 2024 20:13:13 +0000 (21:13 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Sun, 27 Jul 2025 21:57:35 +0000 (22:57 +0100)
The watchdog in the Allwinner A523 SoC differs a bit from the one in the
previous SoCs: it lives in a separate register frame, so no longer
inside some timer device, and it manages to shuffle around some
registers a bit. But it also conveniently adds a direct reset
functionality, so we don't need to use a dummy timeout period.

Avoid introducing a new MMIO register frame C struct, but just define
the one needed register offset as a macro. Then just trigger this new
direct reset functionality in the A523 specific reset_cpu()
implementation.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/include/asm/arch-sunxi/watchdog.h
arch/arm/mach-sunxi/board.c

index 38e2ef2aca3df6f433d25dd5c2117721c41ce2b1..14a6e89ccfaf8e615bacf637f0cec530224f7f09 100644 (file)
@@ -12,6 +12,8 @@
 #define WDT_CTRL_RESTART       (0x1 << 0)
 #define WDT_CTRL_KEY           (0x0a57 << 1)
 
+#define WDT_SRST_REG           0x08
+
 #if defined(CONFIG_MACH_SUN4I) || \
     defined(CONFIG_MACH_SUN5I) || \
     defined(CONFIG_MACH_SUN7I) || \
index 08d55b3a0e3953968ad141ee5edab9ab1b8c54ab..13caefda8849dec1ea294f77f0e34b62893f24ea 100644 (file)
@@ -502,6 +502,12 @@ void reset_cpu(void)
                /* sun5i sometimes gets stuck without this */
                writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
        }
+#elif defined(CONFIG_MACH_SUN55I_A523)
+       static const void *wdog = (void *)SUNXI_TIMER_BASE;
+
+       writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, wdog + WDT_SRST_REG);
+       while (1)
+               ;
 #elif defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) || defined(CONFIG_SUNXI_GEN_NCAT2)
 #if defined(CONFIG_MACH_SUN50I_H6)
        /* WDOG is broken for some H6 rev. use the R_WDOG instead */