From 107b29ee677fe2aac04c8b32d42d39b4cbb2e393 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Wed, 29 Jan 2025 13:49:04 +0200 Subject: [PATCH] arch/risc-v/src/mfs_start.c: After failed DDR training, reset with WDT Resetting via WDT leaves more proper reset reason in SYSREG_RESET_SR than resetting via soft reset. Signed-off-by: Jukka Laitinen --- arch/risc-v/src/mpfs/mpfs_start.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/risc-v/src/mpfs/mpfs_start.c b/arch/risc-v/src/mpfs/mpfs_start.c index f6c95437444..e16ed2184e9 100644 --- a/arch/risc-v/src/mpfs/mpfs_start.c +++ b/arch/risc-v/src/mpfs/mpfs_start.c @@ -37,6 +37,7 @@ #include "mpfs_cache.h" #include "mpfs_mm_init.h" #include "mpfs_userspace.h" +#include "hardware/mpfs_wdog.h" #include "riscv_internal.h" #include "riscv_percpu.h" @@ -149,7 +150,15 @@ void __mpfs_start(uint64_t mhartid) /* Reset, but let the progress come out of the uart first */ up_udelay(1000); - up_systemreset(); + + /* Reset by triggering WDOG */ + + putreg32(WDOG_FORCE_IMMEDIATE_RESET, + MPFS_WDOG0_LO_BASE + MPFS_WDOG_FORCE_OFFSET); + + /* Wait for the reset */ + + for (; ; ); } #endif