aboutsummaryrefslogtreecommitdiff
path: root/common/cyclic.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-09-18 08:34:31 -0400
committerTom Rini <trini@konsulko.com>2022-09-18 08:34:31 -0400
commitb6c50e5831f6ce3800d4b3cf3c7aa35dde8c48d9 (patch)
tree4403d1b2ff259014c01855e08191ad0d1c294741 /common/cyclic.c
parentd219fc06b30d4b1ac4fac6c40b2ca69cb5ecf642 (diff)
parent8695fbb3a7ff3640eff62f7123323b16546d5b35 (diff)
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-watchdog into next
- Migrate watchdog reset to cyclic infrastructure (Stefan)
Diffstat (limited to 'common/cyclic.c')
-rw-r--r--common/cyclic.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/common/cyclic.c b/common/cyclic.c
index cd5dcb1f2b..b3c180bd1a 100644
--- a/common/cyclic.c
+++ b/common/cyclic.c
@@ -18,6 +18,8 @@
DECLARE_GLOBAL_DATA_PTR;
+void hw_watchdog_reset(void);
+
struct list_head *cyclic_get_list(void)
{
return &gd->cyclic->cyclic_list;
@@ -96,6 +98,20 @@ void cyclic_run(void)
gd->cyclic->cyclic_running = false;
}
+void schedule(void)
+{
+ /* The HW watchdog is not integrated into the cyclic IF (yet) */
+ if (IS_ENABLED(CONFIG_HW_WATCHDOG))
+ hw_watchdog_reset();
+
+ /*
+ * schedule() might get called very early before the cyclic IF is
+ * ready. Make sure to only call cyclic_run() when it's initalized.
+ */
+ if (gd && gd->cyclic && gd->cyclic->cyclic_ready)
+ cyclic_run();
+}
+
int cyclic_uninit(void)
{
struct cyclic_info *cyclic, *tmp;