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

1 // SPDX-License-Identifier: GPL-2.0-only
36 static int timeout; variable
37 module_param(timeout, int, 0);
38 MODULE_PARM_DESC(timeout, "Initial watchdog timeout in seconds");
49 struct sl28cpld_wdt *wdt = watchdog_get_drvdata(wdd); in sl28cpld_wdt_ping() local
51 return regmap_write(wdt->regmap, wdt->offset + WDT_KICK, in sl28cpld_wdt_ping()
57 struct sl28cpld_wdt *wdt = watchdog_get_drvdata(wdd); in sl28cpld_wdt_start() local
61 if (wdt->assert_wdt_timeout) in sl28cpld_wdt_start()
66 return regmap_update_bits(wdt->regmap, wdt->offset + WDT_CTRL, in sl28cpld_wdt_start()
72 struct sl28cpld_wdt *wdt = watchdog_get_drvdata(wdd); in sl28cpld_wdt_stop() local
74 return regmap_update_bits(wdt->regmap, wdt->offset + WDT_CTRL, in sl28cpld_wdt_stop()
80 struct sl28cpld_wdt *wdt = watchdog_get_drvdata(wdd); in sl28cpld_wdt_get_timeleft() local
84 ret = regmap_read(wdt->regmap, wdt->offset + WDT_COUNT, &val); in sl28cpld_wdt_get_timeleft()
92 unsigned int timeout) in sl28cpld_wdt_set_timeout() argument
94 struct sl28cpld_wdt *wdt = watchdog_get_drvdata(wdd); in sl28cpld_wdt_set_timeout() local
97 ret = regmap_write(wdt->regmap, wdt->offset + WDT_TIMEOUT, timeout); in sl28cpld_wdt_set_timeout()
101 wdd->timeout = timeout; in sl28cpld_wdt_set_timeout()
123 struct sl28cpld_wdt *wdt; in sl28cpld_wdt_probe() local
128 if (!pdev->dev.parent) in sl28cpld_wdt_probe()
129 return -ENODEV; in sl28cpld_wdt_probe()
131 wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); in sl28cpld_wdt_probe()
132 if (!wdt) in sl28cpld_wdt_probe()
133 return -ENOMEM; in sl28cpld_wdt_probe()
135 wdt->regmap = dev_get_regmap(pdev->dev.parent, NULL); in sl28cpld_wdt_probe()
136 if (!wdt->regmap) in sl28cpld_wdt_probe()
137 return -ENODEV; in sl28cpld_wdt_probe()
139 ret = device_property_read_u32(&pdev->dev, "reg", &wdt->offset); in sl28cpld_wdt_probe()
141 return -EINVAL; in sl28cpld_wdt_probe()
143 wdt->assert_wdt_timeout = device_property_read_bool(&pdev->dev, in sl28cpld_wdt_probe()
144 "kontron,assert-wdt-timeout-pin"); in sl28cpld_wdt_probe()
147 wdd = &wdt->wdd; in sl28cpld_wdt_probe()
148 wdd->parent = &pdev->dev; in sl28cpld_wdt_probe()
149 wdd->info = &sl28cpld_wdt_info; in sl28cpld_wdt_probe()
150 wdd->ops = &sl28cpld_wdt_ops; in sl28cpld_wdt_probe()
151 wdd->min_timeout = 1; in sl28cpld_wdt_probe()
152 wdd->max_timeout = 255; in sl28cpld_wdt_probe()
154 watchdog_set_drvdata(wdd, wdt); in sl28cpld_wdt_probe()
161 ret = regmap_read(wdt->regmap, wdt->offset + WDT_CTRL, &status); in sl28cpld_wdt_probe()
166 * Initial timeout value, may be overwritten by device tree or module in sl28cpld_wdt_probe()
172 * this case gracefully and set out own timeout. in sl28cpld_wdt_probe()
174 ret = regmap_read(wdt->regmap, wdt->offset + WDT_TIMEOUT, &val); in sl28cpld_wdt_probe()
179 wdd->timeout = val; in sl28cpld_wdt_probe()
181 wdd->timeout = WDT_DEFAULT_TIMEOUT; in sl28cpld_wdt_probe()
183 watchdog_init_timeout(wdd, timeout, &pdev->dev); in sl28cpld_wdt_probe()
184 sl28cpld_wdt_set_timeout(wdd, wdd->timeout); in sl28cpld_wdt_probe()
197 set_bit(WDOG_HW_RUNNING, &wdd->status); in sl28cpld_wdt_probe()
200 ret = devm_watchdog_register_device(&pdev->dev, wdd); in sl28cpld_wdt_probe()
202 dev_err(&pdev->dev, "failed to register watchdog device\n"); in sl28cpld_wdt_probe()
206 dev_info(&pdev->dev, "initial timeout %d sec%s\n", in sl28cpld_wdt_probe()
207 wdd->timeout, nowayout ? ", nowayout" : ""); in sl28cpld_wdt_probe()
213 { .compatible = "kontron,sl28cpld-wdt" },
221 .name = "sl28cpld-wdt",