diff mbox series

[U-Boot,04/12,v2] watchdog: Handle SPL build with watchdog disabled

Message ID 20190326121642.23302-4-sr@denx.de
State Superseded
Delegated to: Eugen Hristev
Headers show
Series [U-Boot,01/12,v2] arm: at91: Makefile: Compile lowlevel_init only when really necessary | expand

Commit Message

Stefan Roese March 26, 2019, 12:16 p.m. UTC
This patch adds some checks, so that the watchdog can be enabled in main
U-Boot proper but can be disabled in SPL.

This will be used by some AT91SAM based boards, which might enable the
watchdog in the main U-Boot proper and not in SPL. It will be enabled in
SPL by default there, so no need to configure it there. This approach
saves some space in SPL.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Andreas Bießmann <andreas@biessmann.org>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
---
v2:
- No change

 include/watchdog.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Heiko Schocher March 29, 2019, 10:22 a.m. UTC | #1
Hello Stefan,

Am 26.03.2019 um 13:16 schrieb Stefan Roese:
> This patch adds some checks, so that the watchdog can be enabled in main
> U-Boot proper but can be disabled in SPL.
> 
> This will be used by some AT91SAM based boards, which might enable the
> watchdog in the main U-Boot proper and not in SPL. It will be enabled in
> SPL by default there, so no need to configure it there. This approach
> saves some space in SPL.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Andreas Bießmann <andreas@biessmann.org>
> Cc: Eugen Hristev <eugen.hristev@microchip.com>
> ---
> v2:
> - No change
> 
>   include/watchdog.h | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)


Reviewed-by: Heiko Schocher <hs@denx.de>
Tested on the taurus board:
Tested-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
diff mbox series

Patch

diff --git a/include/watchdog.h b/include/watchdog.h
index 14073cfdd2..3a357de903 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -51,9 +51,15 @@  int init_func_watchdog_reset(void);
 		#if defined(__ASSEMBLY__)
 			#define WATCHDOG_RESET bl watchdog_reset
 		#else
-			extern void watchdog_reset(void);
+			/* Don't require the watchdog to be enabled in SPL */
+			#if defined(CONFIG_SPL_BUILD) &&		\
+				!defined(CONFIG_SPL_WATCHDOG_SUPPORT)
+				#define WATCHDOG_RESET() {}
+			#else
+				extern void watchdog_reset(void);
 
-			#define WATCHDOG_RESET watchdog_reset
+				#define WATCHDOG_RESET watchdog_reset
+			#endif
 		#endif
 	#else
 		/*