2 * Copyright (C) 2017 Álvaro Fernández Rojas <noltari@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
13 struct wdt_reboot_priv {
17 static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type)
19 struct wdt_reboot_priv *priv = dev_get_priv(dev);
22 ret = wdt_expire_now(priv->wdt, 0);
29 static struct sysreset_ops wdt_reboot_ops = {
30 .request = wdt_reboot_request,
33 int wdt_reboot_probe(struct udevice *dev)
35 struct wdt_reboot_priv *priv = dev_get_priv(dev);
38 err = uclass_get_device_by_phandle(UCLASS_WDT, dev,
41 error("unable to find wdt device\n");
48 static const struct udevice_id wdt_reboot_ids[] = {
49 { .compatible = "wdt-reboot" },
53 U_BOOT_DRIVER(wdt_reboot) = {
55 .id = UCLASS_SYSRESET,
56 .of_match = wdt_reboot_ids,
57 .ops = &wdt_reboot_ops,
58 .priv_auto_alloc_size = sizeof(struct wdt_reboot_priv),
59 .probe = wdt_reboot_probe,