Lines Matching +full:cmd +full:- +full:timeout +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0+
13 #include <linux/mfd/rave-sp.h>
15 #include <linux/nvmem-consumer.h>
29 * struct rave_sp_wdt_variant - RAVE SP watchdog variant
31 * @max_timeout: Largest possible watchdog timeout setting
32 * @min_timeout: Smallest possible watchdog timeout setting
46 * struct rave_sp_wdt - RAVE SP watchdog
68 return rave_sp_exec(to_rave_sp_wdt(wdd)->sp, in rave_sp_wdt_exec()
74 u8 cmd[] = { in rave_sp_wdt_legacy_configure() local
79 [4] = on ? wdd->timeout : 0, in rave_sp_wdt_legacy_configure()
82 return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd)); in rave_sp_wdt_legacy_configure()
87 u8 cmd[] = { in rave_sp_wdt_rdu_configure() local
91 [3] = (u8)wdd->timeout, in rave_sp_wdt_rdu_configure()
92 [4] = (u8)(wdd->timeout >> 8), in rave_sp_wdt_rdu_configure()
95 return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd)); in rave_sp_wdt_rdu_configure()
99 * rave_sp_wdt_configure - Configure watchdog device
106 * - Wheither it is ON or OFF
107 * - Its timeout duration
110 * the value of 'wdd->timeout'.
114 return to_rave_sp_wdt(wdd)->variant->configure(wdd, on); in rave_sp_wdt_configure()
119 u8 cmd[] = { in rave_sp_wdt_legacy_restart() local
125 return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd)); in rave_sp_wdt_legacy_restart()
130 u8 cmd[] = { in rave_sp_wdt_rdu_restart() local
137 return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd)); in rave_sp_wdt_rdu_restart()
146 * wait 500ms before actually resetting us, so we ask it to do in rave_sp_wdt_reboot_notifier()
154 const int ret = sp_wd->variant->restart(&sp_wd->wdd); in rave_sp_wdt_reboot_notifier()
157 dev_err(sp_wd->wdd.parent, in rave_sp_wdt_reboot_notifier()
170 * firmware waits 500 ms before issuing reset, so let's hang in rave_sp_wdt_restart()
176 return -EIO; in rave_sp_wdt_restart()
185 set_bit(WDOG_HW_RUNNING, &wdd->status); in rave_sp_wdt_start()
196 unsigned int timeout) in rave_sp_wdt_set_timeout() argument
198 wdd->timeout = timeout; in rave_sp_wdt_set_timeout()
205 u8 cmd[] = { in rave_sp_wdt_ping() local
210 return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd)); in rave_sp_wdt_ping()
243 .compatible = "zii,rave-sp-watchdog-legacy",
247 .compatible = "zii,rave-sp-watchdog",
255 struct device *dev = &pdev->dev; in rave_sp_wdt_probe()
259 __le16 timeout = 0; in rave_sp_wdt_probe() local
264 return -ENOMEM; in rave_sp_wdt_probe()
266 sp_wd->variant = of_device_get_match_data(dev); in rave_sp_wdt_probe()
267 sp_wd->sp = dev_get_drvdata(dev->parent); in rave_sp_wdt_probe()
269 wdd = &sp_wd->wdd; in rave_sp_wdt_probe()
270 wdd->parent = dev; in rave_sp_wdt_probe()
271 wdd->info = &rave_sp_wdt_info; in rave_sp_wdt_probe()
272 wdd->ops = &rave_sp_wdt_ops; in rave_sp_wdt_probe()
273 wdd->min_timeout = sp_wd->variant->min_timeout; in rave_sp_wdt_probe()
274 wdd->max_timeout = sp_wd->variant->max_timeout; in rave_sp_wdt_probe()
275 wdd->status = WATCHDOG_NOWAYOUT_INIT_STATUS; in rave_sp_wdt_probe()
276 wdd->timeout = 60; in rave_sp_wdt_probe()
278 cell = nvmem_cell_get(dev, "wdt-timeout"); in rave_sp_wdt_probe()
284 memcpy(&timeout, value, min(len, sizeof(timeout))); in rave_sp_wdt_probe()
289 watchdog_init_timeout(wdd, le16_to_cpu(timeout), dev); in rave_sp_wdt_probe()
293 sp_wd->reboot_notifier.notifier_call = rave_sp_wdt_reboot_notifier; in rave_sp_wdt_probe()
294 ret = devm_register_reboot_notifier(dev, &sp_wd->reboot_notifier); in rave_sp_wdt_probe()
304 wdd->max_hw_heartbeat_ms = wdd->max_timeout * 1000; in rave_sp_wdt_probe()
336 MODULE_ALIAS("platform:rave-sp-watchdog");