wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. |
| 4 | * |
Wolfgang Denk | 3765b3e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * Watchdog functions and macros. |
| 10 | */ |
| 11 | #ifndef _WATCHDOG_H_ |
| 12 | #define _WATCHDOG_H_ |
| 13 | |
Simon Glass | a6741bc | 2013-03-05 14:39:42 +0000 | [diff] [blame] | 14 | #if !defined(__ASSEMBLY__) |
| 15 | /* |
| 16 | * Reset the watchdog timer, always returns 0 |
| 17 | * |
| 18 | * This function is here since it is shared between board_f() and board_r(), |
| 19 | * and the legacy arch/<arch>/board.c code. |
| 20 | */ |
| 21 | int init_func_watchdog_reset(void); |
| 22 | #endif |
| 23 | |
Simon Glass | 9be2e79 | 2016-05-14 18:49:35 -0600 | [diff] [blame] | 24 | #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) |
Simon Glass | a6741bc | 2013-03-05 14:39:42 +0000 | [diff] [blame] | 25 | #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init, |
| 26 | #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset, |
| 27 | #else |
| 28 | #define INIT_FUNC_WATCHDOG_INIT |
| 29 | #define INIT_FUNC_WATCHDOG_RESET |
| 30 | #endif |
| 31 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 32 | #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) |
| 33 | # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." |
| 34 | #endif |
| 35 | |
| 36 | /* |
| 37 | * Hardware watchdog |
| 38 | */ |
| 39 | #ifdef CONFIG_HW_WATCHDOG |
| 40 | #if defined(__ASSEMBLY__) |
| 41 | #define WATCHDOG_RESET bl hw_watchdog_reset |
| 42 | #else |
| 43 | extern void hw_watchdog_reset(void); |
| 44 | |
| 45 | #define WATCHDOG_RESET hw_watchdog_reset |
| 46 | #endif /* __ASSEMBLY__ */ |
| 47 | #else |
| 48 | /* |
| 49 | * Maybe a software watchdog? |
| 50 | */ |
| 51 | #if defined(CONFIG_WATCHDOG) |
| 52 | #if defined(__ASSEMBLY__) |
| 53 | #define WATCHDOG_RESET bl watchdog_reset |
| 54 | #else |
| 55 | extern void watchdog_reset(void); |
| 56 | |
| 57 | #define WATCHDOG_RESET watchdog_reset |
| 58 | #endif |
| 59 | #else |
| 60 | /* |
| 61 | * No hardware or software watchdog. |
| 62 | */ |
| 63 | #if defined(__ASSEMBLY__) |
| 64 | #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/ |
| 65 | #else |
| 66 | #define WATCHDOG_RESET() {} |
| 67 | #endif /* __ASSEMBLY__ */ |
| 68 | #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */ |
| 69 | #endif /* CONFIG_HW_WATCHDOG */ |
| 70 | |
| 71 | /* |
| 72 | * Prototypes from $(CPU)/cpu.c. |
| 73 | */ |
| 74 | |
Christophe Leroy | 907208c | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 75 | /* MPC 8xx */ |
| 76 | #if defined(CONFIG_8xx) && !defined(__ASSEMBLY__) |
Christophe Leroy | ba3da73 | 2017-07-06 10:33:13 +0200 | [diff] [blame] | 77 | void reset_8xx_watchdog(immap_t __iomem *immr); |
Christophe Leroy | 907208c | 2017-07-06 10:23:22 +0200 | [diff] [blame] | 78 | #endif |
| 79 | |
Sonic Zhang | e9a389a | 2013-04-07 18:02:37 +0800 | [diff] [blame] | 80 | #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__) |
Tom Rini | a672076 | 2013-01-14 13:10:07 -0700 | [diff] [blame] | 81 | void hw_watchdog_init(void); |
| 82 | #endif |
Boschung, Rainer | 0f8062b | 2014-06-03 09:05:14 +0200 | [diff] [blame] | 83 | |
| 84 | #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__) |
| 85 | void init_85xx_watchdog(void); |
| 86 | #endif |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 87 | #endif /* _WATCHDOG_H_ */ |