mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Joacim Zetterling <joacim.zetterling@westermo.com>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] ARM: at91: sama5d27-som1: autoping watchdog during barebox runtime
Date: Mon, 12 Feb 2024 16:46:17 +0100	[thread overview]
Message-ID: <20240212154617.2260448-1-a.fatoum@pengutronix.de> (raw)

The BootROM arms the watchdog with the maximum timeout of 16 seconds on
boot. This is ample time to boot into Linux userspace, so so far we
didn't touch the watchdog for the SAMA5D2 in barebox and expected the
user to disable the watchdog manually, e.g. via the `wd -x` command or
by storing nv.autoboot=abort into the environment.

While this works, this is admittedly bad user experience, so let's just
enable watchdog polling in barebox instead. That way, we still have
watchdog supervision, but don't reset when dropping into the barebox
shell.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/sama5d27-som1/Makefile                        | 1 +
 arch/arm/boards/sama5d27-som1/board.c                         | 4 ++++
 .../defaultenv-sama5d27-som1/nv/dev.wdog0.autoping            | 1 +
 arch/arm/configs/at91_multi_defconfig                         | 1 +
 4 files changed, 7 insertions(+)
 create mode 100644 arch/arm/boards/sama5d27-som1/defaultenv-sama5d27-som1/nv/dev.wdog0.autoping

diff --git a/arch/arm/boards/sama5d27-som1/Makefile b/arch/arm/boards/sama5d27-som1/Makefile
index 5678718188b9..96cd8f520f5a 100644
--- a/arch/arm/boards/sama5d27-som1/Makefile
+++ b/arch/arm/boards/sama5d27-som1/Makefile
@@ -2,3 +2,4 @@
 
 lwl-y += lowlevel.o
 obj-y += board.o
+bbenv-$(CONFIG_DEFAULT_ENVIRONMENT) += defaultenv-sama5d27-som1
diff --git a/arch/arm/boards/sama5d27-som1/board.c b/arch/arm/boards/sama5d27-som1/board.c
index 00c0e92a5da3..6fa903bca4f6 100644
--- a/arch/arm/boards/sama5d27-som1/board.c
+++ b/arch/arm/boards/sama5d27-som1/board.c
@@ -5,6 +5,7 @@
 #include <init.h>
 #include <asm/memory.h>
 #include <bbu.h>
+#include <envfs.h>
 #include <bootsource.h>
 #include <of.h>
 
@@ -30,6 +31,9 @@ static int ek_device_init(void)
 				     filetype_arm_barebox);
 	bbu_register_std_file_update("microSD", flags_usd, "/mnt/mmc1.0/barebox.bin",
 				     filetype_arm_barebox);
+
+	defaultenv_append_directory(defaultenv_sama5d27_som1);
+
 	return 0;
 }
 device_initcall(ek_device_init);
diff --git a/arch/arm/boards/sama5d27-som1/defaultenv-sama5d27-som1/nv/dev.wdog0.autoping b/arch/arm/boards/sama5d27-som1/defaultenv-sama5d27-som1/nv/dev.wdog0.autoping
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/arch/arm/boards/sama5d27-som1/defaultenv-sama5d27-som1/nv/dev.wdog0.autoping
@@ -0,0 +1 @@
+1
diff --git a/arch/arm/configs/at91_multi_defconfig b/arch/arm/configs/at91_multi_defconfig
index e24bb36c2890..01e4526329f4 100644
--- a/arch/arm/configs/at91_multi_defconfig
+++ b/arch/arm/configs/at91_multi_defconfig
@@ -132,6 +132,7 @@ CONFIG_KEYBOARD_QT1070=y
 CONFIG_KEYBOARD_USB=y
 CONFIG_INPUT_SPECIALKEYS=y
 CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_POLLER=y
 CONFIG_WATCHDOG_AT91SAM9=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED=y
-- 
2.39.2




             reply	other threads:[~2024-02-12 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 15:46 Ahmad Fatoum [this message]
2024-02-13  9:20 ` Sascha Hauer

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=20240212154617.2260448-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=joacim.zetterling@westermo.com \
    /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