Lines Matching +full:wdt +full:- +full:timeout

1 // SPDX-License-Identifier: GPL-2.0-or-later
33 static unsigned int timeout; variable
34 module_param(timeout, uint, 0);
35 MODULE_PARM_DESC(timeout,
36 "Watchdog timeout in seconds. (default="
63 return period * counter - period / 2; in nic7018_timeout()
66 static const struct nic7018_config *nic7018_get_config(u32 timeout, in nic7018_get_config() argument
72 if (timeout < 30 && timeout != 16) { in nic7018_get_config()
74 count = timeout / 2 + 1; in nic7018_get_config()
77 count = DIV_ROUND_UP(timeout + 16, 32); in nic7018_get_config()
87 unsigned int timeout) in nic7018_set_timeout() argument
89 struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd); in nic7018_set_timeout() local
93 config = nic7018_get_config(timeout, &counter); in nic7018_set_timeout()
95 outb(counter << 4 | config->divider, in nic7018_set_timeout()
96 wdt->io_base + WDT_PRESET_PRESCALE); in nic7018_set_timeout()
98 wdd->timeout = nic7018_timeout(config->period, counter); in nic7018_set_timeout()
99 wdt->period = config->period; in nic7018_set_timeout()
106 struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd); in nic7018_start() local
109 nic7018_set_timeout(wdd, wdd->timeout); in nic7018_start()
111 control = inb(wdt->io_base + WDT_RELOAD_CTRL); in nic7018_start()
112 outb(control | WDT_RELOAD_PORT_EN, wdt->io_base + WDT_RELOAD_CTRL); in nic7018_start()
114 outb(1, wdt->io_base + WDT_RELOAD_PORT); in nic7018_start()
116 control = inb(wdt->io_base + WDT_CTRL); in nic7018_start()
117 outb(control | WDT_CTRL_RESET_EN, wdt->io_base + WDT_CTRL); in nic7018_start()
124 struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd); in nic7018_stop() local
126 outb(0, wdt->io_base + WDT_CTRL); in nic7018_stop()
127 outb(0, wdt->io_base + WDT_RELOAD_CTRL); in nic7018_stop()
128 outb(0xF0, wdt->io_base + WDT_PRESET_PRESCALE); in nic7018_stop()
135 struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd); in nic7018_ping() local
137 outb(1, wdt->io_base + WDT_RELOAD_PORT); in nic7018_ping()
144 struct nic7018_wdt *wdt = watchdog_get_drvdata(wdd); in nic7018_get_timeleft() local
147 count = inb(wdt->io_base + WDT_COUNT) & 0xF; in nic7018_get_timeleft()
151 return nic7018_timeout(wdt->period, count); in nic7018_get_timeleft()
170 struct device *dev = &pdev->dev; in nic7018_probe()
172 struct nic7018_wdt *wdt; in nic7018_probe() local
176 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in nic7018_probe()
177 if (!wdt) in nic7018_probe()
178 return -ENOMEM; in nic7018_probe()
180 platform_set_drvdata(pdev, wdt); in nic7018_probe()
185 return -EINVAL; in nic7018_probe()
188 if (!devm_request_region(dev, io_rc->start, resource_size(io_rc), in nic7018_probe()
191 return -EBUSY; in nic7018_probe()
194 wdt->io_base = io_rc->start; in nic7018_probe()
195 wdd = &wdt->wdd; in nic7018_probe()
196 wdd->info = &nic7018_wdd_info; in nic7018_probe()
197 wdd->ops = &nic7018_wdd_ops; in nic7018_probe()
198 wdd->min_timeout = WDT_MIN_TIMEOUT; in nic7018_probe()
199 wdd->max_timeout = WDT_MAX_TIMEOUT; in nic7018_probe()
200 wdd->timeout = WDT_DEFAULT_TIMEOUT; in nic7018_probe()
201 wdd->parent = dev; in nic7018_probe()
203 watchdog_set_drvdata(wdd, wdt); in nic7018_probe()
205 watchdog_init_timeout(wdd, timeout, dev); in nic7018_probe()
207 /* Unlock WDT register */ in nic7018_probe()
208 outb(UNLOCK, wdt->io_base + WDT_REG_LOCK); in nic7018_probe()
212 outb(LOCK, wdt->io_base + WDT_REG_LOCK); in nic7018_probe()
216 dev_dbg(dev, "io_base=0x%04X, timeout=%d, nowayout=%d\n", in nic7018_probe()
217 wdt->io_base, timeout, nowayout); in nic7018_probe()
223 struct nic7018_wdt *wdt = platform_get_drvdata(pdev); in nic7018_remove() local
225 watchdog_unregister_device(&wdt->wdd); in nic7018_remove()
227 /* Lock WDT register */ in nic7018_remove()
228 outb(LOCK, wdt->io_base + WDT_REG_LOCK); in nic7018_remove()