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

1 // SPDX-License-Identifier: GPL-2.0-or-later
44 static unsigned int timeout; variable
45 module_param(timeout, uint, 0);
46 MODULE_PARM_DESC(timeout,
47 "Watchdog timeout in seconds. (default="
56 static void ni903x_start(struct ni903x_wdt *wdt) in ni903x_start() argument
58 u8 control = inb(wdt->io_base + NIWD_CONTROL); in ni903x_start()
60 outb(control | NIWD_CONTROL_RESET, wdt->io_base + NIWD_CONTROL); in ni903x_start()
61 outb(control | NIWD_CONTROL_PET, wdt->io_base + NIWD_CONTROL); in ni903x_start()
65 unsigned int timeout) in ni903x_wdd_set_timeout() argument
67 struct ni903x_wdt *wdt = watchdog_get_drvdata(wdd); in ni903x_wdd_set_timeout() local
68 u32 counter = timeout * (1000000000 / NIWD_PERIOD_NS); in ni903x_wdd_set_timeout()
70 outb(((0x00FF0000 & counter) >> 16), wdt->io_base + NIWD_SEED2); in ni903x_wdd_set_timeout()
71 outb(((0x0000FF00 & counter) >> 8), wdt->io_base + NIWD_SEED1); in ni903x_wdd_set_timeout()
72 outb((0x000000FF & counter), wdt->io_base + NIWD_SEED0); in ni903x_wdd_set_timeout()
74 wdd->timeout = timeout; in ni903x_wdd_set_timeout()
81 struct ni903x_wdt *wdt = watchdog_get_drvdata(wdd); in ni903x_wdd_get_timeleft() local
85 control = inb(wdt->io_base + NIWD_CONTROL); in ni903x_wdd_get_timeleft()
87 outb(control, wdt->io_base + NIWD_CONTROL); in ni903x_wdd_get_timeleft()
89 counter2 = inb(wdt->io_base + NIWD_COUNTER2); in ni903x_wdd_get_timeleft()
90 counter1 = inb(wdt->io_base + NIWD_COUNTER1); in ni903x_wdd_get_timeleft()
91 counter0 = inb(wdt->io_base + NIWD_COUNTER0); in ni903x_wdd_get_timeleft()
100 struct ni903x_wdt *wdt = watchdog_get_drvdata(wdd); in ni903x_wdd_ping() local
103 control = inb(wdt->io_base + NIWD_CONTROL); in ni903x_wdd_ping()
104 outb(control | NIWD_CONTROL_PET, wdt->io_base + NIWD_CONTROL); in ni903x_wdd_ping()
111 struct ni903x_wdt *wdt = watchdog_get_drvdata(wdd); in ni903x_wdd_start() local
114 wdt->io_base + NIWD_CONTROL); in ni903x_wdd_start()
116 ni903x_wdd_set_timeout(wdd, wdd->timeout); in ni903x_wdd_start()
117 ni903x_start(wdt); in ni903x_wdd_start()
124 struct ni903x_wdt *wdt = watchdog_get_drvdata(wdd); in ni903x_wdd_stop() local
126 outb(NIWD_CONTROL_RESET, wdt->io_base + NIWD_CONTROL); in ni903x_wdd_stop()
133 struct ni903x_wdt *wdt = data; in ni903x_resources() local
136 switch (res->type) { in ni903x_resources()
138 if (wdt->io_base != 0) { in ni903x_resources()
139 dev_err(wdt->dev, "too many IO resources\n"); in ni903x_resources()
143 wdt->io_base = res->data.io.minimum; in ni903x_resources()
144 io_size = res->data.io.address_length; in ni903x_resources()
147 dev_err(wdt->dev, "memory region too small\n"); in ni903x_resources()
151 if (!devm_request_region(wdt->dev, wdt->io_base, io_size, in ni903x_resources()
153 dev_err(wdt->dev, "failed to get memory region\n"); in ni903x_resources()
182 struct device *dev = &device->dev; in ni903x_acpi_add()
184 struct ni903x_wdt *wdt; in ni903x_acpi_add() local
188 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in ni903x_acpi_add()
189 if (!wdt) in ni903x_acpi_add()
190 return -ENOMEM; in ni903x_acpi_add()
192 device->driver_data = wdt; in ni903x_acpi_add()
193 wdt->dev = dev; in ni903x_acpi_add()
195 status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, in ni903x_acpi_add()
196 ni903x_resources, wdt); in ni903x_acpi_add()
197 if (ACPI_FAILURE(status) || wdt->io_base == 0) { in ni903x_acpi_add()
199 return -ENODEV; in ni903x_acpi_add()
202 wdd = &wdt->wdd; in ni903x_acpi_add()
203 wdd->info = &ni903x_wdd_info; in ni903x_acpi_add()
204 wdd->ops = &ni903x_wdd_ops; in ni903x_acpi_add()
205 wdd->min_timeout = NIWD_MIN_TIMEOUT; in ni903x_acpi_add()
206 wdd->max_timeout = NIWD_MAX_TIMEOUT; in ni903x_acpi_add()
207 wdd->timeout = NIWD_DEFAULT_TIMEOUT; in ni903x_acpi_add()
208 wdd->parent = dev; in ni903x_acpi_add()
209 watchdog_set_drvdata(wdd, wdt); in ni903x_acpi_add()
211 watchdog_init_timeout(wdd, timeout, dev); in ni903x_acpi_add()
219 wdt->io_base + NIWD_CONTROL); in ni903x_acpi_add()
221 dev_dbg(dev, "io_base=0x%04X, timeout=%d, nowayout=%d\n", in ni903x_acpi_add()
222 wdt->io_base, timeout, nowayout); in ni903x_acpi_add()
229 struct ni903x_wdt *wdt = acpi_driver_data(device); in ni903x_acpi_remove() local
231 ni903x_wdd_stop(&wdt->wdd); in ni903x_acpi_remove()
232 watchdog_unregister_device(&wdt->wdd); in ni903x_acpi_remove()