mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: at91: sama5d27-som1: autoping watchdog during barebox runtime
@ 2024-02-12 15:46 Ahmad Fatoum
  2024-02-13  9:20 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-02-12 15:46 UTC (permalink / raw)
  To: barebox; +Cc: Joacim Zetterling, Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-13  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 15:46 [PATCH] ARM: at91: sama5d27-som1: autoping watchdog during barebox runtime Ahmad Fatoum
2024-02-13  9:20 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox