]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/watchdog/bfin_wdt.c
Merge branch 'master' of git://git.denx.de/u-boot-video
[karo-tx-uboot.git] / drivers / watchdog / bfin_wdt.c
1 /*
2  * watchdog.c - driver for Blackfin on-chip watchdog
3  *
4  * Copyright (c) 2007-2009 Analog Devices Inc.
5  *
6  * Licensed under the GPL-2 or later.
7  */
8
9 #include <common.h>
10 #include <watchdog.h>
11 #include <asm/blackfin.h>
12 #include <asm/mach-common/bits/watchdog.h>
13
14 void hw_watchdog_reset(void)
15 {
16         bfin_write_WDOG_STAT(0);
17 }
18
19 void hw_watchdog_init(void)
20 {
21         bfin_write_WDOG_CTL(WDDIS);
22         SSYNC();
23         bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
24         hw_watchdog_reset();
25         bfin_write_WDOG_CTL(WDEN);
26 }