Lines Matching +full:rate +full:- +full:np +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
49 unsigned long rate; member
56 return wdt->base + wdt->layout[reg]; in wdt_addr()
77 unsigned int bark = wdd->timeout - wdd->pretimeout; 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()
106 wdd->timeout = timeout; in qcom_wdt_set_timeout()
113 wdd->pretimeout = timeout; in qcom_wdt_set_pretimeout()
125 * Setup BITE_TIME to be 128ms, and enable WDT. in qcom_wdt_restart()
127 timeout = 128 * wdt->rate / 1000; in qcom_wdt_restart()
192 struct device *dev = &pdev->dev; in qcom_wdt_probe()
195 struct device_node *np = dev->of_node; in qcom_wdt_probe() local
204 return -ENODEV; in qcom_wdt_probe()
209 return -ENOMEM; in qcom_wdt_probe()
213 return -ENOMEM; in qcom_wdt_probe()
216 if (of_property_read_u32(np, "cpu-offset", &percpu_offset)) in qcom_wdt_probe()
219 res->start += percpu_offset; in qcom_wdt_probe()
220 res->end += percpu_offset; 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()
233 * We use the clock rate to calculate the max timeout, so ensure it's in qcom_wdt_probe()
234 * not zero to avoid a divide-by-zero exception. 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()
243 dev_err(dev, "invalid clock rate\n"); in qcom_wdt_probe()
244 return -EINVAL; in qcom_wdt_probe()
249 if (data->pretimeout && irq > 0) { 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()
258 if (irq == -EPROBE_DEFER) in qcom_wdt_probe()
259 return -EPROBE_DEFER; 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()
271 wdt->wdd.bootstatus = WDIOF_CARDRESET; in qcom_wdt_probe()
274 * If 'timeout-sec' unspecified in devicetree, assume a 30 second 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()
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()
304 if (watchdog_active(&wdt->wdd)) in qcom_wdt_suspend()
305 qcom_wdt_stop(&wdt->wdd); in qcom_wdt_suspend()
314 if (watchdog_active(&wdt->wdd)) in qcom_wdt_resume()
315 qcom_wdt_start(&wdt->wdd); in qcom_wdt_resume()
325 { .compatible = "qcom,kpss-timer", .data = &match_data_apcs_tmr },
326 { .compatible = "qcom,scss-timer", .data = &match_data_apcs_tmr },
327 { .compatible = "qcom,kpss-wdt", .data = &match_data_kpss },