Lines Matching full:wdt

53 static void __iomem *wdt_addr(struct qcom_wdt *wdt, enum wdt_reg reg)  in wdt_addr()  argument
55 return wdt->base + wdt->layout[reg]; in wdt_addr()
75 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_start() local
78 writel(0, wdt_addr(wdt, WDT_EN)); in qcom_wdt_start()
79 writel(1, wdt_addr(wdt, WDT_RST)); in qcom_wdt_start()
80 writel(bark * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME)); in qcom_wdt_start()
81 writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME)); in qcom_wdt_start()
82 writel(QCOM_WDT_ENABLE, wdt_addr(wdt, WDT_EN)); in qcom_wdt_start()
88 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_stop() local
90 writel(0, wdt_addr(wdt, WDT_EN)); in qcom_wdt_stop()
96 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_ping() local
98 writel(1, wdt_addr(wdt, WDT_RST)); in qcom_wdt_ping()
119 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_restart() local
124 * Setup BITE_TIME to be 128ms, and enable WDT. in qcom_wdt_restart()
126 timeout = 128 * wdt->rate / 1000; in qcom_wdt_restart()
128 writel(0, wdt_addr(wdt, WDT_EN)); in qcom_wdt_restart()
129 writel(1, wdt_addr(wdt, WDT_RST)); in qcom_wdt_restart()
130 writel(timeout, wdt_addr(wdt, WDT_BARK_TIME)); in qcom_wdt_restart()
131 writel(timeout, wdt_addr(wdt, WDT_BITE_TIME)); in qcom_wdt_restart()
132 writel(QCOM_WDT_ENABLE, wdt_addr(wdt, WDT_EN)); in qcom_wdt_restart()
145 struct qcom_wdt *wdt = to_qcom_wdt(wdd); in qcom_wdt_is_running() local
147 return (readl(wdt_addr(wdt, WDT_EN)) & QCOM_WDT_ENABLE); in qcom_wdt_is_running()
190 struct qcom_wdt *wdt; in qcom_wdt_probe() local
200 dev_err(dev, "Unsupported QCOM WDT module\n"); in qcom_wdt_probe()
204 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in qcom_wdt_probe()
205 if (!wdt) in qcom_wdt_probe()
219 wdt->base = devm_ioremap_resource(dev, res); in qcom_wdt_probe()
220 if (IS_ERR(wdt->base)) in qcom_wdt_probe()
221 return PTR_ERR(wdt->base); in qcom_wdt_probe()
233 * WATCHDOG_CORE assumes units of seconds, if the WDT is clocked such in qcom_wdt_probe()
237 wdt->rate = clk_get_rate(clk); in qcom_wdt_probe()
238 if (wdt->rate == 0 || in qcom_wdt_probe()
239 wdt->rate > 0x10000000U) { in qcom_wdt_probe()
248 "wdt_bark", &wdt->wdd); in qcom_wdt_probe()
252 wdt->wdd.info = &qcom_wdt_pt_info; in qcom_wdt_probe()
253 wdt->wdd.pretimeout = 1; in qcom_wdt_probe()
258 wdt->wdd.info = &qcom_wdt_info; in qcom_wdt_probe()
261 wdt->wdd.ops = &qcom_wdt_ops; in qcom_wdt_probe()
262 wdt->wdd.min_timeout = 1; in qcom_wdt_probe()
263 wdt->wdd.max_timeout = 0x10000000U / wdt->rate; in qcom_wdt_probe()
264 wdt->wdd.parent = dev; in qcom_wdt_probe()
265 wdt->layout = data->offset; in qcom_wdt_probe()
267 if (readl(wdt_addr(wdt, WDT_STS)) & 1) in qcom_wdt_probe()
268 wdt->wdd.bootstatus = WDIOF_CARDRESET; in qcom_wdt_probe()
275 wdt->wdd.timeout = min(wdt->wdd.max_timeout, 30U); in qcom_wdt_probe()
276 watchdog_init_timeout(&wdt->wdd, 0, dev); in qcom_wdt_probe()
279 * If WDT is already running, call WDT start which in qcom_wdt_probe()
280 * will stop the WDT, set timeouts as bootloader in qcom_wdt_probe()
282 * to inform the WDT subsystem to ping the WDT in qcom_wdt_probe()
284 if (qcom_wdt_is_running(&wdt->wdd)) { in qcom_wdt_probe()
285 qcom_wdt_start(&wdt->wdd); in qcom_wdt_probe()
286 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in qcom_wdt_probe()
289 ret = devm_watchdog_register_device(dev, &wdt->wdd); in qcom_wdt_probe()
293 platform_set_drvdata(pdev, wdt); in qcom_wdt_probe()
299 struct qcom_wdt *wdt = dev_get_drvdata(dev); in qcom_wdt_suspend() local
301 if (watchdog_active(&wdt->wdd)) in qcom_wdt_suspend()
302 qcom_wdt_stop(&wdt->wdd); in qcom_wdt_suspend()
309 struct qcom_wdt *wdt = dev_get_drvdata(dev); in qcom_wdt_resume() local
311 if (watchdog_active(&wdt->wdd)) in qcom_wdt_resume()
312 qcom_wdt_start(&wdt->wdd); in qcom_wdt_resume()
324 { .compatible = "qcom,kpss-wdt", .data = &match_data_kpss },