watchdog.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * (C) Copyright 2001
  3. * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * Watchdog functions and macros.
  25. */
  26. #ifndef _WATCHDOG_H_
  27. #define _WATCHDOG_H_
  28. #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
  29. # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
  30. #endif
  31. /*
  32. * Hardware watchdog
  33. */
  34. #ifdef CONFIG_HW_WATCHDOG
  35. #if defined(__ASSEMBLY__)
  36. #define WATCHDOG_RESET bl hw_watchdog_reset
  37. #else
  38. extern void hw_watchdog_reset(void);
  39. #define WATCHDOG_RESET hw_watchdog_reset
  40. #endif /* __ASSEMBLY__ */
  41. #else
  42. /*
  43. * Maybe a software watchdog?
  44. */
  45. #if defined(CONFIG_WATCHDOG)
  46. #if defined(__ASSEMBLY__)
  47. #define WATCHDOG_RESET bl watchdog_reset
  48. #else
  49. extern void watchdog_reset(void);
  50. #define WATCHDOG_RESET watchdog_reset
  51. #endif
  52. #else
  53. /*
  54. * No hardware or software watchdog.
  55. */
  56. #if defined(__ASSEMBLY__)
  57. #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
  58. #else
  59. #define WATCHDOG_RESET() {}
  60. #endif /* __ASSEMBLY__ */
  61. #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
  62. #endif /* CONFIG_HW_WATCHDOG */
  63. /*
  64. * Prototypes from $(CPU)/cpu.c.
  65. */
  66. /* MPC 8xx */
  67. #if (defined(CONFIG_8xx) || defined(CONFIG_MPC860)) && !defined(__ASSEMBLY__)
  68. void reset_8xx_watchdog(volatile immap_t *immr);
  69. #endif
  70. /* MPC 5xx */
  71. #if defined(CONFIG_5xx) && !defined(__ASSEMBLY__)
  72. void reset_5xx_watchdog(volatile immap_t *immr);
  73. #endif
  74. /* IBM 4xx */
  75. #if defined(CONFIG_4xx) && !defined(__ASSEMBLY__)
  76. void reset_4xx_watchdog(void);
  77. #endif
  78. /* MPC 8260 */
  79. #if defined(CONFIG_MPC8260) && !defined(__ASSEMBLY__)
  80. #if defined(CONFIG_WATCHDOG)
  81. extern __inline__ void
  82. reset_8260_watchdog(volatile immap_t *immr)
  83. {
  84. immr->im_siu_conf.sc_swsr = 0x556c;
  85. immr->im_siu_conf.sc_swsr = 0xaa39;
  86. }
  87. #endif /* !__ASSEMBLY__ && CONFIG_WATCHDOG */
  88. #endif /* CONFIG_MPC8260 && !__ASSEMBLY__ */
  89. #endif /* _WATCHDOG_H_ */