watchdog.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2001
  4. * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
  5. */
  6. /*
  7. * Watchdog functions and macros.
  8. */
  9. #ifndef _WATCHDOG_H_
  10. #define _WATCHDOG_H_
  11. #if !defined(__ASSEMBLY__)
  12. /*
  13. * Reset the watchdog timer, always returns 0
  14. *
  15. * This function is here since it is shared between board_f() and board_r(),
  16. * and the legacy arch/<arch>/board.c code.
  17. */
  18. int init_func_watchdog_reset(void);
  19. #endif
  20. #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
  21. #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
  22. #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
  23. #else
  24. #define INIT_FUNC_WATCHDOG_INIT
  25. #define INIT_FUNC_WATCHDOG_RESET
  26. #endif
  27. #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
  28. # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
  29. #endif
  30. /*
  31. * Hardware watchdog
  32. */
  33. #ifdef CONFIG_HW_WATCHDOG
  34. #if defined(__ASSEMBLY__)
  35. #define WATCHDOG_RESET bl hw_watchdog_reset
  36. #else
  37. extern void hw_watchdog_reset(void);
  38. #define WATCHDOG_RESET hw_watchdog_reset
  39. #endif /* __ASSEMBLY__ */
  40. #else
  41. /*
  42. * Maybe a software watchdog?
  43. */
  44. #if defined(CONFIG_WATCHDOG)
  45. #if defined(__ASSEMBLY__)
  46. #define WATCHDOG_RESET bl watchdog_reset
  47. #else
  48. /* Don't require the watchdog to be enabled in SPL */
  49. #if defined(CONFIG_SPL_BUILD) && \
  50. !defined(CONFIG_SPL_WATCHDOG_SUPPORT)
  51. #define WATCHDOG_RESET() {}
  52. #else
  53. extern void watchdog_reset(void);
  54. #define WATCHDOG_RESET watchdog_reset
  55. #endif
  56. #endif
  57. #else
  58. /*
  59. * No hardware or software watchdog.
  60. */
  61. #if defined(__ASSEMBLY__)
  62. #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
  63. #else
  64. #define WATCHDOG_RESET() {}
  65. #endif /* __ASSEMBLY__ */
  66. #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
  67. #endif /* CONFIG_HW_WATCHDOG */
  68. /*
  69. * Prototypes from $(CPU)/cpu.c.
  70. */
  71. #if (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)) && !defined(__ASSEMBLY__)
  72. void hw_watchdog_init(void);
  73. #endif
  74. #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
  75. void init_85xx_watchdog(void);
  76. #endif
  77. #endif /* _WATCHDOG_H_ */