blob: 7a6756b2e52abdbfef6d19c205ba4ae906eb1ba9 [file] [log] [blame]
Mike Frysinger9171fc82008-03-30 15:46:13 -04001/*
2 * watchdog.c - driver for Blackfin on-chip watchdog
3 *
Mike Frysinger313e8aa2009-11-12 18:42:07 -05004 * Copyright (c) 2007-2009 Analog Devices Inc.
Mike Frysinger9171fc82008-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>
Sonic Zhange9a389a2013-04-07 18:02:37 +080012#include <asm/mach-common/bits/watchdog.h>
Mike Frysinger9171fc82008-03-30 15:46:13 -040013
Mike Frysinger9171fc82008-03-30 15:46:13 -040014void hw_watchdog_reset(void)
15{
16 bfin_write_WDOG_STAT(0);
17}
18
19void hw_watchdog_init(void)
20{
Sonic Zhange9a389a2013-04-07 18:02:37 +080021 bfin_write_WDOG_CTL(WDDIS);
22 SSYNC();
23 bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
Mike Frysinger9171fc82008-03-30 15:46:13 -040024 hw_watchdog_reset();
Sonic Zhange9a389a2013-04-07 18:02:37 +080025 bfin_write_WDOG_CTL(WDEN);
Mike Frysinger9171fc82008-03-30 15:46:13 -040026}