[PATCH 4/7] board: phytec: phycore-am62x: Add watchdog start to bootcmd

Wadim Egorov w.egorov at phytec.de
Wed Jul 30 17:42:14 CEST 2025


Allows run-time control over watchdog auto-start and the timeout via
setting the environment variable watchdog_timeout_ms. A value of zero
means "do not start". Use CONFIG_WATCHDOG_TIMEOUT_MSECS as initial value.
Users can enable the watchdog to monitor the boot process until userspace
or OS takes over to serve the watchdog.

Signed-off-by: Wadim Egorov <w.egorov at phytec.de>
---
 board/phytec/phycore_am62x/phycore_am62x.env |  3 +++
 configs/phycore_am62x_a53_defconfig          |  7 ++++++-
 include/env/phytec/watchdog.env              | 11 +++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 include/env/phytec/watchdog.env

diff --git a/board/phytec/phycore_am62x/phycore_am62x.env b/board/phytec/phycore_am62x/phycore_am62x.env
index 797904013dc..3f4b3cc4f0d 100644
--- a/board/phytec/phycore_am62x/phycore_am62x.env
+++ b/board/phytec/phycore_am62x/phycore_am62x.env
@@ -2,6 +2,7 @@
 #include <env/phytec/k3_mmc.env>
 #include <env/phytec/k3_net.env>
 #include <env/phytec/k3_spi.env>
+#include <env/phytec/watchdog.env>
 
 fdtaddr=0x88000000
 loadaddr=0x82000000
@@ -27,3 +28,5 @@ spi_ramdisk_addr=0x2200000
 
 bootmeths=script efi extlinux pxe
 boot_targets=mmc1 mmc0 spi_flash dhcp
+
+watchdog=watchdog at e000000
diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig
index 978604b0232..931ec39905b 100644
--- a/configs/phycore_am62x_a53_defconfig
+++ b/configs/phycore_am62x_a53_defconfig
@@ -44,7 +44,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
 CONFIG_BOOTSTD_FULL=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="bootflow scan -lb; run ${boot}boot"
+CONFIG_BOOTCOMMAND="run start_watchdog; bootflow scan -lb; run ${boot}boot"
 CONFIG_DEFAULT_FDT_FILE="oftree"
 # CONFIG_BOARD_INIT is not set
 CONFIG_BOARD_LATE_INIT=y
@@ -79,6 +79,7 @@ CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_WDT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EFIDEBUG=y
 CONFIG_CMD_RTC=y
@@ -175,5 +176,9 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0451
 CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_SPL_DFU=y
+# CONFIG_WATCHDOG is not set
+# CONFIG_WATCHDOG_AUTOSTART is not set
+CONFIG_WDT=y
+CONFIG_WDT_K3_RTI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 # CONFIG_HEXDUMP is not set
diff --git a/include/env/phytec/watchdog.env b/include/env/phytec/watchdog.env
new file mode 100644
index 00000000000..f2e65baf1e9
--- /dev/null
+++ b/include/env/phytec/watchdog.env
@@ -0,0 +1,11 @@
+watchdog_timeout_ms=CONFIG_WATCHDOG_TIMEOUT_MSECS
+start_watchdog=
+	if test ${watchdog_timeout_ms} -gt 0; then;
+		if test -z "${watchdog}"; then;
+			echo No watchdog device set, skipping watchdog start;
+		else;
+			wdt dev ${watchdog};
+			wdt start ${watchdog_timeout_ms};
+			echo Watchdog started, timeout ${watchdog_timeout_ms} ms;
+		fi;
+	fi;
-- 
2.48.1



More information about the U-Boot mailing list