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