All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH u-boot-marvell v2 1/2] arm: mvebu: spl: Add option to reset the board on DDR training failure
@ 2022-02-17 12:54 Marek Behún
  2022-02-17 12:54 ` [PATCH u-boot-marvell v2 2/2] arm: mvebu: turris_omnia: Reset the board immediately " Marek Behún
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Marek Behún @ 2022-02-17 12:54 UTC (permalink / raw)
  To: Chris Packham, Stefan Roese; +Cc: pali, u-boot@lists.denx.de, Marek Behún

From: Marek Behún <marek.behun@nic.cz>

Some boards may occacionally fail DDR training. Currently we hang() in
this case. Add an option that makes the board do an immediate reset in
such a case, so that a new training is tried as soon as possible,
instead of hanging and possibly waiting for watchdog to reset the board.

(If the DDR training fails while booting the image via UART, we will
 still hang - it doesn't make sense to reset in such a case, because
 after reset the board will try booting from another medium, and the
 UART booting utility does not expect that.)

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
Changes since v1:
- dont reset if booting via UART, as suggested by Pali
---
 arch/arm/mach-mvebu/Kconfig | 13 +++++++++++++
 arch/arm/mach-mvebu/spl.c   |  7 ++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index d23cc0c760..7d487f270b 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -213,6 +213,19 @@ config DDR_LOG_LEVEL
 	  At level 3, rovides the windows margin of each DQ as a results of
 	  DQS centeralization.
 
+config DDR_RESET_ON_TRAINING_FAILURE
+	bool "Reset the board on DDR training failure instead of hanging"
+	depends on ARMADA_38X || ARMADA_XP
+	help
+	  If DDR training fails in SPL, reset the board instead of hanging.
+	  Some boards are known to fail DDR training occasionally and an
+	  immediate reset may be preferable to waiting until the board is
+	  reset by watchdog (if there even is one).
+
+	  Note that if booting via UART and the DDR training fails, the
+	  device will still hang - it doesn't make sense to reset the board
+	  in such a case.
+
 config SYS_BOARD
 	default "clearfog" if TARGET_CLEARFOG
 	default "helios4" if TARGET_HELIOS4
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 273ecb8bd6..5ad323f9d9 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <cpu_func.h>
 #include <dm.h>
 #include <fdtdec.h>
 #include <hang.h>
@@ -330,7 +331,11 @@ void board_init_f(ulong dummy)
 	ret = ddr3_init();
 	if (ret) {
 		printf("ddr3_init() failed: %d\n", ret);
-		hang();
+		if (IS_ENABLED(CONFIG_DDR_RESET_ON_TRAINING_FAILURE) &&
+		    get_boot_device() != BOOT_DEVICE_UART)
+			reset_cpu();
+		else
+			hang();
 	}
 #endif
 
-- 
2.34.1


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

end of thread, other threads:[~2022-02-17 15:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-17 12:54 [PATCH u-boot-marvell v2 1/2] arm: mvebu: spl: Add option to reset the board on DDR training failure Marek Behún
2022-02-17 12:54 ` [PATCH u-boot-marvell v2 2/2] arm: mvebu: turris_omnia: Reset the board immediately " Marek Behún
2022-02-17 13:12   ` Stefan Roese
2022-02-17 13:13   ` Pali Rohár
2022-02-17 15:39   ` Stefan Roese
2022-02-17 13:10 ` [PATCH u-boot-marvell v2 1/2] arm: mvebu: spl: Add option to reset the board " Pali Rohár
2022-02-17 13:11 ` Stefan Roese
2022-02-17 15:39 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.