Lines Matching +full:wdt +full:- +full:interval

1 // SPDX-License-Identifier: GPL-2.0
21 #define NPCM_WTIS (BIT(4) | BIT(5)) /* Interval selection */
57 struct npcm_wdt *wdt = to_npcm_wdt(wdd); in npcm_wdt_ping() local
60 val = readl(wdt->reg); in npcm_wdt_ping()
61 writel(val | NPCM_WTR, wdt->reg); in npcm_wdt_ping()
68 struct npcm_wdt *wdt = to_npcm_wdt(wdd); in npcm_wdt_start() local
71 if (wdt->clk) in npcm_wdt_start()
72 clk_prepare_enable(wdt->clk); in npcm_wdt_start()
74 if (wdd->timeout < 2) in npcm_wdt_start()
76 else if (wdd->timeout < 3) in npcm_wdt_start()
78 else if (wdd->timeout < 6) in npcm_wdt_start()
80 else if (wdd->timeout < 11) in npcm_wdt_start()
82 else if (wdd->timeout < 22) in npcm_wdt_start()
84 else if (wdd->timeout < 44) in npcm_wdt_start()
86 else if (wdd->timeout < 87) in npcm_wdt_start()
88 else if (wdd->timeout < 173) in npcm_wdt_start()
90 else if (wdd->timeout < 688) in npcm_wdt_start()
97 writel(val, wdt->reg); in npcm_wdt_start()
104 struct npcm_wdt *wdt = to_npcm_wdt(wdd); in npcm_wdt_stop() local
106 writel(0, wdt->reg); in npcm_wdt_stop()
108 if (wdt->clk) in npcm_wdt_stop()
109 clk_disable_unprepare(wdt->clk); in npcm_wdt_stop()
118 wdd->timeout = 1; in npcm_wdt_set_timeout()
120 wdd->timeout = 2; in npcm_wdt_set_timeout()
122 wdd->timeout = 5; in npcm_wdt_set_timeout()
124 wdd->timeout = 10; in npcm_wdt_set_timeout()
126 wdd->timeout = 21; in npcm_wdt_set_timeout()
128 wdd->timeout = 43; in npcm_wdt_set_timeout()
130 wdd->timeout = 86; in npcm_wdt_set_timeout()
132 wdd->timeout = 172; in npcm_wdt_set_timeout()
134 wdd->timeout = 687; in npcm_wdt_set_timeout()
136 wdd->timeout = 2750; in npcm_wdt_set_timeout()
146 struct npcm_wdt *wdt = data; in npcm_wdt_interrupt() local
148 watchdog_notify_pretimeout(&wdt->wdd); in npcm_wdt_interrupt()
156 struct npcm_wdt *wdt = to_npcm_wdt(wdd); in npcm_wdt_restart() local
158 /* For reset, we start the WDT clock and leave it running. */ in npcm_wdt_restart()
159 if (wdt->clk) in npcm_wdt_restart()
160 clk_prepare_enable(wdt->clk); in npcm_wdt_restart()
162 writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg); in npcm_wdt_restart()
170 struct npcm_wdt *wdt = to_npcm_wdt(wdd); in npcm_is_running() local
172 return readl(wdt->reg) & NPCM_WTE; in npcm_is_running()
193 struct device *dev = &pdev->dev; in npcm_wdt_probe()
194 struct npcm_wdt *wdt; in npcm_wdt_probe() local
198 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in npcm_wdt_probe()
199 if (!wdt) in npcm_wdt_probe()
200 return -ENOMEM; in npcm_wdt_probe()
202 wdt->reg = devm_platform_ioremap_resource(pdev, 0); in npcm_wdt_probe()
203 if (IS_ERR(wdt->reg)) in npcm_wdt_probe()
204 return PTR_ERR(wdt->reg); in npcm_wdt_probe()
206 wdt->clk = devm_clk_get_optional(&pdev->dev, NULL); in npcm_wdt_probe()
207 if (IS_ERR(wdt->clk)) in npcm_wdt_probe()
208 return PTR_ERR(wdt->clk); in npcm_wdt_probe()
214 wdt->wdd.info = &npcm_wdt_info; in npcm_wdt_probe()
215 wdt->wdd.ops = &npcm_wdt_ops; in npcm_wdt_probe()
216 wdt->wdd.min_timeout = 1; in npcm_wdt_probe()
217 wdt->wdd.max_timeout = 2750; in npcm_wdt_probe()
218 wdt->wdd.parent = dev; in npcm_wdt_probe()
220 wdt->wdd.timeout = 86; in npcm_wdt_probe()
221 watchdog_init_timeout(&wdt->wdd, 0, dev); in npcm_wdt_probe()
224 npcm_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout); in npcm_wdt_probe()
226 if (npcm_is_running(&wdt->wdd)) { in npcm_wdt_probe()
227 /* Restart with the default or device-tree specified timeout */ in npcm_wdt_probe()
228 npcm_wdt_start(&wdt->wdd); in npcm_wdt_probe()
229 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in npcm_wdt_probe()
233 wdt); in npcm_wdt_probe()
237 ret = devm_watchdog_register_device(dev, &wdt->wdd); in npcm_wdt_probe()
248 {.compatible = "nuvoton,wpcm450-wdt"},
249 {.compatible = "nuvoton,npcm750-wdt"},
258 .name = "npcm-wdt",