[PATCH] kvx: watchdog: Add early watchdog init
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Oct 24 06:03:50 PDT 2024
On 24.10.24 14:35, Julian Vetter wrote:
fdef CONFIG_WATCHDOG_KVX_EARLY_INIT>>
>> Move this down before the core_initcall
>>
>>> +static int kvx_wdt_early_init(void)
>>
>> Add __maybe_unused here.
>>
>> That way compile test in CI tests this function even if option is disabled.
>>
>
> I have tried what you proposed but the CONFIG_WATCHDOG_KVX_EARLY_TIMEOUT is only defined if we enable the CONFIG_WATCHDOG_KVX_EARLY_INIT. So, it fails if we have the watchdog enabled but not the EARLY_INIT. I could either keep the #ifdef before the function. So, it will not be covered by compile tests or I add something like the following to the function:
>
> int wtd_timeout = 0;
>
> #ifdef CONFIG_WATCHDOG_KVX_EARLY_INIT
> wtd_timeout = CONFIG_WATCHDOG_KVX_EARLY_TIMEOUT
> #endif
>
> What do you think?
I missed the undefined macro. Never mind then, I think
we can leave it as is.
Cheers,
Ahmad
>
> Thank you.
>
>>> +{
>>> + /* Set Start watchdog counting */
>>> + kvx_sfr_set(WDV, CONFIG_WATCHDOG_KVX_EARLY_TIMEOUT);
>>> + kvx_sfr_set(WDR, 0);
>>> +
>>> + /* Start watchdog counting */
>>> + kvx_sfr_set_field(TCR, WUI, 1);
>>> + kvx_sfr_set_field(TCR, WCE, 1);
>>> +
>>> + return 0;
>>> +}
>>> +core_initcall(kvx_wdt_early_init);
>>> +#endif
>>
>>
>
>
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list