1 // SPDX-License-Identifier: GPL-2.0+
5 #include <asm/processor.h>
6 #include <asm/system.h>
11 #define WDT_WD (1 << 6)
13 #define WDT_RST_M (1 << 5)
14 #define WDT_ENABLE (1 << 7)
16 #if defined(CONFIG_WATCHDOG)
17 static unsigned char csr_read(void)
19 return inb(WDT_BASE + 0x04);
22 static void cnt_write(unsigned char value)
24 outl((unsigned short)value | 0x5A00, WDT_BASE + 0x00);
27 static void csr_write(unsigned char value)
29 outl((unsigned short)value | 0xA500, WDT_BASE + 0x04);
32 void watchdog_reset(void)
34 outl(0x55000000, WDT_BASE + 0x08);
37 int watchdog_init(void)
39 /* Set overflow time*/
42 csr_write(WDT_WD|WDT_RST_P|WDT_ENABLE);
47 int watchdog_disable(void)
49 csr_write(csr_read() & ~WDT_ENABLE);
54 void reset_cpu(unsigned long ignored)
56 /* Address error with SR.BL=1 first. */
57 trigger_address_error();