Lines Matching +full:watchdog +full:- +full:timeout +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Watchdog driver for TS-4800 based boards
5 * Copyright (c) 2015 - Savoir-faire Linux
15 #include <linux/watchdog.h>
20 "Watchdog cannot be stopped once started (default="
36 * TS-4800 supports the following timeout values:
39 * ---------------------
40 * 0 feed for 338ms
43 * 3 disable watchdog
45 * Keep the regmap/timeout map ordered by timeout
48 const int timeout; member
55 #define MAX_TIMEOUT_INDEX (ARRAY_SIZE(ts4800_wdt_map) - 1)
59 regmap_write(wdt->regmap, wdt->feed_offset, val); in ts4800_write_feed()
66 ts4800_write_feed(wdt, wdt->feed_val); in ts4800_wdt_start()
79 unsigned int timeout) in ts4800_wdt_set_timeout() argument
85 if (ts4800_wdt_map[i].timeout >= timeout) in ts4800_wdt_set_timeout()
89 wdd->timeout = ts4800_wdt_map[i].timeout; in ts4800_wdt_set_timeout()
90 wdt->feed_val = ts4800_wdt_map[i].regval; in ts4800_wdt_set_timeout()
104 .identity = "TS-4800 Watchdog",
109 struct device *dev = &pdev->dev; in ts4800_wdt_probe()
110 struct device_node *np = dev->of_node; in ts4800_wdt_probe()
120 return -ENODEV; in ts4800_wdt_probe()
130 /* allocate memory for watchdog struct */ in ts4800_wdt_probe()
134 return -ENOMEM; in ts4800_wdt_probe()
138 wdt->feed_offset = reg; in ts4800_wdt_probe()
139 wdt->regmap = syscon_node_to_regmap(syscon_np); in ts4800_wdt_probe()
141 if (IS_ERR(wdt->regmap)) { in ts4800_wdt_probe()
143 return PTR_ERR(wdt->regmap); in ts4800_wdt_probe()
147 wdd = &wdt->wdd; in ts4800_wdt_probe()
148 wdd->parent = dev; in ts4800_wdt_probe()
149 wdd->info = &ts4800_wdt_info; in ts4800_wdt_probe()
150 wdd->ops = &ts4800_wdt_ops; in ts4800_wdt_probe()
151 wdd->min_timeout = ts4800_wdt_map[0].timeout; in ts4800_wdt_probe()
152 wdd->max_timeout = ts4800_wdt_map[MAX_TIMEOUT_INDEX].timeout; in ts4800_wdt_probe()
159 * As this watchdog supports only a few values, ts4800_wdt_set_timeout in ts4800_wdt_probe()
160 * must be called to initialize timeout and feed_val with valid values. in ts4800_wdt_probe()
161 * Default to maximum timeout if none, or an invalid one, is provided in in ts4800_wdt_probe()
164 if (!wdd->timeout) in ts4800_wdt_probe()
165 wdd->timeout = wdd->max_timeout; in ts4800_wdt_probe()
166 ts4800_wdt_set_timeout(wdd, wdd->timeout); in ts4800_wdt_probe()
169 * The feed register is write-only, so it is not possible to determine in ts4800_wdt_probe()
170 * watchdog's state. Disable it to be in a known state. in ts4800_wdt_probe()
180 dev_info(dev, "initialized (timeout = %d sec, nowayout = %d)\n", in ts4800_wdt_probe()
181 wdd->timeout, nowayout); in ts4800_wdt_probe()
187 { .compatible = "technologic,ts4800-wdt", },