watchdog-reset.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* arch/arm/plat-s3c/include/plat/watchdog-reset.h
  2. *
  3. * Copyright (c) 2008 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 - System define for arch_reset() function
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <plat/regs-watchdog.h>
  13. #include <mach/map.h>
  14. #include <linux/clk.h>
  15. #include <linux/err.h>
  16. #include <linux/io.h>
  17. static inline void arch_wdt_reset(void)
  18. {
  19. struct clk *wdtclk;
  20. printk("arch_reset: attempting watchdog reset\n");
  21. __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
  22. wdtclk = clk_get(NULL, "watchdog");
  23. if (!IS_ERR(wdtclk)) {
  24. clk_enable(wdtclk);
  25. } else
  26. printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
  27. /* put initial values into count and data */
  28. __raw_writel(0x80, S3C2410_WTCNT);
  29. __raw_writel(0x80, S3C2410_WTDAT);
  30. /* set the watchdog to go and reset... */
  31. __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
  32. S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
  33. /* wait for reset to assert... */
  34. mdelay(500);
  35. printk(KERN_ERR "Watchdog reset failed to assert reset\n");
  36. /* delay to allow the serial port to show the message */
  37. mdelay(50);
  38. }