Lines Matching +full:timer +full:- +full:secure

1 // SPDX-License-Identifier: GPL-2.0
5 * Watchdog driver for the TI OMAP 16xx & 24xx/34xx 32KHz (non-secure) watchdog
15 * Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c
20 * 1. Modified to support OMAP1610 32-KHz watchdog timer
42 #include <linux/platform_data/omap-wd-timer.h>
73 void __iomem *base = wdev->base; in omap_wdt_reload()
79 wdev->wdt_trgr_pattern = ~wdev->wdt_trgr_pattern; in omap_wdt_reload()
80 writel_relaxed(wdev->wdt_trgr_pattern, (base + OMAP_WATCHDOG_TGR)); in omap_wdt_reload()
90 void __iomem *base = wdev->base; in omap_wdt_enable()
104 void __iomem *base = wdev->base; in omap_wdt_disable()
120 void __iomem *base = wdev->base; in omap_wdt_set_timer()
134 void __iomem *base = wdev->base; in omap_wdt_start()
136 mutex_lock(&wdev->lock); in omap_wdt_start()
138 wdev->omap_wdt_users = true; in omap_wdt_start()
140 pm_runtime_get_sync(wdev->dev); in omap_wdt_start()
157 omap_wdt_set_timer(wdev, wdog->timeout); in omap_wdt_start()
161 mutex_unlock(&wdev->lock); in omap_wdt_start()
170 mutex_lock(&wdev->lock); in omap_wdt_stop()
172 pm_runtime_put_sync(wdev->dev); in omap_wdt_stop()
173 wdev->omap_wdt_users = false; in omap_wdt_stop()
174 mutex_unlock(&wdev->lock); in omap_wdt_stop()
182 mutex_lock(&wdev->lock); in omap_wdt_ping()
184 mutex_unlock(&wdev->lock); in omap_wdt_ping()
194 mutex_lock(&wdev->lock); in omap_wdt_set_timeout()
199 wdog->timeout = timeout; in omap_wdt_set_timeout()
200 mutex_unlock(&wdev->lock); in omap_wdt_set_timeout()
208 void __iomem *base = wdev->base; in omap_wdt_get_timeleft()
231 struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev); in omap_wdt_probe()
235 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); in omap_wdt_probe()
237 return -ENOMEM; in omap_wdt_probe()
239 wdev->omap_wdt_users = false; in omap_wdt_probe()
240 wdev->dev = &pdev->dev; in omap_wdt_probe()
241 wdev->wdt_trgr_pattern = 0x1234; in omap_wdt_probe()
242 mutex_init(&wdev->lock); in omap_wdt_probe()
245 wdev->base = devm_platform_ioremap_resource(pdev, 0); in omap_wdt_probe()
246 if (IS_ERR(wdev->base)) in omap_wdt_probe()
247 return PTR_ERR(wdev->base); in omap_wdt_probe()
249 wdev->wdog.info = &omap_wdt_info; in omap_wdt_probe()
250 wdev->wdog.ops = &omap_wdt_ops; in omap_wdt_probe()
251 wdev->wdog.min_timeout = TIMER_MARGIN_MIN; in omap_wdt_probe()
252 wdev->wdog.max_timeout = TIMER_MARGIN_MAX; in omap_wdt_probe()
253 wdev->wdog.timeout = TIMER_MARGIN_DEFAULT; in omap_wdt_probe()
254 wdev->wdog.parent = &pdev->dev; in omap_wdt_probe()
256 watchdog_init_timeout(&wdev->wdog, timer_margin, &pdev->dev); in omap_wdt_probe()
258 watchdog_set_nowayout(&wdev->wdog, nowayout); in omap_wdt_probe()
262 pm_runtime_enable(wdev->dev); in omap_wdt_probe()
263 pm_runtime_get_sync(wdev->dev); in omap_wdt_probe()
265 if (pdata && pdata->read_reset_sources) { in omap_wdt_probe()
266 u32 rs = pdata->read_reset_sources(); in omap_wdt_probe()
268 wdev->wdog.bootstatus = WDIOF_CARDRESET; in omap_wdt_probe()
272 omap_wdt_start(&wdev->wdog); in omap_wdt_probe()
273 set_bit(WDOG_HW_RUNNING, &wdev->wdog.status); in omap_wdt_probe()
278 ret = watchdog_register_device(&wdev->wdog); in omap_wdt_probe()
280 pm_runtime_put(wdev->dev); in omap_wdt_probe()
281 pm_runtime_disable(wdev->dev); in omap_wdt_probe()
285 pr_info("OMAP Watchdog Timer Rev 0x%02x: initial timeout %d sec\n", in omap_wdt_probe()
286 readl_relaxed(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, in omap_wdt_probe()
287 wdev->wdog.timeout); in omap_wdt_probe()
290 omap_wdt_start(&wdev->wdog); in omap_wdt_probe()
292 pm_runtime_put(wdev->dev); in omap_wdt_probe()
301 mutex_lock(&wdev->lock); in omap_wdt_shutdown()
302 if (wdev->omap_wdt_users) { in omap_wdt_shutdown()
304 pm_runtime_put_sync(wdev->dev); in omap_wdt_shutdown()
306 mutex_unlock(&wdev->lock); in omap_wdt_shutdown()
313 pm_runtime_disable(wdev->dev); in omap_wdt_remove()
314 watchdog_unregister_device(&wdev->wdog); in omap_wdt_remove()
327 mutex_lock(&wdev->lock); in omap_wdt_suspend()
328 if (wdev->omap_wdt_users) { in omap_wdt_suspend()
330 pm_runtime_put_sync(wdev->dev); in omap_wdt_suspend()
332 mutex_unlock(&wdev->lock); in omap_wdt_suspend()
341 mutex_lock(&wdev->lock); in omap_wdt_resume()
342 if (wdev->omap_wdt_users) { in omap_wdt_resume()
343 pm_runtime_get_sync(wdev->dev); in omap_wdt_resume()
347 mutex_unlock(&wdev->lock); in omap_wdt_resume()
353 { .compatible = "ti,omap3-wdt", },
373 MODULE_DESCRIPTION("Driver for the TI OMAP 16xx/24xx/34xx 32KHz (non-secure) watchdog");