public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, sjg@chromium.org, rasmus.villemoes@prevas.dk
Subject: [PATCH v1 4/6] watchdog: Get rid of ASSEMBLY hacks
Date: Fri,  2 Sep 2022 14:10:47 +0200	[thread overview]
Message-ID: <20220902121049.1282136-5-sr@denx.de> (raw)
In-Reply-To: <20220902121049.1282136-1-sr@denx.de>

Only one occurance of WATCHDOG_RESET is left in one assembler file.
This patch changes this occurance to a direct call to watchdog_reset
and then removes all the ASSEMBLY ifdef'ery in watchdog.h, as it's not
needed any more to clean this mess a bit up.

Signed-off-by: Stefan Roese <sr@denx.de>
---
v1:
- No change

 arch/powerpc/lib/ticks.S |  5 ++--
 include/watchdog.h       | 50 +++++++++++++---------------------------
 2 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/arch/powerpc/lib/ticks.S b/arch/powerpc/lib/ticks.S
index c487f938fa8d..8647d77cc9ad 100644
--- a/arch/powerpc/lib/ticks.S
+++ b/arch/powerpc/lib/ticks.S
@@ -9,7 +9,6 @@
 #include <ppc_asm.tmpl>
 #include <ppc_defs.h>
 #include <config.h>
-#include <watchdog.h>
 
 /*
  * unsigned long long get_ticks(void);
@@ -42,7 +41,9 @@ wait_ticks:
 	addc    r14, r4, r14	/* Compute end time lower */
 	addze	r15, r3		/*     and end time upper */
 
-	WATCHDOG_RESET		/* Trigger watchdog, if needed */
+#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
+	bl	schedule	/* Trigger watchdog, if needed */
+#endif
 1:	bl	get_ticks	/* Get current time */
 	subfc	r4, r4, r14	/* Subtract current time from end time */
 	subfe.	r3, r3, r15
diff --git a/include/watchdog.h b/include/watchdog.h
index 7a09346a0959..1365b154a295 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -38,54 +38,36 @@ int init_func_watchdog_reset(void);
  * Hardware watchdog
  */
 #ifdef CONFIG_HW_WATCHDOG
-	#if defined(__ASSEMBLY__)
-		#define WATCHDOG_RESET bl hw_watchdog_reset
-	#else
-		extern void hw_watchdog_reset(void);
+	extern void hw_watchdog_reset(void);
 
-		#define WATCHDOG_RESET hw_watchdog_reset
-	#endif /* __ASSEMBLY__ */
+	#define WATCHDOG_RESET hw_watchdog_reset
 #else
 	/*
 	 * Maybe a software watchdog?
 	 */
 	#if defined(CONFIG_WATCHDOG)
-		#if defined(__ASSEMBLY__)
-			/* Don't require the watchdog to be enabled in SPL */
-			#if defined(CONFIG_SPL_BUILD) &&		\
-				!defined(CONFIG_SPL_WATCHDOG)
-				#define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
-			#else
-				#define WATCHDOG_RESET bl watchdog_reset
-			#endif
+		/* Don't require the watchdog to be enabled in SPL */
+		#if defined(CONFIG_SPL_BUILD) &&		\
+			!defined(CONFIG_SPL_WATCHDOG)
+			#define WATCHDOG_RESET() { \
+				cyclic_run(); \
+			}
 		#else
-			/* Don't require the watchdog to be enabled in SPL */
-			#if defined(CONFIG_SPL_BUILD) &&		\
-				!defined(CONFIG_SPL_WATCHDOG)
-				#define WATCHDOG_RESET() { \
-					cyclic_run(); \
-				}
-			#else
-				extern void watchdog_reset(void);
+			extern void watchdog_reset(void);
 
-				#define WATCHDOG_RESET() { \
-					watchdog_reset(); \
-					cyclic_run(); \
-				}
-			#endif
+			#define WATCHDOG_RESET() { \
+				watchdog_reset(); \
+				cyclic_run(); \
+			}
 		#endif
 	#else
 		/*
 		 * No hardware or software watchdog.
 		 */
-		#if defined(__ASSEMBLY__)
-			#define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
-		#else
-			#define WATCHDOG_RESET() { \
-				cyclic_run(); \
+		#define WATCHDOG_RESET() { \
+			cyclic_run(); \
 			}
-		#endif /* __ASSEMBLY__ */
-	#endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
+	#endif /* CONFIG_WATCHDOG */
 #endif /* CONFIG_HW_WATCHDOG */
 
 /*
-- 
2.37.3


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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 12:10 [PATCH v1 0/6] Migrate watchdog reset to cyclic infrastructure Stefan Roese
2022-09-02 12:10 ` [PATCH v1 1/6] watchdog: Integrate watchdog triggering into the cyclic framework Stefan Roese
2022-09-02 19:59   ` Simon Glass
2022-09-02 12:10 ` [PATCH v1 2/6] cyclic: Introduce schedule() function Stefan Roese
2022-09-02 12:10 ` [PATCH v1 3/6] cyclic: Use schedule() instead of WATCHDOG_RESET() Stefan Roese
2022-09-02 12:10 ` Stefan Roese [this message]
2022-09-02 12:10 ` [PATCH v1 5/6] watchdog: Remove WATCHDOG_RESET macro Stefan Roese
2022-09-02 12:10 ` [PATCH v1 6/6] watchdog: Further cleanup Stefan Roese
2022-09-16  7:21 ` [PATCH v1 0/6] Migrate watchdog reset to cyclic infrastructure 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=20220902121049.1282136-5-sr@denx.de \
    --to=sr@denx.de \
    --cc=rasmus.villemoes@prevas.dk \
    --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