2 * watchdog.c - driver for i.mx on-chip watchdog
4 * Licensed under the GPL-2 or later.
10 #include <asm/arch/imx-regs.h>
13 #ifdef CONFIG_IMX_WATCHDOG
14 void hw_watchdog_reset(void)
16 struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
18 writew(0x5555, &wdog->wsr);
19 writew(0xaaaa, &wdog->wsr);
22 void hw_watchdog_init(void)
24 struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
28 * The timer watchdog can be set between
29 * 0.5 and 128 Seconds. If not defined
30 * in configuration file, sets 128 Seconds
32 #ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
33 #define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000
35 timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1;
36 writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT | WCR_SRS |
37 SET_WCR_WT(timeout), &wdog->wcr);
42 void reset_cpu(ulong addr)
44 struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
46 clrsetbits_le16(&wdog->wcr, 0, WCR_WDE);
48 writew(0x5555, &wdog->wsr);
49 writew(0xaaaa, &wdog->wsr); /* load minimum 1/2 second timeout */
52 * spin for .5 seconds before reset