public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michael Opdenacker <michael.opdenacker@bootlin.com>
To: "u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: ARM: mach-at91: how to stop U-Boot/SPL from disabling the watchdog timer on SAMAD3 Xplained
Date: Thu, 9 Dec 2021 17:32:51 +0100	[thread overview]
Message-ID: <d2fdd4c1-2f8f-ab9f-fe38-5279e83684eb@bootlin.com> (raw)

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://lkml.org/lkml/2021/12/9/740

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://elixir.bootlin.com/linux/latest/source/drivers/watchdog/at91sam9_wdt.c#L10,
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.

A workaround is to use at91bootstrap instead of U-Boot SPL, which has a
configuration parameter to disable to watchdog:
git clone https://github.com/linux4sam/at91bootstrap.git
export CROSS_COMPILE=arm-linux- (whatever your cross-compiler is)
make sama5d3_xplainedsd_uboot_defconfig
make menuconfig (Disable CONFIG_DISABLE_WATCHDOG)
make
Copy boot.bin (under build/...) and u-boot.bin (from U-Boot sources) to
the SD card.

At least, this proves that the culprit is U-Boot SPL!

So, any advice for making it possible prevent the SPL from disabling the
watchdog on SAMA5D3 (Xplained at least)?

Cheers
Michael.

-- 
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


             reply	other threads:[~2021-12-09 16:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 16:32 Michael Opdenacker [this message]
2021-12-09 16:43 ` ARM: mach-at91: how to stop U-Boot/SPL from disabling the watchdog timer on SAMAD3 Xplained Quentin Schulz
2021-12-10  8:32   ` Michael Opdenacker

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=d2fdd4c1-2f8f-ab9f-fe38-5279e83684eb@bootlin.com \
    --to=michael.opdenacker@bootlin.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