Lines Matching full:wdt

54 static void __iomem *wdt_addr(struct qcom_wdt *wdt, enum wdt_reg reg)  in wdt_addr()  argument
56 return wdt->base + wdt->layout[reg]; in wdt_addr()
76 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_start() local
79 writel(0, wdt_addr(wdt, WDT_EN)); in qcom_wdt_start()
80 writel(1, wdt_addr(wdt, WDT_RST)); in qcom_wdt_start()
81 writel(bark * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME)); in qcom_wdt_start()
82 writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME)); in qcom_wdt_start()
83 writel(QCOM_WDT_ENABLE, wdt_addr(wdt, WDT_EN)); in qcom_wdt_start()
89 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_stop() local
91 writel(0, wdt_addr(wdt, WDT_EN)); in qcom_wdt_stop()
97 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_ping() local
99 writel(1, wdt_addr(wdt, WDT_RST)); in qcom_wdt_ping()
120 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_restart() local
125 * Setup BITE_TIME to be 128ms, and enable WDT. in qcom_wdt_restart()
127 timeout = 128 * wdt->rate / 1000; in qcom_wdt_restart()
129 writel(0, wdt_addr(wdt, WDT_EN)); in qcom_wdt_restart()
130 writel(1, wdt_addr(wdt, WDT_RST)); in qcom_wdt_restart()
131 writel(timeout, wdt_addr(wdt, WDT_BARK_TIME)); in qcom_wdt_restart()
132 writel(timeout, wdt_addr(wdt, WDT_BITE_TIME)); in qcom_wdt_restart()
133 writel(QCOM_WDT_ENABLE, wdt_addr(wdt, WDT_EN)); in qcom_wdt_restart()
146 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_is_running() local
148 return (readl(wdt_addr(wdt, WDT_EN)) & QCOM_WDT_ENABLE); in qcom_wdt_is_running()
193 struct qcom_wdt *wdt; in qcom_wdt_probe() local
203 dev_err(dev, "Unsupported QCOM WDT module\n"); in qcom_wdt_probe()
207 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in qcom_wdt_probe()
208 if (!wdt) in qcom_wdt_probe()
222 wdt->base = devm_ioremap_resource(dev, res); in qcom_wdt_probe()
223 if (IS_ERR(wdt->base)) in qcom_wdt_probe()
224 return PTR_ERR(wdt->base); in qcom_wdt_probe()
236 * WATCHDOG_CORE assumes units of seconds, if the WDT is clocked such in qcom_wdt_probe()
240 wdt->rate = clk_get_rate(clk); in qcom_wdt_probe()
241 if (wdt->rate == 0 || in qcom_wdt_probe()
242 wdt->rate > data->max_tick_count) { in qcom_wdt_probe()
251 "wdt_bark", &wdt->wdd); in qcom_wdt_probe()
255 wdt->wdd.info = &qcom_wdt_pt_info; in qcom_wdt_probe()
256 wdt->wdd.pretimeout = 1; in qcom_wdt_probe()
261 wdt->wdd.info = &qcom_wdt_info; in qcom_wdt_probe()
264 wdt->wdd.ops = &qcom_wdt_ops; in qcom_wdt_probe()
265 wdt->wdd.min_timeout = 1; in qcom_wdt_probe()
266 wdt->wdd.max_timeout = data->max_tick_count / wdt->rate; in qcom_wdt_probe()
267 wdt->wdd.parent = dev; in qcom_wdt_probe()
268 wdt->layout = data->offset; in qcom_wdt_probe()
270 if (readl(wdt_addr(wdt, WDT_STS)) & 1) in qcom_wdt_probe()
271 wdt->wdd.bootstatus = WDIOF_CARDRESET; in qcom_wdt_probe()
278 wdt->wdd.timeout = min(wdt->wdd.max_timeout, 30U); in qcom_wdt_probe()
279 watchdog_init_timeout(&wdt->wdd, 0, dev); in qcom_wdt_probe()
282 * If WDT is already running, call WDT start which in qcom_wdt_probe()
283 * will stop the WDT, set timeouts as bootloader in qcom_wdt_probe()
285 * to inform the WDT subsystem to ping the WDT in qcom_wdt_probe()
287 if (qcom_wdt_is_running(&wdt->wdd)) { in qcom_wdt_probe()
288 qcom_wdt_start(&wdt->wdd); in qcom_wdt_probe()
289 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in qcom_wdt_probe()
292 ret = devm_watchdog_register_device(dev, &wdt->wdd); in qcom_wdt_probe()
296 platform_set_drvdata(pdev, wdt); in qcom_wdt_probe()
302 struct qcom_wdt *wdt = dev_get_drvdata(dev); in qcom_wdt_suspend() local
304 if (watchdog_active(&wdt->wdd)) in qcom_wdt_suspend()
305 qcom_wdt_stop(&wdt->wdd); in qcom_wdt_suspend()
312 struct qcom_wdt *wdt = dev_get_drvdata(dev); in qcom_wdt_resume() local
314 if (watchdog_active(&wdt->wdd)) in qcom_wdt_resume()
315 qcom_wdt_start(&wdt->wdd); in qcom_wdt_resume()
327 { .compatible = "qcom,kpss-wdt", .data = &match_data_kpss },