]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/watchdog/bfin_wdt.c
ti: wdt: omap: Disable watchdog timer before performing initialization
[people/ms/u-boot.git] / drivers / watchdog / bfin_wdt.c
CommitLineData
9171fc81
MF
1/*
2 * watchdog.c - driver for Blackfin on-chip watchdog
3 *
313e8aac 4 * Copyright (c) 2007-2009 Analog Devices Inc.
9171fc81
MF
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <common.h>
10#include <watchdog.h>
11#include <asm/blackfin.h>
0519e80d 12#include <asm/clock.h>
e9a389a1 13#include <asm/mach-common/bits/watchdog.h>
9171fc81 14
9171fc81
MF
15void hw_watchdog_reset(void)
16{
17 bfin_write_WDOG_STAT(0);
18}
19
20void hw_watchdog_init(void)
21{
e9a389a1
SZ
22 bfin_write_WDOG_CTL(WDDIS);
23 SSYNC();
24 bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
9171fc81 25 hw_watchdog_reset();
e9a389a1 26 bfin_write_WDOG_CTL(WDEN);
9171fc81 27}