diff --git a/cpu/mcf52x2/cpu.c b/cpu/mcf52x2/cpu.c index aa6b2bd..486ebfa 100644 --- a/cpu/mcf52x2/cpu.c +++ b/cpu/mcf52x2/cpu.c @@ -159,7 +159,7 @@ int watchdog_init (void) #endif /* #ifdef CONFIG_M5272 */ -#ifdef CONFIG_M5282 +#ifdef CONFIG_M5282 int checkcpu (void) { unsigned char resetsource = MCFRESET_RSR; @@ -183,7 +183,41 @@ int do_reset (cmd_tbl_t *cmdtp, bd_t *bd MCFRESET_RCR = MCFRESET_RCR_SOFTRST; return 0; }; -#endif + +#if defined(CONFIG_WATCHDOG) +void watchdog_reset (void) +{ + MCFWTM_WSR=0x5555; + MCFWTM_WSR=0xAAAA; +} + +int watchdog_disable (void) +{ + /* MCF5282 doen't allow reconfigure WDT */ + return (0); +} + +int watchdog_init (void) +{ + int enable; + char *s; + enable=MCFWTM_WCR_EN; + /* prevent enable if environment is set watchdog=off + MCF5282 doen't allow reconfigure WDT + */ + if ((s = getenv ("watchdog")) != NULL) + { + if ((strncmp (s, "off", 3) == 0) || (strncmp (s, "0", 1) == 0)) + { + enable=0; + } + } + MCFWTM_WCR=enable; + return (0); +} +#endif /* #ifdef CONFIG_WATCHDOG */ + +#endif /* endif CONFIG_M5282 */ #ifdef CONFIG_M5249 /* test-only: todo... */ int checkcpu (void)