upstream u-boot with additional patches for our devices/boards: https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ; Gbit ethernet patch for some LIME2 revisions ; with SPI flash support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
u-boot/drivers/watchdog/wdt-uclass.c

69 lines
1.1 KiB

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2017 Google, Inc
*/
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <wdt.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
{
const struct wdt_ops *ops = device_get_ops(dev);
if (!ops->start)
return -ENOSYS;
return ops->start(dev, timeout_ms, flags);
}
int wdt_stop(struct udevice *dev)
{
const struct wdt_ops *ops = device_get_ops(dev);
if (!ops->stop)
return -ENOSYS;
return ops->stop(dev);
}
int wdt_reset(struct udevice *dev)
{
const struct wdt_ops *ops = device_get_ops(dev);
if (!ops->reset)
return -ENOSYS;
return ops->reset(dev);
}
int wdt_expire_now(struct udevice *dev, ulong flags)
{
int ret = 0;
const struct wdt_ops *ops;
debug("WDT Resetting: %lu\n", flags);
ops = device_get_ops(dev);
if (ops->expire_now) {
return ops->expire_now(dev, flags);
} else {
if (!ops->start)
return -ENOSYS;
ret = ops->start(dev, 1, flags);
if (ret < 0)
return ret;
hang();
}
return ret;
}
UCLASS_DRIVER(wdt) = {
.id = UCLASS_WDT,
.name = "wdt",
};