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__)
15 * Reset the watchdog timer, always returns 0
17 * This function is here since it is shared between board_f() and board_r(),
18 * and the legacy arch/<arch>/board.c code.
20 int init_func_watchdog_reset(void);
23 #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
24 #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
25 #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
27 #define INIT_FUNC_WATCHDOG_INIT
28 #define INIT_FUNC_WATCHDOG_RESET
31 #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
32 # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
38 #ifdef CONFIG_HW_WATCHDOG
39 #if defined(__ASSEMBLY__)
40 #define WATCHDOG_RESET bl hw_watchdog_reset
42 extern void hw_watchdog_reset(void);
44 #define WATCHDOG_RESET hw_watchdog_reset
45 #endif /* __ASSEMBLY__ */
48 * Maybe a software watchdog?
50 #if defined(CONFIG_WATCHDOG)
51 #if defined(__ASSEMBLY__)
52 #define WATCHDOG_RESET bl watchdog_reset
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() {}
59 extern void watchdog_reset(void);
61 #define WATCHDOG_RESET watchdog_reset
66 * No hardware or software watchdog.
68 #if defined(__ASSEMBLY__)
69 #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
71 #define WATCHDOG_RESET() {}
72 #endif /* __ASSEMBLY__ */
73 #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
74 #endif /* CONFIG_HW_WATCHDOG */
77 * Prototypes from $(CPU)/cpu.c.
80 #if (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)) && !defined(__ASSEMBLY__)
81 void hw_watchdog_init(void);
84 #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
85 void init_85xx_watchdog(void);
87 #endif /* _WATCHDOG_H_ */