aboutsummaryrefslogtreecommitdiff
path: root/include/wdt.h
diff options
context:
space:
mode:
authorRasmus Villemoes2020-03-13 17:04:57 +0100
committerStefan Roese2020-04-15 08:53:55 +0200
commitb4d9452c442769e6dc25649ac02db2d5ed5ea0c8 (patch)
treea49a77dabe7d1f45fcc3abd30afcd594500ed81d /include/wdt.h
parent21a0bf7f466b8e71ce5ba2c2bcf635d7ab1fc83d (diff)
watchdog: move initr_watchdog() to wdt-uclass.c
This function is a bit large for an inline function, and for U-Boot proper, it is called via a function pointer anyway (in board_r.c), so cannot be inlined. It will shortly set a global variable to be used by the watchdog_reset() function in wdt-uclass.c, so this also allows making that variable local to wdt-uclass.c. The WATCHDOG_TIMEOUT_SECS define is not used elsewhere. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'include/wdt.h')
-rw-r--r--include/wdt.h34
1 files changed, 1 insertions, 33 deletions
diff --git a/include/wdt.h b/include/wdt.h
index 4cbb8de8cb5..aea5abc7680 100644
--- a/include/wdt.h
+++ b/include/wdt.h
@@ -106,38 +106,6 @@ struct wdt_ops {
int (*expire_now)(struct udevice *dev, ulong flags);
};
-#if CONFIG_IS_ENABLED(WDT)
-#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000)
-
-static inline int initr_watchdog(void)
-{
- u32 timeout = WATCHDOG_TIMEOUT_SECS;
-
- /*
- * Init watchdog: This will call the probe function of the
- * watchdog driver, enabling the use of the device
- */
- if (uclass_get_device_by_seq(UCLASS_WDT, 0,
- (struct udevice **)&gd->watchdog_dev)) {
- debug("WDT: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0,
- (struct udevice **)&gd->watchdog_dev)) {
- printf("WDT: Not found!\n");
- return 0;
- }
- }
-
- if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
- timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
- WATCHDOG_TIMEOUT_SECS);
- }
- wdt_start(gd->watchdog_dev, timeout * 1000, 0);
- gd->flags |= GD_FLG_WDT_READY;
- printf("WDT: Started with%s servicing (%ds timeout)\n",
- IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout);
-
- return 0;
-}
-#endif
+int initr_watchdog(void);
#endif /* _WDT_H_ */