Lines Matching full:wdog

41 #define IMX2_WDT_WCR_WRE	BIT(3)		/* -> WDOG Reset Enable */
71 struct watchdog_device wdog; member
100 static int imx2_wdt_restart(struct watchdog_device *wdog, unsigned long action, in imx2_wdt_restart() argument
103 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_restart()
115 * Due to imx6q errata ERR004346 (WDOG: WDOG SRS bit requires to be in imx2_wdt_restart()
130 static inline void imx2_wdt_setup(struct watchdog_device *wdog) in imx2_wdt_setup() argument
132 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_setup()
144 /* Generate internal chip-level reset if WDOG times out */ in imx2_wdt_setup()
153 val |= WDOG_SEC_TO_COUNT(wdog->timeout); in imx2_wdt_setup()
171 static int imx2_wdt_ping(struct watchdog_device *wdog) in imx2_wdt_ping() argument
173 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_ping()
183 static void __imx2_wdt_set_timeout(struct watchdog_device *wdog, in __imx2_wdt_set_timeout() argument
186 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in __imx2_wdt_set_timeout()
192 static int imx2_wdt_set_timeout(struct watchdog_device *wdog, in imx2_wdt_set_timeout() argument
198 __imx2_wdt_set_timeout(wdog, actual); in imx2_wdt_set_timeout()
199 wdog->timeout = new_timeout; in imx2_wdt_set_timeout()
203 static int imx2_wdt_set_pretimeout(struct watchdog_device *wdog, in imx2_wdt_set_pretimeout() argument
206 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_set_pretimeout()
211 wdog->pretimeout = new_pretimeout; in imx2_wdt_set_pretimeout()
221 struct watchdog_device *wdog = wdog_arg; in imx2_wdt_isr() local
222 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_isr()
227 watchdog_notify_pretimeout(wdog); in imx2_wdt_isr()
232 static int imx2_wdt_start(struct watchdog_device *wdog) in imx2_wdt_start() argument
234 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_start()
237 imx2_wdt_set_timeout(wdog, wdog->timeout); in imx2_wdt_start()
239 imx2_wdt_setup(wdog); in imx2_wdt_start()
241 set_bit(WDOG_HW_RUNNING, &wdog->status); in imx2_wdt_start()
243 return imx2_wdt_ping(wdog); in imx2_wdt_start()
271 struct watchdog_device *wdog; in imx2_wdt_probe() local
297 wdog = &wdev->wdog; in imx2_wdt_probe()
298 wdog->info = &imx2_wdt_info; in imx2_wdt_probe()
299 wdog->ops = &imx2_wdt_ops; in imx2_wdt_probe()
300 wdog->min_timeout = 1; in imx2_wdt_probe()
301 wdog->timeout = IMX2_WDT_DEFAULT_TIME; in imx2_wdt_probe()
302 wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000; in imx2_wdt_probe()
303 wdog->parent = dev; in imx2_wdt_probe()
310 dev_name(dev), wdog)) in imx2_wdt_probe()
311 wdog->info = &imx2_wdt_pretimeout_info; in imx2_wdt_probe()
324 wdog->bootstatus = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0; in imx2_wdt_probe()
342 platform_set_drvdata(pdev, wdog); in imx2_wdt_probe()
343 watchdog_set_drvdata(wdog, wdev); in imx2_wdt_probe()
344 watchdog_set_nowayout(wdog, nowayout); in imx2_wdt_probe()
345 watchdog_set_restart_priority(wdog, 128); in imx2_wdt_probe()
346 watchdog_init_timeout(wdog, timeout, dev); in imx2_wdt_probe()
348 watchdog_stop_ping_on_suspend(wdog); in imx2_wdt_probe()
351 imx2_wdt_set_timeout(wdog, wdog->timeout); in imx2_wdt_probe()
352 set_bit(WDOG_HW_RUNNING, &wdog->status); in imx2_wdt_probe()
357 * down counter will pull down the #WDOG interrupt line for one clock in imx2_wdt_probe()
362 return devm_watchdog_register_device(dev, wdog); in imx2_wdt_probe()
367 struct watchdog_device *wdog = platform_get_drvdata(pdev); in imx2_wdt_shutdown() local
368 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_shutdown()
375 imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); in imx2_wdt_shutdown()
376 imx2_wdt_ping(wdog); in imx2_wdt_shutdown()
384 struct watchdog_device *wdog = dev_get_drvdata(dev); in imx2_wdt_suspend() local
385 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_suspend()
390 * Don't update wdog->timeout, we'll restore the current value in imx2_wdt_suspend()
393 __imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); in imx2_wdt_suspend()
394 imx2_wdt_ping(wdog); in imx2_wdt_suspend()
409 struct watchdog_device *wdog = dev_get_drvdata(dev); in imx2_wdt_resume() local
410 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_resume()
422 if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { in imx2_wdt_resume()
428 imx2_wdt_setup(wdog); in imx2_wdt_resume()
431 imx2_wdt_set_timeout(wdog, wdog->timeout); in imx2_wdt_resume()
432 imx2_wdt_ping(wdog); in imx2_wdt_resume()