watchdog-reset.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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/clock.h>
  13. #include <plat/regs-watchdog.h>
  14. #include <mach/map.h>
  15. #include <linux/clk.h>
  16. #include <linux/err.h>
  17. #include <linux/io.h>
  18. #include <linux/delay.h>
  19. static inline void arch_wdt_reset(void)
  20. {
  21. printk("arch_reset: attempting watchdog reset\n");
  22. __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
  23. if (!IS_ERR(s3c2410_wdtclk))
  24. clk_enable(s3c2410_wdtclk);
  25. /* put initial values into count and data */
  26. __raw_writel(0x80, S3C2410_WTCNT);
  27. __raw_writel(0x80, S3C2410_WTDAT);
  28. /* set the watchdog to go and reset... */
  29. __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
  30. S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
  31. /* wait for reset to assert... */
  32. mdelay(500);
  33. printk(KERN_ERR "Watchdog reset failed to assert reset\n");
  34. /* delay to allow the serial port to show the message */
  35. mdelay(50);
  36. }