- Fix timer wrap (Chris)
- Use dev_read only if OF_PLATDATA is not enabled (Walter)
This commit is contained in:
Tom Rini 2020-03-16 12:33:24 -04:00
commit a4df9d8ab8
2 changed files with 3 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <hang.h> #include <hang.h>
#include <time.h>
#include <wdt.h> #include <wdt.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
#include <dm/lists.h> #include <dm/lists.h>
@ -83,7 +84,7 @@ void watchdog_reset(void)
/* Do not reset the watchdog too often */ /* Do not reset the watchdog too often */
now = get_timer(0); now = get_timer(0);
if (now > next_reset) { if (time_after(now, next_reset)) {
next_reset = now + 1000; /* reset every 1000ms */ next_reset = now + 1000; /* reset every 1000ms */
wdt_reset(gd->watchdog_dev); wdt_reset(gd->watchdog_dev);
} }

View File

@ -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", timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
WATCHDOG_TIMEOUT_SECS); WATCHDOG_TIMEOUT_SECS);
} }
wdt_start(gd->watchdog_dev, timeout * 1000, 0); wdt_start(gd->watchdog_dev, timeout * 1000, 0);
gd->flags |= GD_FLG_WDT_READY; gd->flags |= GD_FLG_WDT_READY;
printf("WDT: Started with%s servicing (%ds timeout)\n", printf("WDT: Started with%s servicing (%ds timeout)\n",