2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License as
4 * published by the Free Software Foundation; either version 2 of
5 * the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 #include <asm/processor.h>
20 #include <asm/system.h>
23 #define WDT_BASE WTCNT
25 #define WDT_WD (1 << 6)
27 #define WDT_RST_M (1 << 5)
28 #define WDT_ENABLE (1 << 7)
30 #if defined(CONFIG_WATCHDOG)
31 static unsigned char csr_read(void)
33 return inb(WDT_BASE + 0x04);
36 static void cnt_write(unsigned char value)
38 outl((unsigned short)value | 0x5A00, WDT_BASE + 0x00);
41 static void csr_write(unsigned char value)
43 outl((unsigned short)value | 0xA500, WDT_BASE + 0x04);
46 void watchdog_reset(void)
48 outl(0x55000000, WDT_BASE + 0x08);
51 int watchdog_init(void)
53 /* Set overflow time*/
56 csr_write(WDT_WD|WDT_RST_P|WDT_ENABLE);
61 int watchdog_disable(void)
63 csr_write(csr_read() & ~WDT_ENABLE);
68 void reset_cpu(unsigned long ignored)
70 /* Address error with SR.BL=1 first. */
71 trigger_address_error();