blob: 6a8db59fdff1b96da21a0280567a3def1a524890 [file] [log] [blame]
Mike Frysinger94bae5c2008-03-30 15:46:13 -04001/*
2 * watchdog.c - driver for Blackfin on-chip watchdog
3 *
Mike Frysinger5443bc42009-11-12 18:42:07 -05004 * Copyright (c) 2007-2009 Analog Devices Inc.
Mike Frysinger94bae5c2008-03-30 15:46:13 -04005 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <common.h>
10#include <watchdog.h>
11#include <asm/blackfin.h>
Vasili Galkabc691812014-06-30 12:59:56 +030012#include <asm/clock.h>
Sonic Zhangcde8cef2013-04-07 18:02:37 +080013#include <asm/mach-common/bits/watchdog.h>
Mike Frysinger94bae5c2008-03-30 15:46:13 -040014
Mike Frysinger94bae5c2008-03-30 15:46:13 -040015void hw_watchdog_reset(void)
16{
17 bfin_write_WDOG_STAT(0);
18}
19
20void hw_watchdog_init(void)
21{
Sonic Zhangcde8cef2013-04-07 18:02:37 +080022 bfin_write_WDOG_CTL(WDDIS);
23 SSYNC();
24 bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
Mike Frysinger94bae5c2008-03-30 15:46:13 -040025 hw_watchdog_reset();
Sonic Zhangcde8cef2013-04-07 18:02:37 +080026 bfin_write_WDOG_CTL(WDEN);
Mike Frysinger94bae5c2008-03-30 15:46:13 -040027}