watchdog.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * (C) Copyright 2001
  3. * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. /*
  8. * Watchdog functions and macros.
  9. */
  10. #ifndef _WATCHDOG_H_
  11. #define _WATCHDOG_H_
  12. #if !defined(__ASSEMBLY__)
  13. /*
  14. * Reset the watchdog timer, always returns 0
  15. *
  16. * This function is here since it is shared between board_f() and board_r(),
  17. * and the legacy arch/<arch>/board.c code.
  18. */
  19. int init_func_watchdog_reset(void);
  20. #endif
  21. #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
  22. #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
  23. #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
  24. #else
  25. #define INIT_FUNC_WATCHDOG_INIT
  26. #define INIT_FUNC_WATCHDOG_RESET
  27. #endif
  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_MPC8xx) && !defined(__ASSEMBLY__)
  68. void reset_8xx_watchdog(immap_t __iomem *immr);
  69. #endif
  70. #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
  71. void hw_watchdog_init(void);
  72. #endif
  73. #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
  74. void init_85xx_watchdog(void);
  75. #endif
  76. #endif /* _WATCHDOG_H_ */