bfin_wdt.c 541 B

123456789101112131415161718192021222324252627
  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. #include <common.h>
  9. #include <watchdog.h>
  10. #include <asm/blackfin.h>
  11. #include <asm/clock.h>
  12. #include <asm/mach-common/bits/watchdog.h>
  13. void hw_watchdog_reset(void)
  14. {
  15. bfin_write_WDOG_STAT(0);
  16. }
  17. void hw_watchdog_init(void)
  18. {
  19. bfin_write_WDOG_CTL(WDDIS);
  20. SSYNC();
  21. bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk());
  22. hw_watchdog_reset();
  23. bfin_write_WDOG_CTL(WDEN);
  24. }