summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-03-16 12:33:24 -0400
committerTom Rini <trini@konsulko.com>2020-03-16 12:33:24 -0400
commita4df9d8ab848ea4ff10b247ae435b0a14bbbd066 (patch)
tree0510515378f74c4c4687819e1babfd531fdb5254
parent50be9f0e1ccc0909e65132cff216743a49046f97 (diff)
parent6d8eae9ab7d17ca3ce84c5e6e29bd452936ad407 (diff)
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
- Fix timer wrap (Chris) - Use dev_read only if OF_PLATDATA is not enabled (Walter)
-rw-r--r--drivers/watchdog/wdt-uclass.c3
-rw-r--r--include/wdt.h3
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index cf1c527473..d9e4dc7cb8 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -7,6 +7,7 @@
#include <dm.h>
#include <errno.h>
#include <hang.h>
+#include <time.h>
#include <wdt.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
@@ -83,7 +84,7 @@ void watchdog_reset(void)
/* Do not reset the watchdog too often */
now = get_timer(0);
- if (now > next_reset) {
+ if (time_after(now, next_reset)) {
next_reset = now + 1000; /* reset every 1000ms */
wdt_reset(gd->watchdog_dev);
}
diff --git a/include/wdt.h b/include/wdt.h
index 5bcff24ab3..dd83dfdd32 100644
--- a/include/wdt.h
+++ b/include/wdt.h
@@ -130,11 +130,10 @@ static inline int initr_watchdog(void)
}
}
- if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+ if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
WATCHDOG_TIMEOUT_SECS);
}
-
wdt_start(gd->watchdog_dev, timeout * 1000, 0);
gd->flags |= GD_FLG_WDT_READY;
printf("WDT: Started with%s servicing (%ds timeout)\n",