From 881d4108257a45ac890ef27c523783dbe401e462 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 2 Sep 2022 14:10:45 +0200 Subject: cyclic: Introduce schedule() function This patch introduces a schedule() function, which shall be used instead of the old WATCHDOG_RESET. Follow-up patches will make sure, that this new function is used. Signed-off-by: Stefan Roese Reviewed-by: Simon Glass Tested-by: Tom Rini [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm] --- common/cyclic.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common') 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; -- cgit v1.2.3