From 4939585cd7eacd0ccb0f9708e5f6e4aad8fa150d Mon Sep 17 00:00:00 2001 From: gonzo Date: Tue, 22 Oct 2013 05:22:46 +0000 Subject: Make watchdog function conform watchdog(9): Set error to 0 when watchdog is armed and disable it when timeout is too large to be set. --- sys/arm/allwinner/a10_wdog.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys/arm/allwinner') diff --git a/sys/arm/allwinner/a10_wdog.c b/sys/arm/allwinner/a10_wdog.c index 0563601..f951936 100644 --- a/sys/arm/allwinner/a10_wdog.c +++ b/sys/arm/allwinner/a10_wdog.c @@ -150,6 +150,18 @@ a10wd_watchdog_fn(void *private, u_int cmd, int *error) (wd_intervals[i].value << WDOG_MODE_INTVL_SHIFT) | WDOG_MODE_EN | WDOG_MODE_RST_EN); WRITE(sc, WDOG_CTRL, WDOG_CTRL_RESTART); + *error = 0; + } + else { + /* + * Can't arm + * disable watchdog as watchdog(9) requires + */ + device_printf(sc->dev, + "Can't arm, timeout is more than 16 sec\n"); + mtx_unlock(&sc->mtx); + WRITE(sc, WDOG_MODE, 0); + return; } } else -- cgit v1.1