[U-Boot] [PATCH 04/11] watchdog: Handle SPL build with watchdog disabled

Stefan Roese sr at denx.de
Wed Mar 20 07:33:07 UTC 2019


On 20.03.19 08:30, Eugen.Hristev at microchip.com wrote:
> 
> 
> On 19.03.2019 17:56, Stefan Roese wrote:
>> External E-Mail
>>
>>
>> This patch adds some checks, so that the watchdog can be enabled in main
>> U-Boot proper but can be disabled in SPL.
> 
> Hi Stefan,
> 
> Actually your code looks at CONFIG_SPL_WATCHDOG_SUPPORT , so , if this
> is disabled in the config, you say that the watchdog was still enabled?
> (thus broken CONFIG_SPL_WATCHDOG_SUPPORT ?)

Yes, in my case here, the watchdog is disabled in SPL and enabled in
main U-Boot proper. This use case is what this patch fixes.

Is this still unclear? Sorry, I didn't fully understand your question.

Thanks,
Stefan
  
> Eugen
> 
>>
>> 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 at denx.de>
>> Cc: Heiko Schocher <hs at denx.de>
>> Cc: Andreas Bießmann <andreas at biessmann.org>
>> Cc: Eugen Hristev <eugen.hristev at microchip.com>
>> ---
>>    include/watchdog.h | 10 ++++++++--
>>    1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> 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
>>    		/*
>>

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list