2 * SPDX-License-Identifier: GPL-2.0+
6 #include <asm/processor.h>
7 #include <asm/system.h>
10 #define WDT_BASE WTCNT
12 #define WDT_WD (1 << 6)
14 #define WDT_RST_M (1 << 5)
15 #define WDT_ENABLE (1 << 7)
17 #if defined(CONFIG_WATCHDOG)
18 static unsigned char csr_read(void)
20 return inb(WDT_BASE + 0x04);
23 static void cnt_write(unsigned char value)
25 outl((unsigned short)value | 0x5A00, WDT_BASE + 0x00);
28 static void csr_write(unsigned char value)
30 outl((unsigned short)value | 0xA500, WDT_BASE + 0x04);
33 void watchdog_reset(void)
35 outl(0x55000000, WDT_BASE + 0x08);
38 int watchdog_init(void)
40 /* Set overflow time*/
43 csr_write(WDT_WD|WDT_RST_P|WDT_ENABLE);
48 int watchdog_disable(void)
50 csr_write(csr_read() & ~WDT_ENABLE);
55 void reset_cpu(unsigned long ignored)
57 /* Address error with SR.BL=1 first. */
58 trigger_address_error();