blob: 14073cfdd2fc7e06760b04e2642c763e95e879d1 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenk012771d2002-03-08 21:31:05 +00002/*
3 * (C) Copyright 2001
4 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
wdenk012771d2002-03-08 21:31:05 +00005 */
6
7/*
8 * Watchdog functions and macros.
9 */
10#ifndef _WATCHDOG_H_
11#define _WATCHDOG_H_
12
Simon Glassa6741bc2013-03-05 14:39:42 +000013#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 */
20int init_func_watchdog_reset(void);
21#endif
22
Simon Glass9be2e792016-05-14 18:49:35 -060023#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
Simon Glassa6741bc2013-03-05 14:39:42 +000024#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
wdenk012771d2002-03-08 21:31:05 +000031#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 #define WATCHDOG_RESET bl watchdog_reset
53 #else
54 extern void watchdog_reset(void);
55
56 #define WATCHDOG_RESET watchdog_reset
57 #endif
58 #else
59 /*
60 * No hardware or software watchdog.
61 */
62 #if defined(__ASSEMBLY__)
63 #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
64 #else
65 #define WATCHDOG_RESET() {}
66 #endif /* __ASSEMBLY__ */
67 #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
68#endif /* CONFIG_HW_WATCHDOG */
69
70/*
71 * Prototypes from $(CPU)/cpu.c.
72 */
73
Sonic Zhange9a389a2013-04-07 18:02:37 +080074#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
Tom Rinia6720762013-01-14 13:10:07 -070075 void hw_watchdog_init(void);
76#endif
Boschung, Rainer0f8062b2014-06-03 09:05:14 +020077
78#if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
79 void init_85xx_watchdog(void);
80#endif
wdenk012771d2002-03-08 21:31:05 +000081#endif /* _WATCHDOG_H_ */