X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fwdt.h;h=5026f5a6db48f0b9f8b3cce171306afb281dca9b;hb=a29491ade0adf3dbb9dc51be8b45530edde1f1df;hp=aa77d3e9b40368af889b67e81fa411d9c66d42e4;hpb=b4ee6daad7a2604ca9466b2ba48de86cc27d381f;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/wdt.h b/include/wdt.h index aa77d3e..5026f5a 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -6,8 +6,7 @@ #ifndef _WDT_H_ #define _WDT_H_ -#include -#include +struct udevice; /* * Implement a simple watchdog uclass. Watchdog is basically a timer that @@ -39,6 +38,14 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags); int wdt_stop(struct udevice *dev); /* + * Stop all registered watchdog devices. + * + * @return: 0 if ok, first error encountered otherwise (but wdt_stop() + * is still called on following devices) + */ +int wdt_stop_all(void); + +/* * Reset the timer, typically restoring the counter to * the value configured by start() * @@ -53,7 +60,7 @@ int wdt_reset(struct udevice *dev); * * @dev: WDT Device * @flags: Driver specific flags - * @return 0 if OK -ve on error. If wdt action is system reset, + * Return: 0 if OK -ve on error. If wdt action is system reset, * this function may never return. */ int wdt_expire_now(struct udevice *dev, ulong flags); @@ -106,42 +113,6 @@ struct wdt_ops { int (*expire_now)(struct udevice *dev, ulong flags); }; -#if defined(CONFIG_WDT) -#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS -#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000) -#endif -#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)) { - 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_ */