
Hi Michael,
On Thu, Dec 09, 2021 at 05:32:51PM +0100, Michael Opdenacker wrote:
Greetings,
Documenting the issue and a workaround here in case other people encounter it, but if you have tips for fixing the issue in U-Boot, I'm interested of course!
I noticed that the SAMA5D3 Xplained board didn't have the watchdog timer enabled in the Linux DTS. I submitted a patch to fix this: https://urldefense.proofpoint.com/v2/url?u=https-3A__lkml.org_lkml_2021_12_9...
However, applying this patch isn't sufficient to make the watchdog available on Linux: at91_wdt fffffe40.watchdog: watchdog is disabled at91_wdt: probe of fffffe40.watchdog failed with error -22
As explained on https://urldefense.proofpoint.com/v2/url?u=https-3A__elixir.bootlin.com_linu... , this happens because the bootloader or bootstrap code already disables the watchdog. The trouble is, unlike on SAMA5D2 and SAMAD4 (if I understood correctly),"The Watchdog Timer Mode Register can be only written to once".
However, I haven't managed to disable this behavior in U-Boot (including the SPL). I have no watchdog related option turned on anywhere, and by adding puts() messages in the code, I believe that the wdt_stop() function doesn't get called either. Maybe the corresponding watchdog register is written to by the code initializing the SoC, but I couldn't find where.
From a quick look at the code, you need to enable CONFIG_WDT_AT91 and
the watchdog won't be disabled anymore by the SPL.
See: https://elixir.bootlin.com/u-boot/latest/source/arch/arm/mach-at91/spl_atmel... and https://elixir.bootlin.com/u-boot/latest/source/arch/arm/mach-at91/spl.c#L16
Cheers, Quentin