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 | |
Sonic Zhang | d54d7eb | 2014-07-17 19:01:34 +0800 | [diff] [blame] | 24 | #if defined(CONFIG_SYS_GENERIC_BOARD) && \ |
| 25 | (defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)) |
Simon Glass | a6741bc | 2013-03-05 14:39:42 +0000 | [diff] [blame] | 26 | #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init, |
| 27 | #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset, |
| 28 | #else |
| 29 | #define INIT_FUNC_WATCHDOG_INIT |
| 30 | #define INIT_FUNC_WATCHDOG_RESET |
| 31 | #endif |
| 32 | |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 33 | #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) |
| 34 | # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | * Hardware watchdog |
| 39 | */ |
| 40 | #ifdef CONFIG_HW_WATCHDOG |
| 41 | #if defined(__ASSEMBLY__) |
| 42 | #define WATCHDOG_RESET bl hw_watchdog_reset |
| 43 | #else |
| 44 | extern void hw_watchdog_reset(void); |
| 45 | |
| 46 | #define WATCHDOG_RESET hw_watchdog_reset |
| 47 | #endif /* __ASSEMBLY__ */ |
| 48 | #else |
| 49 | /* |
| 50 | * Maybe a software watchdog? |
| 51 | */ |
| 52 | #if defined(CONFIG_WATCHDOG) |
| 53 | #if defined(__ASSEMBLY__) |
| 54 | #define WATCHDOG_RESET bl watchdog_reset |
| 55 | #else |
| 56 | extern void watchdog_reset(void); |
| 57 | |
| 58 | #define WATCHDOG_RESET watchdog_reset |
| 59 | #endif |
| 60 | #else |
| 61 | /* |
| 62 | * No hardware or software watchdog. |
| 63 | */ |
| 64 | #if defined(__ASSEMBLY__) |
| 65 | #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/ |
| 66 | #else |
| 67 | #define WATCHDOG_RESET() {} |
| 68 | #endif /* __ASSEMBLY__ */ |
| 69 | #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */ |
| 70 | #endif /* CONFIG_HW_WATCHDOG */ |
| 71 | |
| 72 | /* |
| 73 | * Prototypes from $(CPU)/cpu.c. |
| 74 | */ |
| 75 | |
| 76 | /* MPC 8xx */ |
| 77 | #if (defined(CONFIG_8xx) || defined(CONFIG_MPC860)) && !defined(__ASSEMBLY__) |
| 78 | void reset_8xx_watchdog(volatile immap_t *immr); |
| 79 | #endif |
| 80 | |
wdenk | 0db5bca | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 81 | /* MPC 5xx */ |
| 82 | #if defined(CONFIG_5xx) && !defined(__ASSEMBLY__) |
| 83 | void reset_5xx_watchdog(volatile immap_t *immr); |
| 84 | #endif |
| 85 | |
Detlev Zundel | a21fb98 | 2010-01-20 14:28:48 +0100 | [diff] [blame] | 86 | /* MPC 5xxx */ |
| 87 | #if defined(CONFIG_MPC5xxx) && !defined(__ASSEMBLY__) |
| 88 | void reset_5xxx_watchdog(void); |
| 89 | #endif |
| 90 | |
Wolfgang Denk | 0c8721a | 2005-09-23 11:05:55 +0200 | [diff] [blame] | 91 | /* AMCC 4xx */ |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 92 | #if defined(CONFIG_4xx) && !defined(__ASSEMBLY__) |
| 93 | void reset_4xx_watchdog(void); |
| 94 | #endif |
| 95 | |
Sonic Zhang | e9a389a | 2013-04-07 18:02:37 +0800 | [diff] [blame] | 96 | #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__) |
Tom Rini | a672076 | 2013-01-14 13:10:07 -0700 | [diff] [blame] | 97 | void hw_watchdog_init(void); |
| 98 | #endif |
Boschung, Rainer | 0f8062b | 2014-06-03 09:05:14 +0200 | [diff] [blame] | 99 | |
| 100 | #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__) |
| 101 | void init_85xx_watchdog(void); |
| 102 | #endif |
wdenk | 012771d | 2002-03-08 21:31:05 +0000 | [diff] [blame] | 103 | #endif /* _WATCHDOG_H_ */ |