1 // SPDX-License-Identifier: GPL-2.0+
4 #include <asm/processor.h>
5 #include <asm/system.h>
10 #define WDT_WD (1 << 6)
12 #define WDT_RST_M (1 << 5)
13 #define WDT_ENABLE (1 << 7)
15 #if defined(CONFIG_WATCHDOG)
16 static unsigned char csr_read(void)
18 return inb(WDT_BASE + 0x04);
21 static void cnt_write(unsigned char value)
23 outl((unsigned short)value | 0x5A00, WDT_BASE + 0x00);
26 static void csr_write(unsigned char value)
28 outl((unsigned short)value | 0xA500, WDT_BASE + 0x04);
31 void watchdog_reset(void)
33 outl(0x55000000, WDT_BASE + 0x08);
36 int watchdog_init(void)
38 /* Set overflow time*/
41 csr_write(WDT_WD|WDT_RST_P|WDT_ENABLE);
46 int watchdog_disable(void)
48 csr_write(csr_read() & ~WDT_ENABLE);
53 void reset_cpu(unsigned long ignored)
55 /* Address error with SR.BL=1 first. */
56 trigger_address_error();