From: Jernej Skrabec <jernej.skra...@gmail.com>

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.

Provide a new struct describing the register layout, and adjust the
address calculation in the SPL code accoringly. This is guarded by the
MACH_SUN55I_A523 Kconfig variable.
---
 arch/arm/include/asm/arch-sunxi/watchdog.h | 12 ++++++++++++
 arch/arm/mach-sunxi/board.c                |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/arch/arm/include/asm/arch-sunxi/watchdog.h 
b/arch/arm/include/asm/arch-sunxi/watchdog.h
index 38e2ef2aca3..96d5725141e 100644
--- a/arch/arm/include/asm/arch-sunxi/watchdog.h
+++ b/arch/arm/include/asm/arch-sunxi/watchdog.h
@@ -26,6 +26,18 @@ struct sunxi_wdog {
        u32 res[2];
 };
 
+#elif defined(CONFIG_MACH_SUN55I_A523)
+
+struct sunxi_wdog {
+       u32 irq_en;             /* 0x00 */
+       u32 irq_sta;            /* 0x04 */
+       u32 srst;               /* 0x08 */
+       u32 ctl;                /* 0x0c */
+       u32 cfg;                /* 0x10 */
+       u32 mode;               /* 0x14 */
+       u32 ocfg;               /* 0x18 */
+};
+
 #else
 
 #define WDT_CFG_RESET          (0x1)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 701899ee4b2..89aea61e8e8 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -495,6 +495,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 struct sunxi_wdog *wdog =
+               (struct sunxi_wdog *)SUNXI_TIMER_BASE;
+
+       writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->srst);
+       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 */
-- 
2.46.3

Reply via email to