2008-03-30 19:46:13 +00:00
|
|
|
/*
|
|
|
|
* watchdog.c - driver for Blackfin on-chip watchdog
|
|
|
|
*
|
2009-11-12 23:42:07 +00:00
|
|
|
* Copyright (c) 2007-2009 Analog Devices Inc.
|
2008-03-30 19:46:13 +00:00
|
|
|
*
|
|
|
|
* Licensed under the GPL-2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <watchdog.h>
|
|
|
|
#include <asm/blackfin.h>
|
2013-04-07 10:02:37 +00:00
|
|
|
#include <asm/mach-common/bits/watchdog.h>
|
2008-03-30 19:46:13 +00:00
|
|
|
|
|
|
|
void hw_watchdog_reset(void)
|
|
|
|
{
|
|
|
|
bfin_write_WDOG_STAT(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void hw_watchdog_init(void)
|
|
|
|
{
|
2013-04-07 10:02:37 +00:00
|
|
|
bfin_write_WDOG_CTL(WDDIS);
|
|
|
|
SSYNC();
|
|
|
|
bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
|
2008-03-30 19:46:13 +00:00
|
|
|
hw_watchdog_reset();
|
2013-04-07 10:02:37 +00:00
|
|
|
bfin_write_WDOG_CTL(WDEN);
|
2008-03-30 19:46:13 +00:00
|
|
|
}
|