U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, sjg@chromium.org, awilliams@marvell.com,
	cchavva@marvell.com
Subject: [PATCH v6 3/8] cyclic: Integrate cyclic infrastructure into WATCHDOG_RESET
Date: Fri,  2 Sep 2022 13:57:49 +0200	[thread overview]
Message-ID: <20220902115754.1280789-4-sr@denx.de> (raw)
In-Reply-To: <20220902115754.1280789-1-sr@denx.de>

This patch integrates the main function responsible for calling all
registered cyclic functions cyclic_run() into the common WATCHDOG_RESET
macro. This guarantees that cyclic_run() is executed very often, which
is necessary for the cyclic functions to get scheduled and executed at
their configured periods.

If CONFIG_WATCHDOG is not enabled, only cyclic_run() without calling
watchdog_reset(). This guarantees that the cyclic functionality does not
rely on CONFIG_WATCHDOG being enabled.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
v6:
- No change

v5:
- No change

v4:
- Added Simon's RB tag

v3:
- No change

v2:
- No change

 fs/cramfs/uncompress.c |  2 +-
 include/watchdog.h     | 23 ++++++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c
index f431cc46c1f7..38e10e2e4422 100644
--- a/fs/cramfs/uncompress.c
+++ b/fs/cramfs/uncompress.c
@@ -62,7 +62,7 @@ int cramfs_uncompress_init (void)
 	stream.avail_in = 0;
 
 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
-	stream.outcb = (cb_func) WATCHDOG_RESET;
+	stream.outcb = (cb_func)watchdog_reset_func;
 #else
 	stream.outcb = Z_NULL;
 #endif /* CONFIG_HW_WATCHDOG */
diff --git a/include/watchdog.h b/include/watchdog.h
index 813cc8f2a5d3..0a9777edcbad 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -11,6 +11,8 @@
 #define _WATCHDOG_H_
 
 #if !defined(__ASSEMBLY__)
+#include <cyclic.h>
+
 /*
  * Reset the watchdog timer, always returns 0
  *
@@ -60,11 +62,16 @@ int init_func_watchdog_reset(void);
 			/* Don't require the watchdog to be enabled in SPL */
 			#if defined(CONFIG_SPL_BUILD) &&		\
 				!defined(CONFIG_SPL_WATCHDOG)
-				#define WATCHDOG_RESET() {}
+				#define WATCHDOG_RESET() { \
+					cyclic_run(); \
+				}
 			#else
 				extern void watchdog_reset(void);
 
-				#define WATCHDOG_RESET watchdog_reset
+				#define WATCHDOG_RESET() { \
+					watchdog_reset(); \
+					cyclic_run(); \
+				}
 			#endif
 		#endif
 	#else
@@ -74,11 +81,21 @@ int init_func_watchdog_reset(void);
 		#if defined(__ASSEMBLY__)
 			#define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
 		#else
-			#define WATCHDOG_RESET() {}
+			#define WATCHDOG_RESET() { \
+				cyclic_run(); \
+			}
 		#endif /* __ASSEMBLY__ */
 	#endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
 #endif /* CONFIG_HW_WATCHDOG */
 
+#if !defined(__ASSEMBLY__)
+/* Currently only needed for fs/cramfs/uncompress.c */
+static inline void watchdog_reset_func(void)
+{
+	WATCHDOG_RESET();
+}
+#endif
+
 /*
  * Prototypes from $(CPU)/cpu.c.
  */
-- 
2.37.3


  parent reply	other threads:[~2022-09-02 11:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 11:57 [PATCH v6 0/8] Add support for cyclic function execution infrastruture Stefan Roese
2022-09-02 11:57 ` [PATCH v6 1/8] time: Import time_after64() and friends from Linux Stefan Roese
2022-09-02 11:57 ` [PATCH v6 2/8] cyclic: Add basic support for cyclic function execution infrastruture Stefan Roese
2022-09-02 11:57 ` Stefan Roese [this message]
2022-09-02 11:57 ` [PATCH v6 4/8] cyclic: Integrate cyclic functionality at bootup in board_r/f Stefan Roese
2022-09-02 11:57 ` [PATCH v6 5/8] cyclic: Add 'cyclic list' and 'cyclic demo' commands Stefan Roese
2022-09-02 11:57 ` [PATCH v6 6/8] mips: octeon_nic23: Add PCIe FLR fixup via cyclic infrastructure Stefan Roese
2022-09-02 11:57 ` [PATCH v6 7/8] cyclic: Add documentation Stefan Roese
2022-09-02 11:57 ` [PATCH v6 8/8] cyclic: Add a simple test Stefan Roese
2022-09-14 12:58 ` [PATCH v6 0/8] Add support for cyclic function execution infrastruture Tom Rini
2022-09-14 14:29   ` Stefan Roese
2022-09-14 14:47     ` Tom Rini
2022-09-14 15:18       ` Stefan Roese
2022-09-14 17:09         ` Simon Glass
2022-09-15  4:58           ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220902115754.1280789-4-sr@denx.de \
    --to=sr@denx.de \
    --cc=awilliams@marvell.com \
    --cc=cchavva@marvell.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox