Lines Matching refs:wdev
103 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_restart() local
107 if (wdev->ext_reset) in imx2_wdt_restart()
113 regmap_write(wdev->regmap, IMX2_WDT_WCR, wcr_enable); in imx2_wdt_restart()
121 regmap_write(wdev->regmap, IMX2_WDT_WCR, wcr_enable); in imx2_wdt_restart()
122 regmap_write(wdev->regmap, IMX2_WDT_WCR, wcr_enable); in imx2_wdt_restart()
132 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_setup() local
135 regmap_read(wdev->regmap, IMX2_WDT_WCR, &val); in imx2_wdt_setup()
140 if (wdev->sleep_wait) in imx2_wdt_setup()
145 if (!wdev->ext_reset) in imx2_wdt_setup()
155 regmap_write(wdev->regmap, IMX2_WDT_WCR, val); in imx2_wdt_setup()
159 regmap_write(wdev->regmap, IMX2_WDT_WCR, val); in imx2_wdt_setup()
162 static inline bool imx2_wdt_is_running(struct imx2_wdt_device *wdev) in imx2_wdt_is_running() argument
166 regmap_read(wdev->regmap, IMX2_WDT_WCR, &val); in imx2_wdt_is_running()
173 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_ping() local
175 if (!wdev->clk_is_on) in imx2_wdt_ping()
178 regmap_write(wdev->regmap, IMX2_WDT_WSR, IMX2_WDT_SEQ1); in imx2_wdt_ping()
179 regmap_write(wdev->regmap, IMX2_WDT_WSR, IMX2_WDT_SEQ2); in imx2_wdt_ping()
186 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in __imx2_wdt_set_timeout() local
188 regmap_update_bits(wdev->regmap, IMX2_WDT_WCR, IMX2_WDT_WCR_WT, in __imx2_wdt_set_timeout()
206 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_set_pretimeout() local
213 regmap_update_bits(wdev->regmap, IMX2_WDT_WICR, in imx2_wdt_set_pretimeout()
222 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_isr() local
224 regmap_write_bits(wdev->regmap, IMX2_WDT_WICR, in imx2_wdt_isr()
234 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_start() local
236 if (imx2_wdt_is_running(wdev)) in imx2_wdt_start()
270 struct imx2_wdt_device *wdev; in imx2_wdt_probe() local
276 wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL); in imx2_wdt_probe()
277 if (!wdev) in imx2_wdt_probe()
284 wdev->regmap = devm_regmap_init_mmio_clk(dev, NULL, base, in imx2_wdt_probe()
286 if (IS_ERR(wdev->regmap)) { in imx2_wdt_probe()
288 return PTR_ERR(wdev->regmap); in imx2_wdt_probe()
291 wdev->clk = devm_clk_get(dev, NULL); in imx2_wdt_probe()
292 if (IS_ERR(wdev->clk)) { in imx2_wdt_probe()
294 return PTR_ERR(wdev->clk); in imx2_wdt_probe()
297 wdog = &wdev->wdog; in imx2_wdt_probe()
305 wdev->data = of_device_get_match_data(dev); in imx2_wdt_probe()
313 ret = clk_prepare_enable(wdev->clk); in imx2_wdt_probe()
317 ret = devm_add_action_or_reset(dev, imx2_wdt_action, wdev->clk); in imx2_wdt_probe()
321 wdev->clk_is_on = true; in imx2_wdt_probe()
323 regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val); in imx2_wdt_probe()
326 wdev->ext_reset = of_property_read_bool(dev->of_node, in imx2_wdt_probe()
330 if (!wdev->data->wdw_supported) { in imx2_wdt_probe()
334 wdev->sleep_wait = true; in imx2_wdt_probe()
341 wdev->no_ping = !of_device_is_compatible(dev->of_node, "fsl,imx7d-wdt"); in imx2_wdt_probe()
343 watchdog_set_drvdata(wdog, wdev); in imx2_wdt_probe()
347 if (wdev->no_ping) in imx2_wdt_probe()
350 if (imx2_wdt_is_running(wdev)) { in imx2_wdt_probe()
360 regmap_write(wdev->regmap, IMX2_WDT_WMCR, 0); in imx2_wdt_probe()
368 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_shutdown() local
370 if (imx2_wdt_is_running(wdev)) { in imx2_wdt_shutdown()
385 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_suspend() local
388 if (imx2_wdt_is_running(wdev)) { in imx2_wdt_suspend()
397 if (wdev->no_ping) { in imx2_wdt_suspend()
398 clk_disable_unprepare(wdev->clk); in imx2_wdt_suspend()
400 wdev->clk_is_on = false; in imx2_wdt_suspend()
410 struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); in imx2_wdt_resume() local
413 if (wdev->no_ping) { in imx2_wdt_resume()
414 ret = clk_prepare_enable(wdev->clk); in imx2_wdt_resume()
419 wdev->clk_is_on = true; in imx2_wdt_resume()
422 if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { in imx2_wdt_resume()
430 if (imx2_wdt_is_running(wdev)) { in imx2_wdt_resume()