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

2  * Watchdog driver for TS-4800 based boards
4 * Copyright (c) 2015 - Savoir-faire Linux
17 #include <linux/watchdog.h>
22 "Watchdog cannot be stopped once started (default="
38 * TS-4800 supports the following timeout values:
41 * ---------------------
42 * 0 feed for 338ms
45 * 3 disable watchdog
47 * Keep the regmap/timeout map ordered by timeout
50 const int timeout; member
57 #define MAX_TIMEOUT_INDEX (ARRAY_SIZE(ts4800_wdt_map) - 1)
61 regmap_write(wdt->regmap, wdt->feed_offset, val); in ts4800_write_feed()
68 ts4800_write_feed(wdt, wdt->feed_val); in ts4800_wdt_start()
81 unsigned int timeout) in ts4800_wdt_set_timeout() argument
87 if (ts4800_wdt_map[i].timeout >= timeout) in ts4800_wdt_set_timeout()
91 wdd->timeout = ts4800_wdt_map[i].timeout; in ts4800_wdt_set_timeout()
92 wdt->feed_val = ts4800_wdt_map[i].regval; in ts4800_wdt_set_timeout()
106 .identity = "TS-4800 Watchdog",
111 struct device *dev = &pdev->dev; in ts4800_wdt_probe()
112 struct device_node *np = dev->of_node; in ts4800_wdt_probe()
122 return -ENODEV; in ts4800_wdt_probe()
132 /* allocate memory for watchdog struct */ in ts4800_wdt_probe()
136 return -ENOMEM; in ts4800_wdt_probe()
140 wdt->feed_offset = reg; in ts4800_wdt_probe()
141 wdt->regmap = syscon_node_to_regmap(syscon_np); in ts4800_wdt_probe()
143 if (IS_ERR(wdt->regmap)) { in ts4800_wdt_probe()
145 return PTR_ERR(wdt->regmap); in ts4800_wdt_probe()
149 wdd = &wdt->wdd; in ts4800_wdt_probe()
150 wdd->parent = dev; in ts4800_wdt_probe()
151 wdd->info = &ts4800_wdt_info; in ts4800_wdt_probe()
152 wdd->ops = &ts4800_wdt_ops; in ts4800_wdt_probe()
153 wdd->min_timeout = ts4800_wdt_map[0].timeout; in ts4800_wdt_probe()
154 wdd->max_timeout = ts4800_wdt_map[MAX_TIMEOUT_INDEX].timeout; in ts4800_wdt_probe()
161 * As this watchdog supports only a few values, ts4800_wdt_set_timeout in ts4800_wdt_probe()
162 * must be called to initialize timeout and feed_val with valid values. in ts4800_wdt_probe()
163 * Default to maximum timeout if none, or an invalid one, is provided in in ts4800_wdt_probe()
166 if (!wdd->timeout) in ts4800_wdt_probe()
167 wdd->timeout = wdd->max_timeout; in ts4800_wdt_probe()
168 ts4800_wdt_set_timeout(wdd, wdd->timeout); in ts4800_wdt_probe()
171 * The feed register is write-only, so it is not possible to determine in ts4800_wdt_probe()
172 * watchdog's state. Disable it to be in a known state. in ts4800_wdt_probe()
182 dev_info(dev, "initialized (timeout = %d sec, nowayout = %d)\n", in ts4800_wdt_probe()
183 wdd->timeout, nowayout); in ts4800_wdt_probe()
189 { .compatible = "technologic,ts4800-wdt", },