mirror of
https://github.com/smaeul/u-boot.git
synced 2025-11-26 22:01:10 +00:00
m68k: move watchdog functions in mcf_wdt driver
Move watchdog functions inside a separate watchdog driver. Signed-off-by: Angelo Dureghello <angelo@kernel-space.org> --- Changes for v2: - none Changes for v3: - none
This commit is contained in:
parent
9b8bc514a0
commit
dc3a89b8c6
@ -12,7 +12,6 @@
|
||||
#include <init.h>
|
||||
#include <net.h>
|
||||
#include <vsprintf.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <netdev.h>
|
||||
#include <asm/global_data.h>
|
||||
@ -62,47 +61,6 @@ int print_cpuinfo(void)
|
||||
};
|
||||
#endif /* CONFIG_DISPLAY_CPUINFO */
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
/* Called by macro WATCHDOG_RESET */
|
||||
void watchdog_reset(void)
|
||||
{
|
||||
wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
|
||||
|
||||
/* Count register */
|
||||
out_be16(&wdp->sr, 0x5555);
|
||||
asm("nop");
|
||||
out_be16(&wdp->sr, 0xaaaa);
|
||||
}
|
||||
|
||||
int watchdog_disable(void)
|
||||
{
|
||||
wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
|
||||
|
||||
/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
|
||||
/* halted watchdog timer */
|
||||
setbits_be16(&wdp->cr, WTM_WCR_HALTED);
|
||||
|
||||
puts("WATCHDOG:disabled\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
int watchdog_init(void)
|
||||
{
|
||||
wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
|
||||
u32 wdog_module = 0;
|
||||
|
||||
/* set timeout and enable watchdog */
|
||||
wdog_module = ((CFG_SYS_CLK / CONFIG_SYS_HZ) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
|
||||
wdog_module |= (wdog_module / 8192);
|
||||
out_be16(&wdp->mr, wdog_module);
|
||||
|
||||
out_be16(&wdp->cr, WTM_WCR_EN);
|
||||
puts("WATCHDOG:enabled\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
#if defined(CONFIG_MCFFEC)
|
||||
/* Default initializations for MCFFEC controllers. To override,
|
||||
* create a board-specific function called:
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include <init.h>
|
||||
#include <net.h>
|
||||
#include <vsprintf.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <asm/immap.h>
|
||||
@ -53,51 +52,7 @@ int print_cpuinfo(void)
|
||||
return 0;
|
||||
};
|
||||
#endif /* CONFIG_DISPLAY_CPUINFO */
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
/* Called by macro WATCHDOG_RESET */
|
||||
void watchdog_reset(void)
|
||||
{
|
||||
wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
|
||||
|
||||
out_be16(&wdt->sr, 0x5555);
|
||||
out_be16(&wdt->sr, 0xaaaa);
|
||||
}
|
||||
|
||||
int watchdog_disable(void)
|
||||
{
|
||||
wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
|
||||
|
||||
/* reset watchdog counter */
|
||||
out_be16(&wdt->sr, 0x5555);
|
||||
out_be16(&wdt->sr, 0xaaaa);
|
||||
/* disable watchdog timer */
|
||||
out_be16(&wdt->cr, 0);
|
||||
|
||||
puts("WATCHDOG:disabled\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
int watchdog_init(void)
|
||||
{
|
||||
wdog_t *wdt = (wdog_t *)(MMAP_WDOG);
|
||||
|
||||
/* disable watchdog */
|
||||
out_be16(&wdt->cr, 0);
|
||||
|
||||
/* set timeout and enable watchdog */
|
||||
out_be16(&wdt->mr,
|
||||
(CONFIG_WATCHDOG_TIMEOUT_MSECS * CONFIG_SYS_HZ) / (32768 * 1000) - 1);
|
||||
|
||||
/* reset watchdog counter */
|
||||
out_be16(&wdt->sr, 0x5555);
|
||||
out_be16(&wdt->sr, 0xaaaa);
|
||||
|
||||
puts("WATCHDOG:enabled\n");
|
||||
return (0);
|
||||
}
|
||||
#endif /* #ifdef CONFIG_WATCHDOG */
|
||||
#endif /* #ifdef CONFIG_M5208 */
|
||||
#endif /* #ifdef CONFIG_M5208 */
|
||||
|
||||
#ifdef CONFIG_M5271
|
||||
#if defined(CONFIG_DISPLAY_CPUINFO)
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#include <init.h>
|
||||
#include <net.h>
|
||||
#include <vsprintf.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <netdev.h>
|
||||
#include <asm/global_data.h>
|
||||
@ -102,49 +101,6 @@ int print_cpuinfo(void)
|
||||
};
|
||||
#endif /* CONFIG_DISPLAY_CPUINFO */
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
/* Called by macro WATCHDOG_RESET */
|
||||
void watchdog_reset(void)
|
||||
{
|
||||
wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
|
||||
|
||||
/* Count register */
|
||||
out_be16(&wdp->sr, 0x5555);
|
||||
out_be16(&wdp->sr, 0xaaaa);
|
||||
}
|
||||
|
||||
int watchdog_disable(void)
|
||||
{
|
||||
wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
|
||||
|
||||
/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
|
||||
/* halted watchdog timer */
|
||||
setbits_be16(&wdp->cr, WTM_WCR_HALTED);
|
||||
|
||||
puts("WATCHDOG:disabled\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
int watchdog_init(void)
|
||||
{
|
||||
wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
|
||||
u32 wdog_module = 0;
|
||||
|
||||
/* set timeout and enable watchdog */
|
||||
wdog_module = ((CFG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT_MSECS);
|
||||
#ifdef CONFIG_M5329
|
||||
out_be16(&wdp->mr, wdog_module / 8192);
|
||||
#else
|
||||
out_be16(&wdp->mr, wdog_module / 4096);
|
||||
#endif
|
||||
|
||||
out_be16(&wdp->cr, WTM_WCR_EN);
|
||||
puts("WATCHDOG:enabled\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
#if defined(CONFIG_MCFFEC)
|
||||
/* Default initializations for MCFFEC controllers. To override,
|
||||
* create a board-specific function called:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user