1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
8 * Watchdog functions and macros.
13 #if !defined(__ASSEMBLY__)
17 * Reset the watchdog timer, always returns 0
19 * This function is here since it is shared between board_f() and board_r(),
20 * and the legacy arch/<arch>/board.c code.
22 int init_func_watchdog_reset(void);
25 #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
26 #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
27 #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
29 #define INIT_FUNC_WATCHDOG_INIT
30 #define INIT_FUNC_WATCHDOG_RESET
33 #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
34 # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
40 #ifdef CONFIG_HW_WATCHDOG
41 #if defined(__ASSEMBLY__)
42 #define WATCHDOG_RESET bl hw_watchdog_reset
44 extern void hw_watchdog_reset(void);
46 #define WATCHDOG_RESET hw_watchdog_reset
47 #endif /* __ASSEMBLY__ */
50 * Maybe a software watchdog?
52 #if defined(CONFIG_WATCHDOG)
53 #if defined(__ASSEMBLY__)
54 /* Don't require the watchdog to be enabled in SPL */
55 #if defined(CONFIG_SPL_BUILD) && \
56 !defined(CONFIG_SPL_WATCHDOG)
57 #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
59 #define WATCHDOG_RESET bl watchdog_reset
62 /* Don't require the watchdog to be enabled in SPL */
63 #if defined(CONFIG_SPL_BUILD) && \
64 !defined(CONFIG_SPL_WATCHDOG)
65 #define WATCHDOG_RESET() { \
69 extern void watchdog_reset(void);
71 #define WATCHDOG_RESET() { \
79 * No hardware or software watchdog.
81 #if defined(__ASSEMBLY__)
82 #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
84 #define WATCHDOG_RESET() { \
87 #endif /* __ASSEMBLY__ */
88 #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
89 #endif /* CONFIG_HW_WATCHDOG */
91 #if !defined(__ASSEMBLY__)
92 /* Currently only needed for fs/cramfs/uncompress.c */
93 static inline void watchdog_reset_func(void)
100 * Prototypes from $(CPU)/cpu.c.
103 #if (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)) && !defined(__ASSEMBLY__)
104 void hw_watchdog_init(void);
107 #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
108 void init_85xx_watchdog(void);
110 #endif /* _WATCHDOG_H_ */