Skip to contentSkip to conversation

Turris Omnia DDR training changes

PATCH In review Marek Behún 3 participants 19 messages Apr 15, 2024 – May 15, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Turris Omnia DDR training changes

Hi Stefan,

this series adds some changes to DDR3 training for Armada 38x and Turris Omnia.

- patches 1-4 are meant to allow for reducing another 10 KiB in the SPL binary. They were also sent to mv-ddr-marvell, via PR on github,
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/45/
but I am told that Armada team has left Marvell, so who knows if this will ever be merged there
- patch 5 enables this reduction for Turris Omnia
- patches 6-8 import old DDR3 training code and make some changes so that it works with U-Boot. The reason why this is being done is explained in patch 6
- patch 9 glues the old DDR3 training code to current U-Boot
- patch 10 allows for dynamic selection of old DDR3 training code on Turris Omnia, via an U-Boot environment variable

Marek

Marek Behún (10):
ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if
we won't print anything
ddr: marvell: a38x: debug: Remove unused variables
ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if
needed, and make them static
ddr: marvell: a38x: debug: Allow compiling with immutable debug
settings to reduce binary size
arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3
training by default
ddr: marvell: a38x: Import old DDR training code from 2017 version of
U-Boot
ddr: marvell: a38x: old: Fix some compiler warning of the old code
ddr: marvell: a38x: old: Backport immutable debug settings
arm: mvebu: a38x: Add optional support for using old DDR3 training
code
arm: mvebu: turris_omnia: Support old DDR3 training, selectable via
env var

 arch/arm/mach-mvebu/Kconfig                   |   15 +
 arch/arm/mach-mvebu/include/mach/cpu.h        |    1 +
 arch/arm/mach-mvebu/spl.c                     |   37 +-
 board/CZ.NIC/turris_omnia/Makefile            |    1 +
 board/CZ.NIC/turris_omnia/old_ddr3_training.c |   79 +
 board/CZ.NIC/turris_omnia/turris_omnia.c      |    2 +-
 configs/turris_omnia_defconfig                |    1 +
 drivers/ddr/marvell/a38x/Makefile             |    2 +
 drivers/ddr/marvell/a38x/ddr3_debug.c         |   30 +-
 drivers/ddr/marvell/a38x/ddr3_init.c          |    3 +-
 drivers/ddr/marvell/a38x/ddr3_init.h          |   43 +-
 drivers/ddr/marvell/a38x/old/Makefile         |   29 +
 drivers/ddr/marvell/a38x/old/ddr3_a38x.c      |  738 +++++
 drivers/ddr/marvell/a38x/old/ddr3_a38x.h      |   93 +
 .../marvell/a38x/old/ddr3_a38x_mc_static.h    |  226 ++
 .../ddr/marvell/a38x/old/ddr3_a38x_topology.h |   22 +
 .../ddr/marvell/a38x/old/ddr3_a38x_training.c |   40 +
 drivers/ddr/marvell/a38x/old/ddr3_debug.c     | 1545 ++++++++++
 .../marvell/a38x/old/ddr3_hws_hw_training.c   |  148 +
 .../marvell/a38x/old/ddr3_hws_hw_training.h   |   49 +
 .../a38x/old/ddr3_hws_hw_training_def.h       |  464 +++
 .../marvell/a38x/old/ddr3_hws_sil_training.h  |   17 +
 drivers/ddr/marvell/a38x/old/ddr3_init.c      |  770 +++++
 drivers/ddr/marvell/a38x/old/ddr3_init.h      |  405 +++
 .../ddr/marvell/a38x/old/ddr3_logging_def.h   |  101 +
 .../marvell/a38x/old/ddr3_patterns_64bit.h    |  924 ++++++
 .../ddr/marvell/a38x/old/ddr3_topology_def.h  |   76 +
 drivers/ddr/marvell/a38x/old/ddr3_training.c  | 2651 +++++++++++++++++
 .../ddr/marvell/a38x/old/ddr3_training_bist.c |  289 ++
 .../a38x/old/ddr3_training_centralization.c   |  712 +++++
 .../ddr/marvell/a38x/old/ddr3_training_db.c   |  652 ++++
 .../marvell/a38x/old/ddr3_training_hw_algo.c  |  686 +++++
 .../marvell/a38x/old/ddr3_training_hw_algo.h  |   14 +
 .../ddr/marvell/a38x/old/ddr3_training_ip.h   |  178 ++
 .../marvell/a38x/old/ddr3_training_ip_bist.h  |   54 +
 .../old/ddr3_training_ip_centralization.h     |   15 +
 .../marvell/a38x/old/ddr3_training_ip_db.h    |   34 +
 .../marvell/a38x/old/ddr3_training_ip_def.h   |  173 ++
 .../a38x/old/ddr3_training_ip_engine.c        | 1355 +++++++++
 .../a38x/old/ddr3_training_ip_engine.h        |   85 +
 .../marvell/a38x/old/ddr3_training_ip_flow.h  |  349 +++
 .../marvell/a38x/old/ddr3_training_ip_pbs.h   |   41 +
 .../a38x/old/ddr3_training_ip_prv_if.h        |  107 +
 .../a38x/old/ddr3_training_ip_static.h        |   31 +
 .../marvell/a38x/old/ddr3_training_leveling.c | 1837 ++++++++++++
 .../marvell/a38x/old/ddr3_training_leveling.h |   17 +
 .../ddr/marvell/a38x/old/ddr3_training_pbs.c  |  995 +++++++
 .../marvell/a38x/old/ddr3_training_static.c   |  538 ++++
 .../ddr/marvell/a38x/old/ddr_topology_def.h   |  121 +
 .../ddr/marvell/a38x/old/ddr_training_ip_db.h |   16 +
 .../marvell/a38x/old/glue_symbol_renames.h    |  247 ++
 drivers/ddr/marvell/a38x/old/silicon_if.h     |   17 +
 drivers/ddr/marvell/a38x/old/xor.h            |   92 +
 53 files changed, 17138 insertions(+), 29 deletions(-)
 create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/glue_symbol_renames.h
 create mode 100644 drivers/ddr/marvell/a38x/old/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/xor.h
Signature · 1 line
2.43.2
#2 lore raw

PATCH 2/10 ddr: marvell: a38x: debug: Remove unused variables

The variables is_default_centralization, is_tune_result and is_bist_reset_bit are never used.

---
 drivers/ddr/marvell/a38x/ddr3_debug.c | 3 ---
 drivers/ddr/marvell/a38x/ddr3_init.h  | 1 -
 2 files changed, 4 deletions(-)
drivers/ddr/marvell/a38x/ddr3_debug.c +0 -3
index 0374a84387..c659ae92d8 100644
@@ -117,12 +117,9 @@ u32 ctrl_level_phase[MAX_CS_NUM * MAX_INTERFACE_NUM * MAX_BUS_NUM];
 #endif /* DDR_VIEWER_TOOL */
 
 struct hws_tip_config_func_db config_func_info[MAX_DEVICE_NUM];
-u8 is_default_centralization = 0;
-u8 is_tune_result = 0;
 u8 is_validate_window_per_if = 0;
 u8 is_validate_window_per_pup = 0;
 u8 sweep_cnt = 1;
-u32 is_bist_reset_bit = 1;
 u8 is_run_leveling_sweep_tests;
 
 static struct hws_xsb_info xsb_info[MAX_DEVICE_NUM];
drivers/ddr/marvell/a38x/ddr3_init.h +0 -1
index 6854bb49de..9288073a78 100644
@@ -116,7 +116,6 @@ extern u32 clamp_tbl[];
 extern u32 freq_mask[MAX_DEVICE_NUM][MV_DDR_FREQ_LAST];
 
 extern u32 maxt_poll_tries;
-extern u32 is_bist_reset_bit;
 
 extern u8 vref_window_size[MAX_INTERFACE_NUM][MAX_BUS_NUM];
 extern u32 effective_cs;
Signature · 1 line
2.43.2
#1 lore raw

PATCH 1/10 ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if we won't print anything

In reply to Marek Behún

Return from ddr3_tip_print_log() early if we won't print anything anyway.

This way the compiler can optimize away the VALIDATE_IF_ACTIVE() calls in the for-loop, so if the SILENT_LIB macro is defined, no code is generated for the rest of the function, which saves some space.

---
 drivers/ddr/marvell/a38x/ddr3_debug.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/ddr/marvell/a38x/ddr3_debug.c +9 -0
index 9e499cfb99..0374a84387 100644
@@ -399,6 +399,15 @@ int ddr3_tip_print_log(u32 dev_num, u32 mem_addr)
 	}
 #endif /* DDR_VIEWER_TOOL */
 
+	/* return early if we won't print anything anyway */
+	if (
+#if defined(SILENT_LIB)
+	    1 ||
+#endif
+	    debug_training < DEBUG_LEVEL_INFO) {
+		return MV_OK;
+	}
+
 	for (if_id = 0; if_id <= MAX_INTERFACE_NUM - 1; if_id++) {
 		VALIDATE_IF_ACTIVE(tm->if_act_mask, if_id);
 
Signature · 1 line
2.43.2
#3 lore raw

PATCH 3/10 ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if needed, and make them static

In reply to Marek Behún

The variables is_validate_window_per_if, is_validate_window_per_pup, sweep_cnt and is_run_leveling_sweep_tests are only used if DDR_VIEWER_TOOL macro is defined, so define them only in that case.

Make them static since they are only used in ddr3_debug.c.

---
 drivers/ddr/marvell/a38x/ddr3_debug.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/ddr/marvell/a38x/ddr3_debug.c +5 -4
index c659ae92d8..d32d42c408 100644
@@ -114,13 +114,14 @@ u32 ctrl_adll[MAX_CS_NUM * MAX_INTERFACE_NUM * MAX_BUS_NUM];
 u32 ctrl_adll1[MAX_CS_NUM * MAX_INTERFACE_NUM * MAX_BUS_NUM];
 u32 ctrl_level_phase[MAX_CS_NUM * MAX_INTERFACE_NUM * MAX_BUS_NUM];
 #endif /* EXCLUDE_SWITCH_DEBUG */
+
+static u8 is_validate_window_per_if = 0;
+static u8 is_validate_window_per_pup = 0;
+static u8 sweep_cnt = 1;
+static u8 is_run_leveling_sweep_tests;
 #endif /* DDR_VIEWER_TOOL */
 
 struct hws_tip_config_func_db config_func_info[MAX_DEVICE_NUM];
-u8 is_validate_window_per_if = 0;
-u8 is_validate_window_per_pup = 0;
-u8 sweep_cnt = 1;
-u8 is_run_leveling_sweep_tests;
 
 static struct hws_xsb_info xsb_info[MAX_DEVICE_NUM];
 
Signature · 1 line
2.43.2
#4 lore raw

PATCH 4/10 ddr: marvell: a38x: debug: Allow compiling with immutable debug settings to reduce binary size

In reply to Marek Behún

Allow compiling with immutable debug settings:
- DEBUG_LEVEL is always set to DEBUG_LEVEL_ERROR
- register dumps are disabled

This can save around 10 KiB of space in the resulting binary, which is a lot in U-Boot SPL.

---
 arch/arm/mach-mvebu/Kconfig           | 10 +++++++
 drivers/ddr/marvell/a38x/ddr3_debug.c |  9 ++++--
 drivers/ddr/marvell/a38x/ddr3_init.c  |  3 +-
 drivers/ddr/marvell/a38x/ddr3_init.h  | 42 ++++++++++++++++++++++-----
 4 files changed, 53 insertions(+), 11 deletions(-)
arch/arm/mach-mvebu/Kconfig +10 -0
index f15d3cc5ed..a320793a30 100644
@@ -250,6 +250,16 @@ config DDR_LOG_LEVEL
 	  At level 3, rovides the windows margin of each DQ as a results of
 	  DQS centeralization.
 
+config DDR_IMMUTABLE_DEBUG_SETTINGS
+	bool "Immutable DDR debug level (always DEBUG_LEVEL_ERROR)"
+	depends on ARMADA_38X
+	help
+	  Makes the DDR training code debug level settings immutable.
+	  The debug level setting from board topology definition is ignored.
+	  The debug level is always set to DEBUG_LEVEL_ERROR and register
+	  dumps are disabled.
+	  This can save around 10 KiB of space in SPL binary.
+
 config DDR_RESET_ON_TRAINING_FAILURE
 	bool "Reset the board on DDR training failure instead of hanging"
 	depends on ARMADA_38X || ARMADA_XP
drivers/ddr/marvell/a38x/ddr3_debug.c +6 -3
index d32d42c408..0b65168d82 100644
@@ -7,18 +7,21 @@
 #include "mv_ddr_training_db.h"
 #include "mv_ddr_regs.h"
 
+#if !defined(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS)
 u8 is_reg_dump = 0;
 u8 debug_pbs = DEBUG_LEVEL_ERROR;
+#endif
 
 /*
  * API to change flags outside of the lib
  */
-#if defined(SILENT_LIB)
+#if defined(SILENT_LIB) || defined(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS)
 void ddr3_hws_set_log_level(enum ddr_lib_debug_block block, u8 level)
 {
 	/* do nothing */
 }
-#else /* SILENT_LIB */
+#else /* !SILENT_LIB && !CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS */
+
 /* Debug flags for other Training modules */
 u8 debug_training_static = DEBUG_LEVEL_ERROR;
 u8 debug_training = DEBUG_LEVEL_ERROR;
@@ -104,7 +107,7 @@ void ddr3_hws_set_log_level(enum ddr_lib_debug_block block, u8 level)
 #endif /* CONFIG_DDR4 */
 	}
 }
-#endif /* SILENT_LIB */
+#endif /* !SILENT_LIB && !CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS */
 
 #if defined(DDR_VIEWER_TOOL)
 static char *convert_freq(enum mv_ddr_freq freq);
drivers/ddr/marvell/a38x/ddr3_init.c +2 -1
index 27eb3ac173..7c5147f474 100644
@@ -41,7 +41,8 @@ int ddr3_init(void)
 	mv_ddr_pre_training_soc_config(ddr_type);
 
 	/* Set log level for training library */
-	mv_ddr_user_log_level_set(DEBUG_BLOCK_ALL);
+	if (!IS_ENABLED(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS))
+		mv_ddr_user_log_level_set(DEBUG_BLOCK_ALL);
 
 	mv_ddr_early_init();
 
drivers/ddr/marvell/a38x/ddr3_init.h +35 -7

65 lines not on this page · raw message

Signature · 1 line
2.43.2
#5 lore raw

PATCH 5/10 arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3 training by default

In reply to Marek Behún

Save 10 KiB in Turris Omnia's SPL binary by enabling immutable debug settings for DDR3 training code.

---
 configs/turris_omnia_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/turris_omnia_defconfig +1 -0
index f2b39115fe..02edd335c1 100644
@@ -10,6 +10,7 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xff0000
 CONFIG_TARGET_TURRIS_OMNIA=y
+CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS=y
 CONFIG_DDR_RESET_ON_TRAINING_FAILURE=y
 CONFIG_MVEBU_EFUSE_VHV_GPIO="mcu_56"
 CONFIG_MVEBU_EFUSE_VHV_GPIO_ACTIVE_LOW=y
Signature · 1 line
2.43.2
#7 lore raw

PATCH 7/10 ddr: marvell: a38x: old: Fix some compiler warning of the old code

In reply to Marek Behún

Fix some compilation warning in the old DDR training code.

---
 drivers/ddr/marvell/a38x/old/ddr3_a38x.c               | 1 +
 drivers/ddr/marvell/a38x/old/ddr3_init.h               | 2 ++
 drivers/ddr/marvell/a38x/old/ddr3_training.c           | 1 +
 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c | 1 +
 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c  | 1 +
 5 files changed, 6 insertions(+)
drivers/ddr/marvell/a38x/old/ddr3_a38x.c +1 -0
index c082122f25..32a14ca4c9 100644
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_init.h"
 
drivers/ddr/marvell/a38x/old/ddr3_init.h +2 -0
index 8cb08864c2..ad95cc9ef8 100644
@@ -291,7 +291,9 @@ extern struct cl_val_per_freq cas_latency_table[];
 extern u32 target_freq;
 extern struct hws_tip_config_func_db config_func_info[HWS_MAX_DEVICE_NUM];
 extern u32 clamp_tbl[];
+#if 0
 extern u32 init_freq;
+#endif
 /* list of allowed frequency listed in order of enum hws_ddr_freq */
 extern u32 freq_val[];
 extern u8 debug_training_static;
drivers/ddr/marvell/a38x/old/ddr3_training.c +1 -0
index e70ca4b425..572a69d45a 100644
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_init.h"
 
drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c +1 -0
index 011824ab42..ee789f0993 100644
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_init.h"
 
drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c +1 -0
index 3c40f198e7..c5043eefa3 100644
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_init.h"
 
Signature · 1 line
2.43.2
#8 lore raw

PATCH 8/10 ddr: marvell: a38x: old: Backport immutable debug settings

In reply to Marek Behún

Backport the option to compile with immutable debug settings also to the old implementation of the DDR3 training code.

The original PR for mv-ddr-marvell can be seen at
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/45/

---
 drivers/ddr/marvell/a38x/old/ddr3_debug.c | 32 ++++++++++++++----
 drivers/ddr/marvell/a38x/old/ddr3_init.c  |  3 +-
 drivers/ddr/marvell/a38x/old/ddr3_init.h  | 40 ++++++++++++++---------
 3 files changed, 52 insertions(+), 23 deletions(-)
drivers/ddr/marvell/a38x/old/ddr3_debug.c +25 -7
index a704a3e9d3..e1ae46dc82 100644
@@ -13,13 +13,15 @@
 
 #include "ddr3_init.h"
 
+#if !defined(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS)
 u8 is_reg_dump = 0;
 u8 debug_pbs = DEBUG_LEVEL_ERROR;
+#endif
 
 /*
  * API to change flags outside of the lib
  */
-#ifndef SILENT_LIB
+#if !defined(SILENT_LIB) && !defined(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS)
 /* Debug flags for other Training modules */
 u8 debug_training_static = DEBUG_LEVEL_ERROR;
 u8 debug_training = DEBUG_LEVEL_ERROR;
@@ -84,12 +86,13 @@ void ddr3_hws_set_log_level(enum ddr_lib_debug_block block, u8 level)
 #endif
 
 struct hws_tip_config_func_db config_func_info[HWS_MAX_DEVICE_NUM];
-u8 is_default_centralization = 0;
-u8 is_tune_result = 0;
-u8 is_validate_window_per_if = 0;
-u8 is_validate_window_per_pup = 0;
-u8 sweep_cnt = 1;
-u32 is_bist_reset_bit = 1;
+
+#if 0
+static u8 is_validate_window_per_if = 0;
+static u8 is_validate_window_per_pup = 0;
+static u8 sweep_cnt = 1;
+#endif
+
 static struct hws_xsb_info xsb_info[HWS_MAX_DEVICE_NUM];
 
 /*
@@ -292,6 +295,7 @@ int print_device_info(u8 dev_num)
 	return MV_OK;
 }
 
+#if 0
 void hws_ddr3_tip_sweep_test(int enable)
 {
 	if (enable) {
@@ -304,6 +308,7 @@ void hws_ddr3_tip_sweep_test(int enable)
 	}
 }
 #endif
+#endif
 
 char *ddr3_tip_convert_tune_result(enum hws_result tune_result)
 {
@@ -327,6 +332,7 @@ int ddr3_tip_print_log(u32 dev_num, u32 mem_addr)
 	u32 if_id = 0;
 	struct hws_topology_map *tm = ddr3_get_topology_map();
 
+#if 0
 #ifndef EXCLUDE_SWITCH_DEBUG
 	if ((is_validate_window_per_if != 0) ||
 	    (is_validate_window_per_pup != 0)) {
@@ -347,8 +353,18 @@ int ddr3_tip_print_log(u32 dev_num, u32 mem_addr)
 		CHECK_STATUS(ddr3_tip_restore_dunit_regs(dev_num));
 		ddr3_tip_reg_dump(dev_num);
 	}
+#endif
 #endif
 
+	/* return early if we won't print anything anyway */
+	if (
+#if defined(SILENT_LIB)
+	    1 ||
+#endif
+	    debug_training < DEBUG_LEVEL_INFO) {
+		return MV_OK;
+	}
+
 	for (if_id = 0; if_id <= MAX_INTERFACE_NUM - 1; if_id++) {
 		VALIDATE_ACTIVE(tm->if_act_mask, if_id);
 
@@ -789,6 +805,7 @@ int ddr3_tip_print_adll(void)
 	return MV_OK;
 }
 
+#if 0
 /*
  * Set attribute value
  */
@@ -1156,6 +1173,7 @@ static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32 value, u32 **ptr)
 
 	return MV_OK;
 }
+#endif
 
 #ifndef EXCLUDE_SWITCH_DEBUG
 /*
drivers/ddr/marvell/a38x/old/ddr3_init.c +2 -1
index 55baad498a..7230bc2a86 100644
@@ -386,7 +386,8 @@ int ddr3_init(void)
 		return status;
 
 	/* Set log level for training lib */
-	ddr3_hws_set_log_level(DEBUG_BLOCK_ALL, DEBUG_LEVEL_ERROR);
+	if (!IS_ENABLED(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS))
+		ddr3_hws_set_log_level(DEBUG_BLOCK_ALL, DEBUG_LEVEL_ERROR);
 
 	/* Start New Training IP */
 	status = ddr3_hws_hw_training();
drivers/ddr/marvell/a38x/old/ddr3_init.h +25 -15
index ad95cc9ef8..5090cf97a7 100644
@@ -152,17 +152,38 @@ enum log_level  {
 };
 
 /* Globals */
-extern u8 debug_training;
+#if defined(CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS)
+static const u8 is_reg_dump = 0;
+static const u8 debug_training_static = DEBUG_LEVEL_ERROR;
+static const u8 debug_training = DEBUG_LEVEL_ERROR;
+static const u8 debug_leveling = DEBUG_LEVEL_ERROR;
+static const u8 debug_centralization = DEBUG_LEVEL_ERROR;
+static const u8 debug_training_ip = DEBUG_LEVEL_ERROR;
+static const u8 debug_training_bist = DEBUG_LEVEL_ERROR;
+static const u8 debug_training_hw_alg = DEBUG_LEVEL_ERROR;
+static const u8 debug_training_access = DEBUG_LEVEL_ERROR;
+static const u8 debug_training_a38x = DEBUG_LEVEL_ERROR;
+static const u8 debug_pbs = DEBUG_LEVEL_ERROR;
+#else /* !CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS */
 extern u8 is_reg_dump;
+extern u8 debug_training_static;
+extern u8 debug_training;
+extern u8 debug_leveling;
+extern u8 debug_centralization;
+extern u8 debug_training_ip;
+extern u8 debug_training_bist;
+extern u8 debug_training_hw_alg;
+extern u8 debug_training_access;
+extern u8 debug_training_a38x;
+extern u8 debug_pbs;
+#endif /* !CONFIG_DDR_IMMUTABLE_DEBUG_SETTINGS */
+
 extern u8 generic_init_controller;
 extern u32 freq_val[];
 extern u32 is_pll_old;
 extern struct cl_val_per_freq cas_latency_table[];
 extern struct pattern_info pattern_table[];
 extern struct cl_val_per_freq cas_write_latency_table[];
-extern u8 debug_training;
-extern u8 debug_centralization, debug_training_ip, debug_training_bist,
-	debug_pbs, debug_training_static, debug_leveling;
 extern u32 pipe_multicast_mask;
 extern struct hws_tip_config_func_db config_func_info[];
 extern u8 cs_mask_reg[];
@@ -186,8 +207,6 @@ extern u32 g_dic;
 extern u32 g_odt_config;
 extern u32 g_rtt_nom;
 
-extern u8 debug_training_access;
-extern u8 debug_training_a38x;
 extern u32 first_active_if;
 extern enum hws_ddr_freq init_freq;
 extern u32 delay_enable, ck_delay, ck_delay_16, ca_delay;
@@ -227,7 +246,6 @@ extern u32 znri_data_phy_val;
 extern u32 zpri_data_phy_val;
 extern u32 znri_ctrl_phy_val;
 extern u32 zpri_ctrl_phy_val;
-extern u8 debug_training_access;
 extern u32 finger_test, p_finger_start, p_finger_end, n_finger_start,
 	n_finger_end, p_finger_step, n_finger_step;
 extern u32 mode2_t;
@@ -243,8 +261,6 @@ extern u32 freq_mask[HWS_MAX_DEVICE_NUM][DDR_FREQ_LIMIT];
 extern u32 start_pattern, end_pattern;
 
 extern u32 maxt_poll_tries;
-extern u32 is_bist_reset_bit;
-extern u8 debug_training_bist;
 
 extern u8 vref_window_size[MAX_INTERFACE_NUM][MAX_BUS_NUM];
 extern u32 debug_mode;
@@ -252,20 +268,16 @@ extern u32 effective_cs;
 extern int ddr3_tip_centr_skip_min_win_check;
 extern u32 *dq_map_table;
 extern enum auto_tune_stage training_stage;
-extern u8 debug_centralization;
 
 extern u32 delay_enable;
 extern u32 start_pattern, end_pattern;
 extern u32 freq_val[DDR_FREQ_LIMIT];
-extern u8 debug_training_hw_alg;
 extern enum auto_tune_stage training_stage;
 
-extern u8 debug_training_ip;
 extern enum hws_result training_result[MAX_STAGE_LIMIT][MAX_INTERFACE_NUM];
 extern enum auto_tune_stage training_stage;
 extern u32 effective_cs;
 
-extern u8 debug_leveling;
 extern enum hws_result training_result[MAX_STAGE_LIMIT][MAX_INTERFACE_NUM];
 extern enum auto_tune_stage training_stage;
 extern u32 rl_version;
@@ -276,7 +288,6 @@ extern u32 odt_config;
 extern u32 effective_cs;
 extern u32 phy_reg1_val;
 
-extern u8 debug_pbs;
 extern u32 effective_cs;
 extern u16 mask_results_dq_reg_map[];
 extern enum hws_ddr_freq medium_freq;
@@ -296,7 +307,6 @@ extern u32 init_freq;
 #endif
 /* list of allowed frequency listed in order of enum hws_ddr_freq */
 extern u32 freq_val[];
-extern u8 debug_training_static;
 extern u32 first_active_if;
 
 /* Prototypes */
Signature · 1 line
2.43.2
#9 lore raw

PATCH 9/10 arm: mvebu: a38x: Add optional support for using old DDR3 training code

In reply to Marek Behún

Add optional support for using old DDR3 training code from 2017.

The code lives in drivers/ddr/marvell/a38x/old/. To prevent symbol clashing with new DDR3 training code, a special header which renames all clashing symbols via macros is included and the symbols are prefixed with 'old_'.

If old DDR3 training support is selected for a board, then the SPL initialization code calls a new function
board_use_old_ddr3_training()
to check whether it should use old DDR3 training code. The default weak implementation returns false, defaulting to new DDR3 training code.

Boards that wish to support this need to select the
ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING
config option and implement the old version of DDR topology provider, ddr3_get_topology_map().

---
 arch/arm/mach-mvebu/Kconfig                   |   4 +
 arch/arm/mach-mvebu/include/mach/cpu.h        |   1 +
 arch/arm/mach-mvebu/spl.c                     |  37 ++-
 drivers/ddr/marvell/a38x/Makefile             |   2 +
 drivers/ddr/marvell/a38x/old/Makefile         |  11 +
 .../marvell/a38x/old/glue_symbol_renames.h    | 247 ++++++++++++++++++
 6 files changed, 293 insertions(+), 9 deletions(-)
 create mode 100644 drivers/ddr/marvell/a38x/old/glue_symbol_renames.h
arch/arm/mach-mvebu/Kconfig +4 -0
index a320793a30..e377e8a48a 100644
@@ -37,6 +37,10 @@ config ARMADA_38X_HS_IMPEDANCE_THRESH
 	default 0x6
 	range 0x0 0x7
 
+config ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING
+	bool
+	depends on ARMADA_38X
+
 config ARMADA_XP
 	bool
 	select ARMADA_32BIT
arch/arm/mach-mvebu/include/mach/cpu.h +1 -0
index 904e7157ba..af6ce2920e 100644
@@ -174,6 +174,7 @@ int serdes_phy_config(void);
  * drivers/ddr/marvell
  */
 int ddr3_init(void);
+int old_ddr3_init(void);
 
 /* Auto Voltage Scaling */
 #if defined(CONFIG_ARMADA_38X)
arch/arm/mach-mvebu/spl.c +28 -9
index 79f8877745..fd1030b33b 100644
@@ -314,6 +314,33 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 	hang();
 }
 
+#if !defined(CONFIG_ARMADA_375)
+__weak bool board_use_old_ddr3_training(void)
+{
+	return false;
+}
+
+static void ddr3_init_or_fail(void)
+{
+	int ret;
+
+	if (IS_ENABLED(CONFIG_ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING) &&
+	    board_use_old_ddr3_training())
+		ret = old_ddr3_init();
+	else
+		ret = ddr3_init();
+
+	if (ret) {
+		printf("ddr3 init failed: %d\n", ret);
+		if (IS_ENABLED(CONFIG_DDR_RESET_ON_TRAINING_FAILURE) &&
+		    get_boot_device() != BOOT_DEVICE_UART)
+			reset_cpu();
+		else
+			hang();
+	}
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
 	int ret;
@@ -348,15 +375,7 @@ void board_init_f(ulong dummy)
 	serdes_phy_config();
 
 	/* Setup DDR */
-	ret = ddr3_init();
-	if (ret) {
-		printf("ddr3_init() failed: %d\n", ret);
-		if (IS_ENABLED(CONFIG_DDR_RESET_ON_TRAINING_FAILURE) &&
-		    get_boot_device() != BOOT_DEVICE_UART)
-			reset_cpu();
-		else
-			hang();
-	}
+	ddr3_init_or_fail();
 #endif
 
 	/* Initialize Auto Voltage Scaling */
drivers/ddr/marvell/a38x/Makefile +2 -0
index fcfb615686..4e8a9d190d 100644
@@ -18,6 +18,8 @@ obj-$(CONFIG_SPL_BUILD) += mv_ddr_spd.o
 obj-$(CONFIG_SPL_BUILD) += mv_ddr_topology.o
 obj-$(CONFIG_SPL_BUILD) += xor.o
 
+obj-$(CONFIG_ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING) += old/
+
 ifdef CONFIG_DDR4
 	obj-$(CONFIG_SPL_BUILD) += mv_ddr4_mpr_pda_if.o
 	obj-$(CONFIG_SPL_BUILD) += mv_ddr4_training.o
drivers/ddr/marvell/a38x/old/Makefile +11 -0
index e7b723bb24..1645a79b40 100644
@@ -16,3 +16,14 @@ obj-$(CONFIG_SPL_BUILD) += ddr3_training_ip_engine.o
 obj-$(CONFIG_SPL_BUILD) += ddr3_training_leveling.o
 obj-$(CONFIG_SPL_BUILD) += ddr3_training_pbs.o
 obj-$(CONFIG_SPL_BUILD) += ddr3_training_static.o
+
+define IncludeSymbolRename
+  CFLAGS_$(1) = -include $(srctree)/drivers/ddr/marvell/a38x/old/glue_symbol_renames.h
+endef
+
+$(foreach obj,$(obj-y),$(eval $(call IncludeSymbolRename,$(obj))))
+
+# The old version of DDR training fails weirdly on some boards if the whole
+# driver is compiled with LTO. It seems to work if at least ddr3_init.c is
+# compiled without LTO.
+CFLAGS_REMOVE_ddr3_init.o := $(LTO_CFLAGS)
drivers/ddr/marvell/a38x/old/glue_symbol_renames.h new file +247 -0

247 lines not on this page · raw message

Signature · 1 line
2.43.2
#10 lore raw

PATCH 10/10 arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var

In reply to Marek Behún

Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable.

Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable
env set omnia_ddr3_training old
env save

---
 arch/arm/mach-mvebu/Kconfig                   |  1 +
 board/CZ.NIC/turris_omnia/Makefile            |  1 +
 board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++++++++++++++++++
 board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
 4 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c
arch/arm/mach-mvebu/Kconfig +1 -0
index e377e8a48a..4a8328760e 100644
@@ -149,6 +149,7 @@ config TARGET_TURRIS_OMNIA
 	select SPL_SYS_MALLOC_SIMPLE
 	select SYS_I2C_MVTWSI
 	select ATSHA204A
+	select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING
 
 config TARGET_TURRIS_MOX
 	bool "Support CZ.NIC's Turris Mox / RIPE Atlas Probe"
board/CZ.NIC/turris_omnia/Makefile +1 -0
index 341378b4e5..28142cca7e 100644
@@ -3,3 +3,4 @@
 # Copyright (C) 2017 Marek Behún <[email protected]>
 
 obj-y	:= turris_omnia.o ../turris_atsha_otp.o ../turris_common.o
+obj-$(CONFIG_SPL_BUILD)	+= old_ddr3_training.o
board/CZ.NIC/turris_omnia/old_ddr3_training.c new file +79 -0

79 lines not on this page · raw message

board/CZ.NIC/turris_omnia/turris_omnia.c +1 -1
index 3b7a71bdad..225c6f4bc5 100644
@@ -465,7 +465,7 @@ static bool omnia_read_eeprom(struct omnia_eeprom *oep)
 	return true;
 }
 
-static int omnia_get_ram_size_gb(void)
+int omnia_get_ram_size_gb(void)
 {
 	static int ram_size;
 	struct omnia_eeprom oep;
Signature · 1 line
2.43.2
#6 lore raw

PATCH 6/10 ddr: marvell: a38x: Import old DDR training code from 2017 version of U-Boot

In reply to Marek Behún

Import DDR training code from commit 1b69ce2fc0ec ("arm: mvebu:
ddr3_debug: remove self assignments") into drivers/ddr/marvell/a38x/old/. The code is not used yet.

Explanation:

Since 2019, on some Turris Omnia boards we have been having problems with newer versions of Marvell's DDR3 training code for Armada 38x, which is ported from mv-ddr-marvell [1] to U-Boot into the drivers/ddr/marvell/a38x/ directory:
- sometimes the DDR3 training fails on some older boards, sometime it fails on some newer boards
- other times it succeeds, but some boards experience crashes of the operating system after running for some time.

Using the stock version of Turris Omnia's U-Boot from solved these issues, but this solution was not satisfactory, since we wanted features from new U-Boot.

Back in 2020-2022 we have spent several months trying to debug the issues, working with Marvell, on our own, and also with U-Boot community, but these issues persist still.

One solution we used back in 2019 was a "hybrid U-Boot": the SPL part (containing the DDR3 training code) was taken from the stock version, while the proper part was current U-Boot at the time. This solution also has its drawbacks, of which the main one is the need to glue binaries from two separate builds.

Since then there have been some more changes to the DDR3 training code in upstream mv-ddr-marvell that have been ported to U-Boot. We have provided our users experimental builds of U-Boot in the TurrisOS so that they could try upgrading the firmware and let us know if those problems still exist. And they do.

We do not have the time nor manpower to debug this problem and fix it properly. Marvell was also no able to provide a solution to this, probably because they do not have the manpower as well.

I have therefore come up with this "not that pretty" solution: take the DDR3 training code from an older version of U-Boot that is known to work, put it into current U-Boot under old/ subdirectory within drivers/ddr/marvell/a38x/, build into the SPL binary both the old and new versions and make it possible to select the old version via an env variable.

[1] https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell

---
 drivers/ddr/marvell/a38x/old/Makefile         |   18 +
 drivers/ddr/marvell/a38x/old/ddr3_a38x.c      |  737 +++++
 drivers/ddr/marvell/a38x/old/ddr3_a38x.h      |   93 +
 .../marvell/a38x/old/ddr3_a38x_mc_static.h    |  226 ++
 .../ddr/marvell/a38x/old/ddr3_a38x_topology.h |   22 +
 .../ddr/marvell/a38x/old/ddr3_a38x_training.c |   40 +
 drivers/ddr/marvell/a38x/old/ddr3_debug.c     | 1527 ++++++++++
 .../marvell/a38x/old/ddr3_hws_hw_training.c   |  148 +
 .../marvell/a38x/old/ddr3_hws_hw_training.h   |   49 +
 .../a38x/old/ddr3_hws_hw_training_def.h       |  464 +++
 .../marvell/a38x/old/ddr3_hws_sil_training.h  |   17 +
 drivers/ddr/marvell/a38x/old/ddr3_init.c      |  769 +++++
 drivers/ddr/marvell/a38x/old/ddr3_init.h      |  393 +++
 .../ddr/marvell/a38x/old/ddr3_logging_def.h   |  101 +
 .../marvell/a38x/old/ddr3_patterns_64bit.h    |  924 ++++++
 .../ddr/marvell/a38x/old/ddr3_topology_def.h  |   76 +
 drivers/ddr/marvell/a38x/old/ddr3_training.c  | 2650 +++++++++++++++++
 .../ddr/marvell/a38x/old/ddr3_training_bist.c |  289 ++
 .../a38x/old/ddr3_training_centralization.c   |  712 +++++
 .../ddr/marvell/a38x/old/ddr3_training_db.c   |  652 ++++
 .../marvell/a38x/old/ddr3_training_hw_algo.c  |  686 +++++
 .../marvell/a38x/old/ddr3_training_hw_algo.h  |   14 +
 .../ddr/marvell/a38x/old/ddr3_training_ip.h   |  178 ++
 .../marvell/a38x/old/ddr3_training_ip_bist.h  |   54 +
 .../old/ddr3_training_ip_centralization.h     |   15 +
 .../marvell/a38x/old/ddr3_training_ip_db.h    |   34 +
 .../marvell/a38x/old/ddr3_training_ip_def.h   |  173 ++
 .../a38x/old/ddr3_training_ip_engine.c        | 1354 +++++++++
 .../a38x/old/ddr3_training_ip_engine.h        |   85 +
 .../marvell/a38x/old/ddr3_training_ip_flow.h  |  349 +++
 .../marvell/a38x/old/ddr3_training_ip_pbs.h   |   41 +
 .../a38x/old/ddr3_training_ip_prv_if.h        |  107 +
 .../a38x/old/ddr3_training_ip_static.h        |   31 +
 .../marvell/a38x/old/ddr3_training_leveling.c | 1836 ++++++++++++
 .../marvell/a38x/old/ddr3_training_leveling.h |   17 +
 .../ddr/marvell/a38x/old/ddr3_training_pbs.c  |  995 +++++++
 .../marvell/a38x/old/ddr3_training_static.c   |  538 ++++
 .../ddr/marvell/a38x/old/ddr_topology_def.h   |  121 +
 .../ddr/marvell/a38x/old/ddr_training_ip_db.h |   16 +
 drivers/ddr/marvell/a38x/old/silicon_if.h     |   17 +
 drivers/ddr/marvell/a38x/old/xor.h            |   92 +
 41 files changed, 16660 insertions(+)
 create mode 100644 drivers/ddr/marvell/a38x/old/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/xor.h
drivers/ddr/marvell/a38x/old/Makefile new file +18 -0
new file mode 100644
index 0000000000..e7b723bb24
@@ -0,0 +1,18 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-$(CONFIG_SPL_BUILD) += ddr3_a38x.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_a38x_training.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_debug.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_hws_hw_training.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_init.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_bist.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_centralization.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_db.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_hw_algo.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_ip_engine.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_leveling.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_pbs.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_static.o
drivers/ddr/marvell/a38x/old/ddr3_a38x.c new file +737 -0

737 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_a38x.h new file +93 -0

93 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h new file +226 -0

226 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h new file +22 -0
new file mode 100644
index 0000000000..f27bbff733
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) Marvell International Ltd. and its affiliates
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#ifndef _DDR3_A38X_TOPOLOGY_H
+#define _DDR3_A38X_TOPOLOGY_H
+
+#include "ddr_topology_def.h"
+
+/* Bus mask variants */
+#define BUS_MASK_32BIT			0xf
+#define BUS_MASK_32BIT_ECC		0x1f
+#define BUS_MASK_16BIT			0x3
+#define BUS_MASK_16BIT_ECC		0x13
+#define BUS_MASK_16BIT_ECC_PUP3		0xb
+
+#define DYNAMIC_CS_SIZE_CONFIG
+#define DISABLE_L2_FILTERING_DURING_DDR_TRAINING
+
+#endif /* _DDR3_A38X_TOPOLOGY_H */
drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c new file +40 -0
new file mode 100644
index 0000000000..52c43f75e0
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) Marvell International Ltd. and its affiliates
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/soc.h>
+
+#include "ddr3_init.h"
+
+/*
+ * Name:     ddr3_tip_init_silicon
+ * Desc:     initiate silicon parameters
+ * Args:
+ * Notes:
+ * Returns:  required value
+ */
+int ddr3_silicon_init(void)
+{
+	int status;
+	static int init_done;
+
+	if (init_done == 1)
+		return MV_OK;
+
+	status = ddr3_tip_init_a38x(0, 0);
+	if (MV_OK != status) {
+		printf("DDR3 A38x silicon init - FAILED 0x%x\n", status);
+		return status;
+	}
+
+	init_done = 1;
+
+	return MV_OK;
+}
drivers/ddr/marvell/a38x/old/ddr3_debug.c new file +1527 -0

1,527 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.c new file +148 -0

148 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.h new file +49 -0

49 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training_def.h new file +464 -0

140 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_hws_sil_training.h new file +17 -0
new file mode 100644
index 0000000000..544237a276

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/ddr3_init.c new file +769 -0

769 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_init.h new file +393 -0

393 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_logging_def.h new file +101 -0

101 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h new file +924 -0

924 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_topology_def.h new file +76 -0

76 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training.c new file +2650 -0

2,650 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_bist.c new file +289 -0

289 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_centralization.c new file +712 -0

712 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_db.c new file +652 -0

652 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.c new file +686 -0

686 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.h new file +14 -0
new file mode 100644
index 0000000000..6e1bab260d

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/ddr3_training_ip.h new file +178 -0

178 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_bist.h new file +54 -0

54 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_centralization.h new file +15 -0
new file mode 100644
index 0000000000..7c57603947

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/ddr3_training_ip_db.h new file +34 -0
new file mode 100644
index 0000000000..c0afa7742e

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/ddr3_training_ip_def.h new file +173 -0

173 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c new file +1354 -0

1,354 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.h new file +85 -0

85 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_flow.h new file +349 -0

349 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_pbs.h new file +41 -0

41 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_prv_if.h new file +107 -0

107 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_ip_static.h new file +31 -0
new file mode 100644
index 0000000000..878068b24d

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c new file +1836 -0

1,836 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_leveling.h new file +17 -0
new file mode 100644
index 0000000000..f2b4177082

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/ddr3_training_pbs.c new file +995 -0

995 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr3_training_static.c new file +538 -0

538 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr_topology_def.h new file +121 -0

121 lines not on this page · raw message

drivers/ddr/marvell/a38x/old/ddr_training_ip_db.h new file +16 -0
new file mode 100644
index 0000000000..ff5f817383

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/silicon_if.h new file +17 -0
new file mode 100644
index 0000000000..7fce27da12

Lines of this file are not shown. View the raw message.

drivers/ddr/marvell/a38x/old/xor.h new file +92 -0

92 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.2

Part of the diff is not shown here. View the raw message.

#16 lore raw
In reply to Marek Behún

Hi Marek,

I'm running a regression test with this patch on another Armada 385 board (Synology DS116). And
it is running without problem.

I noticed that there is no version bump. Is this still 14.0.0? It's kind of hard to see which version we are using without a minor revision such as 14.0.1.

All the best,
Tony

Quoted 141 lines · Marek Behún

Hi Stefan,

this series adds some changes to DDR3 training for Armada 38x and Turris Omnia.

- patches 1-4 are meant to allow for reducing another 10 KiB in the SPL binary. They were also sent to mv-ddr-marvell, via PR on github,
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/45/
but I am told that Armada team has left Marvell, so who knows if this will ever be merged there
- patch 5 enables this reduction for Turris Omnia
- patches 6-8 import old DDR3 training code and make some changes so that it works with U-Boot. The reason why this is being done is explained in patch 6
- patch 9 glues the old DDR3 training code to current U-Boot
- patch 10 allows for dynamic selection of old DDR3 training code on Turris Omnia, via an U-Boot environment variable

Marek

Marek Behún (10):
ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if
we won't print anything
ddr: marvell: a38x: debug: Remove unused variables
ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if
needed, and make them static
ddr: marvell: a38x: debug: Allow compiling with immutable debug
settings to reduce binary size
arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3
training by default
ddr: marvell: a38x: Import old DDR training code from 2017 version of
U-Boot
ddr: marvell: a38x: old: Fix some compiler warning of the old code
ddr: marvell: a38x: old: Backport immutable debug settings
arm: mvebu: a38x: Add optional support for using old DDR3 training
code
arm: mvebu: turris_omnia: Support old DDR3 training, selectable via
env var

 arch/arm/mach-mvebu/Kconfig                   |   15 +
 arch/arm/mach-mvebu/include/mach/cpu.h        |    1 +
 arch/arm/mach-mvebu/spl.c                     |   37 +-
 board/CZ.NIC/turris_omnia/Makefile            |    1 +
 board/CZ.NIC/turris_omnia/old_ddr3_training.c |   79 +
 board/CZ.NIC/turris_omnia/turris_omnia.c      |    2 +-
 configs/turris_omnia_defconfig                |    1 +
 drivers/ddr/marvell/a38x/Makefile             |    2 +
 drivers/ddr/marvell/a38x/ddr3_debug.c         |   30 +-
 drivers/ddr/marvell/a38x/ddr3_init.c          |    3 +-
 drivers/ddr/marvell/a38x/ddr3_init.h          |   43 +-
 drivers/ddr/marvell/a38x/old/Makefile         |   29 +
 drivers/ddr/marvell/a38x/old/ddr3_a38x.c      |  738 +++++
 drivers/ddr/marvell/a38x/old/ddr3_a38x.h      |   93 +
 .../marvell/a38x/old/ddr3_a38x_mc_static.h    |  226 ++
 .../ddr/marvell/a38x/old/ddr3_a38x_topology.h |   22 +
 .../ddr/marvell/a38x/old/ddr3_a38x_training.c |   40 +
 drivers/ddr/marvell/a38x/old/ddr3_debug.c     | 1545 ++++++++++
 .../marvell/a38x/old/ddr3_hws_hw_training.c   |  148 +
 .../marvell/a38x/old/ddr3_hws_hw_training.h   |   49 +
 .../a38x/old/ddr3_hws_hw_training_def.h       |  464 +++
 .../marvell/a38x/old/ddr3_hws_sil_training.h  |   17 +
 drivers/ddr/marvell/a38x/old/ddr3_init.c      |  770 +++++
 drivers/ddr/marvell/a38x/old/ddr3_init.h      |  405 +++
 .../ddr/marvell/a38x/old/ddr3_logging_def.h   |  101 +
 .../marvell/a38x/old/ddr3_patterns_64bit.h    |  924 ++++++
 .../ddr/marvell/a38x/old/ddr3_topology_def.h  |   76 +
 drivers/ddr/marvell/a38x/old/ddr3_training.c  | 2651 +++++++++++++++++
 .../ddr/marvell/a38x/old/ddr3_training_bist.c |  289 ++
 .../a38x/old/ddr3_training_centralization.c   |  712 +++++
 .../ddr/marvell/a38x/old/ddr3_training_db.c   |  652 ++++
 .../marvell/a38x/old/ddr3_training_hw_algo.c  |  686 +++++
 .../marvell/a38x/old/ddr3_training_hw_algo.h  |   14 +
 .../ddr/marvell/a38x/old/ddr3_training_ip.h   |  178 ++
 .../marvell/a38x/old/ddr3_training_ip_bist.h  |   54 +
 .../old/ddr3_training_ip_centralization.h     |   15 +
 .../marvell/a38x/old/ddr3_training_ip_db.h    |   34 +
 .../marvell/a38x/old/ddr3_training_ip_def.h   |  173 ++
 .../a38x/old/ddr3_training_ip_engine.c        | 1355 +++++++++
 .../a38x/old/ddr3_training_ip_engine.h        |   85 +
 .../marvell/a38x/old/ddr3_training_ip_flow.h  |  349 +++
 .../marvell/a38x/old/ddr3_training_ip_pbs.h   |   41 +
 .../a38x/old/ddr3_training_ip_prv_if.h        |  107 +
 .../a38x/old/ddr3_training_ip_static.h        |   31 +
 .../marvell/a38x/old/ddr3_training_leveling.c | 1837 ++++++++++++
 .../marvell/a38x/old/ddr3_training_leveling.h |   17 +
 .../ddr/marvell/a38x/old/ddr3_training_pbs.c  |  995 +++++++
 .../marvell/a38x/old/ddr3_training_static.c   |  538 ++++
 .../ddr/marvell/a38x/old/ddr_topology_def.h   |  121 +
 .../ddr/marvell/a38x/old/ddr_training_ip_db.h |   16 +
 .../marvell/a38x/old/glue_symbol_renames.h    |  247 ++
 drivers/ddr/marvell/a38x/old/silicon_if.h     |   17 +
 drivers/ddr/marvell/a38x/old/xor.h            |   92 +
 53 files changed, 17138 insertions(+), 29 deletions(-)
 create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/glue_symbol_renames.h
 create mode 100644 drivers/ddr/marvell/a38x/old/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/xor.h

--
2.43.2

#17 lore raw

Hi Tony,

hmm no I did not change the version number.

The changes are only relevant for debug messages, there is no functional changes in how the DDR training is done, unless I made a mistake.

I am not sure that changing the version is a good idea unless this is also done for the upstream where I sent the PR. But who knows if Marvell will have some people assigned to merge the PR.

Since U-Boot prints its own version, people can easily reproduce the code for a given binary from U-Boot version string.

Marek

Quoted 154 lines · On Mon, 15 Apr 2024 15:20:49 -0700 Tony Dinh <[email protected]> wrote:

Hi Marek,

I'm running a regression test with this patch on another Armada 385 board (Synology DS116). And
it is running without problem.

I noticed that there is no version bump. Is this still 14.0.0? It's kind of hard to see which version we are using without a minor revision such as 14.0.1.

All the best,
Tony

Quoted 141 lines · Marek Behún

Hi Stefan,

this series adds some changes to DDR3 training for Armada 38x and Turris Omnia.

- patches 1-4 are meant to allow for reducing another 10 KiB in the SPL binary. They were also sent to mv-ddr-marvell, via PR on github,
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/45/
but I am told that Armada team has left Marvell, so who knows if this will ever be merged there
- patch 5 enables this reduction for Turris Omnia
- patches 6-8 import old DDR3 training code and make some changes so that it works with U-Boot. The reason why this is being done is explained in patch 6
- patch 9 glues the old DDR3 training code to current U-Boot
- patch 10 allows for dynamic selection of old DDR3 training code on Turris Omnia, via an U-Boot environment variable

Marek

Marek Behún (10):
ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if
we won't print anything
ddr: marvell: a38x: debug: Remove unused variables
ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if
needed, and make them static
ddr: marvell: a38x: debug: Allow compiling with immutable debug
settings to reduce binary size
arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3
training by default
ddr: marvell: a38x: Import old DDR training code from 2017 version of
U-Boot
ddr: marvell: a38x: old: Fix some compiler warning of the old code
ddr: marvell: a38x: old: Backport immutable debug settings
arm: mvebu: a38x: Add optional support for using old DDR3 training
code
arm: mvebu: turris_omnia: Support old DDR3 training, selectable via
env var

 arch/arm/mach-mvebu/Kconfig                   |   15 +
 arch/arm/mach-mvebu/include/mach/cpu.h        |    1 +
 arch/arm/mach-mvebu/spl.c                     |   37 +-
 board/CZ.NIC/turris_omnia/Makefile            |    1 +
 board/CZ.NIC/turris_omnia/old_ddr3_training.c |   79 +
 board/CZ.NIC/turris_omnia/turris_omnia.c      |    2 +-
 configs/turris_omnia_defconfig                |    1 +
 drivers/ddr/marvell/a38x/Makefile             |    2 +
 drivers/ddr/marvell/a38x/ddr3_debug.c         |   30 +-
 drivers/ddr/marvell/a38x/ddr3_init.c          |    3 +-
 drivers/ddr/marvell/a38x/ddr3_init.h          |   43 +-
 drivers/ddr/marvell/a38x/old/Makefile         |   29 +
 drivers/ddr/marvell/a38x/old/ddr3_a38x.c      |  738 +++++
 drivers/ddr/marvell/a38x/old/ddr3_a38x.h      |   93 +
 .../marvell/a38x/old/ddr3_a38x_mc_static.h    |  226 ++
 .../ddr/marvell/a38x/old/ddr3_a38x_topology.h |   22 +
 .../ddr/marvell/a38x/old/ddr3_a38x_training.c |   40 +
 drivers/ddr/marvell/a38x/old/ddr3_debug.c     | 1545 ++++++++++
 .../marvell/a38x/old/ddr3_hws_hw_training.c   |  148 +
 .../marvell/a38x/old/ddr3_hws_hw_training.h   |   49 +
 .../a38x/old/ddr3_hws_hw_training_def.h       |  464 +++
 .../marvell/a38x/old/ddr3_hws_sil_training.h  |   17 +
 drivers/ddr/marvell/a38x/old/ddr3_init.c      |  770 +++++
 drivers/ddr/marvell/a38x/old/ddr3_init.h      |  405 +++
 .../ddr/marvell/a38x/old/ddr3_logging_def.h   |  101 +
 .../marvell/a38x/old/ddr3_patterns_64bit.h    |  924 ++++++
 .../ddr/marvell/a38x/old/ddr3_topology_def.h  |   76 +
 drivers/ddr/marvell/a38x/old/ddr3_training.c  | 2651 +++++++++++++++++
 .../ddr/marvell/a38x/old/ddr3_training_bist.c |  289 ++
 .../a38x/old/ddr3_training_centralization.c   |  712 +++++
 .../ddr/marvell/a38x/old/ddr3_training_db.c   |  652 ++++
 .../marvell/a38x/old/ddr3_training_hw_algo.c  |  686 +++++
 .../marvell/a38x/old/ddr3_training_hw_algo.h  |   14 +
 .../ddr/marvell/a38x/old/ddr3_training_ip.h   |  178 ++
 .../marvell/a38x/old/ddr3_training_ip_bist.h  |   54 +
 .../old/ddr3_training_ip_centralization.h     |   15 +
 .../marvell/a38x/old/ddr3_training_ip_db.h    |   34 +
 .../marvell/a38x/old/ddr3_training_ip_def.h   |  173 ++
 .../a38x/old/ddr3_training_ip_engine.c        | 1355 +++++++++
 .../a38x/old/ddr3_training_ip_engine.h        |   85 +
 .../marvell/a38x/old/ddr3_training_ip_flow.h  |  349 +++
 .../marvell/a38x/old/ddr3_training_ip_pbs.h   |   41 +
 .../a38x/old/ddr3_training_ip_prv_if.h        |  107 +
 .../a38x/old/ddr3_training_ip_static.h        |   31 +
 .../marvell/a38x/old/ddr3_training_leveling.c | 1837 ++++++++++++
 .../marvell/a38x/old/ddr3_training_leveling.h |   17 +
 .../ddr/marvell/a38x/old/ddr3_training_pbs.c  |  995 +++++++
 .../marvell/a38x/old/ddr3_training_static.c   |  538 ++++
 .../ddr/marvell/a38x/old/ddr_topology_def.h   |  121 +
 .../ddr/marvell/a38x/old/ddr_training_ip_db.h |   16 +
 .../marvell/a38x/old/glue_symbol_renames.h    |  247 ++
 drivers/ddr/marvell/a38x/old/silicon_if.h     |   17 +
 drivers/ddr/marvell/a38x/old/xor.h            |   92 +
 53 files changed, 17138 insertions(+), 29 deletions(-)
 create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/glue_symbol_renames.h
 create mode 100644 drivers/ddr/marvell/a38x/old/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/xor.h

--
2.43.2

Tested-by
#18 lore raw

Hi Marek,

Quoted 9 lines · Marek Behún

Hi Tony,

hmm no I did not change the version number.

The changes are only relevant for debug messages, there is no functional changes in how the DDR training is done, unless I made a mistake.

Quoted 6 lines

I am not sure that changing the version is a good idea unless this is also done for the upstream where I sent the PR. But who knows if Marvell will have some people assigned to merge the PR.

Since U-Boot prints its own version, people can easily reproduce the code for a given binary from U-Boot version string.

OK, sounds good.

All the best,
Tony

Quoted 161 lines

Marek

Quoted 154 lines · On Mon, 15 Apr 2024 15:20:49 -0700 Tony Dinh <[email protected]> wrote:

Hi Marek,

I'm running a regression test with this patch on another Armada 385 board (Synology DS116). And
it is running without problem.

I noticed that there is no version bump. Is this still 14.0.0? It's kind of hard to see which version we are using without a minor revision such as 14.0.1.

All the best,
Tony

Quoted 141 lines · Marek Behún

Hi Stefan,

this series adds some changes to DDR3 training for Armada 38x and Turris Omnia.

- patches 1-4 are meant to allow for reducing another 10 KiB in the SPL binary. They were also sent to mv-ddr-marvell, via PR on github,
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/45/
but I am told that Armada team has left Marvell, so who knows if this will ever be merged there
- patch 5 enables this reduction for Turris Omnia
- patches 6-8 import old DDR3 training code and make some changes so that it works with U-Boot. The reason why this is being done is explained in patch 6
- patch 9 glues the old DDR3 training code to current U-Boot
- patch 10 allows for dynamic selection of old DDR3 training code on Turris Omnia, via an U-Boot environment variable

Marek

Marek Behún (10):
ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if
we won't print anything
ddr: marvell: a38x: debug: Remove unused variables
ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if
needed, and make them static
ddr: marvell: a38x: debug: Allow compiling with immutable debug
settings to reduce binary size
arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3
training by default
ddr: marvell: a38x: Import old DDR training code from 2017 version of
U-Boot
ddr: marvell: a38x: old: Fix some compiler warning of the old code
ddr: marvell: a38x: old: Backport immutable debug settings
arm: mvebu: a38x: Add optional support for using old DDR3 training
code
arm: mvebu: turris_omnia: Support old DDR3 training, selectable via
env var

 arch/arm/mach-mvebu/Kconfig                   |   15 +
 arch/arm/mach-mvebu/include/mach/cpu.h        |    1 +
 arch/arm/mach-mvebu/spl.c                     |   37 +-
 board/CZ.NIC/turris_omnia/Makefile            |    1 +
 board/CZ.NIC/turris_omnia/old_ddr3_training.c |   79 +
 board/CZ.NIC/turris_omnia/turris_omnia.c      |    2 +-
 configs/turris_omnia_defconfig                |    1 +
 drivers/ddr/marvell/a38x/Makefile             |    2 +
 drivers/ddr/marvell/a38x/ddr3_debug.c         |   30 +-
 drivers/ddr/marvell/a38x/ddr3_init.c          |    3 +-
 drivers/ddr/marvell/a38x/ddr3_init.h          |   43 +-
 drivers/ddr/marvell/a38x/old/Makefile         |   29 +
 drivers/ddr/marvell/a38x/old/ddr3_a38x.c      |  738 +++++
 drivers/ddr/marvell/a38x/old/ddr3_a38x.h      |   93 +
 .../marvell/a38x/old/ddr3_a38x_mc_static.h    |  226 ++
 .../ddr/marvell/a38x/old/ddr3_a38x_topology.h |   22 +
 .../ddr/marvell/a38x/old/ddr3_a38x_training.c |   40 +
 drivers/ddr/marvell/a38x/old/ddr3_debug.c     | 1545 ++++++++++
 .../marvell/a38x/old/ddr3_hws_hw_training.c   |  148 +
 .../marvell/a38x/old/ddr3_hws_hw_training.h   |   49 +
 .../a38x/old/ddr3_hws_hw_training_def.h       |  464 +++
 .../marvell/a38x/old/ddr3_hws_sil_training.h  |   17 +
 drivers/ddr/marvell/a38x/old/ddr3_init.c      |  770 +++++
 drivers/ddr/marvell/a38x/old/ddr3_init.h      |  405 +++
 .../ddr/marvell/a38x/old/ddr3_logging_def.h   |  101 +
 .../marvell/a38x/old/ddr3_patterns_64bit.h    |  924 ++++++
 .../ddr/marvell/a38x/old/ddr3_topology_def.h  |   76 +
 drivers/ddr/marvell/a38x/old/ddr3_training.c  | 2651 +++++++++++++++++
 .../ddr/marvell/a38x/old/ddr3_training_bist.c |  289 ++
 .../a38x/old/ddr3_training_centralization.c   |  712 +++++
 .../ddr/marvell/a38x/old/ddr3_training_db.c   |  652 ++++
 .../marvell/a38x/old/ddr3_training_hw_algo.c  |  686 +++++
 .../marvell/a38x/old/ddr3_training_hw_algo.h  |   14 +
 .../ddr/marvell/a38x/old/ddr3_training_ip.h   |  178 ++
 .../marvell/a38x/old/ddr3_training_ip_bist.h  |   54 +
 .../old/ddr3_training_ip_centralization.h     |   15 +
 .../marvell/a38x/old/ddr3_training_ip_db.h    |   34 +
 .../marvell/a38x/old/ddr3_training_ip_def.h   |  173 ++
 .../a38x/old/ddr3_training_ip_engine.c        | 1355 +++++++++
 .../a38x/old/ddr3_training_ip_engine.h        |   85 +
 .../marvell/a38x/old/ddr3_training_ip_flow.h  |  349 +++
 .../marvell/a38x/old/ddr3_training_ip_pbs.h   |   41 +
 .../a38x/old/ddr3_training_ip_prv_if.h        |  107 +
 .../a38x/old/ddr3_training_ip_static.h        |   31 +
 .../marvell/a38x/old/ddr3_training_leveling.c | 1837 ++++++++++++
 .../marvell/a38x/old/ddr3_training_leveling.h |   17 +
 .../ddr/marvell/a38x/old/ddr3_training_pbs.c  |  995 +++++++
 .../marvell/a38x/old/ddr3_training_static.c   |  538 ++++
 .../ddr/marvell/a38x/old/ddr_topology_def.h   |  121 +
 .../ddr/marvell/a38x/old/ddr_training_ip_db.h |   16 +
 .../marvell/a38x/old/glue_symbol_renames.h    |  247 ++
 drivers/ddr/marvell/a38x/old/silicon_if.h     |   17 +
 drivers/ddr/marvell/a38x/old/xor.h            |   92 +
 53 files changed, 17138 insertions(+), 29 deletions(-)
 create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/old/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/old/glue_symbol_renames.h
 create mode 100644 drivers/ddr/marvell/a38x/old/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/old/xor.h

--
2.43.2

#11 lore raw

Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var

In reply to Marek Behún

Hi Marek,

Quoted 10 lines · Marek Behún

Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable.

Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable
env set omnia_ddr3_training old
env save

Quoted 8 lines
---
  arch/arm/mach-mvebu/Kconfig                   |  1 +
  board/CZ.NIC/turris_omnia/Makefile            |  1 +
  board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++++++++++++++++++
  board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
  4 files changed, 82 insertions(+), 1 deletion(-)

create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c

For turris_omnia_defconfig, this is dropped when compiled:

drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning: 'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function]
776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32

value, u32 **ptr);
      |            ^~~~~~~~~~~~~~~~~~~

Please take a look.

Thanks,
Stefan

Quoted 111 lines
arch/arm/mach-mvebu/Kconfig +1 -0
index e377e8a48a..4a8328760e 100644
@@ -149,6 +149,7 @@ config TARGET_TURRIS_OMNIA
  	select SPL_SYS_MALLOC_SIMPLE
  	select SYS_I2C_MVTWSI
  	select ATSHA204A
+	select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING
 
  config TARGET_TURRIS_MOX
  	bool "Support CZ.NIC's Turris Mox / RIPE Atlas Probe"
board/CZ.NIC/turris_omnia/Makefile +1 -0
index 341378b4e5..28142cca7e 100644
@@ -3,3 +3,4 @@
  # Copyright (C) 2017 Marek Behún <[email protected]>
 
  obj-y	:= turris_omnia.o ../turris_atsha_otp.o ../turris_common.o
+obj-$(CONFIG_SPL_BUILD)	+= old_ddr3_training.o
board/CZ.NIC/turris_omnia/old_ddr3_training.c new file +79 -0
new file mode 100644
index 0000000000..f7e89c58d4
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2024 Marek Behún <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <env.h>
+
+#include "../drivers/ddr/marvell/a38x/old/ddr3_init.h"
+
+static struct hws_topology_map board_topology_map_1g = {
+	0x1, /* active interfaces */
+	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
+	{ { { {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0} },
+	    SPEED_BIN_DDR_1600K,	/* speed_bin */
+	    BUS_WIDTH_16,		/* memory_width */
+	    MEM_4G,			/* mem_size */
+	    DDR_FREQ_800,		/* frequency */
+	    0, 0,			/* cas_l cas_wl */
+	    HWS_TEMP_NORMAL,		/* temperature */
+	    HWS_TIM_2T} },              /* timing (force 2t) */
+	5,				/* Num Of Bus Per Interface*/
+	BUS_MASK_32BIT			/* Busses mask */
+};
+
+static struct hws_topology_map board_topology_map_2g = {
+	0x1, /* active interfaces */
+	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
+	{ { { {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0} },
+	    SPEED_BIN_DDR_1600K,	/* speed_bin */
+	    BUS_WIDTH_16,		/* memory_width */
+	    MEM_8G,			/* mem_size */
+	    DDR_FREQ_800,		/* frequency */
+	    0, 0,			/* cas_l cas_wl */
+	    HWS_TEMP_NORMAL,		/* temperature */
+	    HWS_TIM_2T} },              /* timing (force 2t) */
+	5,				/* Num Of Bus Per Interface*/
+	BUS_MASK_32BIT			/* Busses mask */
+};
+
+/* defined in turris_omnia.c */
+extern int omnia_get_ram_size_gb(void);
+
+struct hws_topology_map *ddr3_get_topology_map(void)
+{
+	if (omnia_get_ram_size_gb() == 2)
+		return &board_topology_map_2g;
+	else
+		return &board_topology_map_1g;
+}
+
+bool board_use_old_ddr3_training(void)
+{
+	const char *env_val = NULL;
+
+	if (CONFIG_IS_ENABLED(ENV_SUPPORT) && !env_init())
+		env_val = env_get("omnia_ddr3_training");
+
+	if (env_val && !strcmp(env_val, "old")) {
+		printf("Using old DDR3 training implementation\n");
+		return true;
+	}
+
+	return false;
+}
+
+__weak u32 sys_env_get_topology_update_info(struct topology_update_info *tui)
+{
+	return MV_OK;
+}
board/CZ.NIC/turris_omnia/turris_omnia.c +0 -0
index 3b7a71bdad..225c6f4bc5 100644

board/CZ.NIC/turris_omnia/turris_omnia.c static bool omnia_read_eeprom(struct omnia_eeprom *oep) · line 471

Quoted 8 lines
board/CZ.NIC/turris_omnia/turris_omnia.c +1 -1
@@ -465,7 +465,7 @@ static bool omnia_read_eeprom(struct omnia_eeprom *oep)
  	return true;
  }
 
-static int omnia_get_ram_size_gb(void)
+int omnia_get_ram_size_gb(void)
  {
  	static int ram_size;
  	struct omnia_eeprom oep;

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#12 lore raw

Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var

Quoted 22 lines · On Mon, 6 May 2024 12:03:55 +0200 Stefan Roese <[email protected]> wrote:

Hi Marek,

Quoted 10 lines · Marek Behún

Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable.

Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable
env set omnia_ddr3_training old
env save

Quoted 8 lines
---
  arch/arm/mach-mvebu/Kconfig                   |  1 +
  board/CZ.NIC/turris_omnia/Makefile            |  1 +
  board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++++++++++++++++++
  board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
  4 files changed, 82 insertions(+), 1 deletion(-)

create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c

Quoted 8 lines

For turris_omnia_defconfig, this is dropped when compiled:

drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning:
'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function]
776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32

value, u32 **ptr);
       |            ^~~~~~~~~~~~~~~~~~~

And it also seems that there is still something wrong with this old DDR training code port. Some boards still experience random bugs with this, but not with the U-Boot from 2015. :-(

#13 lore raw

Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var

Hi Marek,

Quoted 34 lines · Marek Behún
Quoted 22 lines · On Mon, 6 May 2024 12:03:55 +0200 Stefan Roese <[email protected]> wrote:

Hi Marek,

Quoted 10 lines · Marek Behún

Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable.

Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable
env set omnia_ddr3_training old
env save

Quoted 8 lines
---
   arch/arm/mach-mvebu/Kconfig                   |  1 +
   board/CZ.NIC/turris_omnia/Makefile            |  1 +
   board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++++++++++++++++++
   board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
   4 files changed, 82 insertions(+), 1 deletion(-)

create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c

Quoted 8 lines

For turris_omnia_defconfig, this is dropped when compiled:

drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning:
'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function]

    776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32
value, u32 **ptr);
        |            ^~~~~~~~~~~~~~~~~~~
Quoted 3 lines

And it also seems that there is still something wrong with this old DDR training code port. Some boards still experience random bugs with this, but not with the U-Boot from 2015. :-(

Hmmm, strange.

How to continue? Are these "old DDR training patches" on hold for now?

Thanks,
Stefan

#14 lore raw

Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var

Quoted 37 lines · On Wed, 15 May 2024 11:10:09 +0200 Stefan Roese <[email protected]> wrote:

Hi Marek,

Quoted 34 lines · Marek Behún
Quoted 30 lines · On Mon, 6 May 2024 12:03:55 +0200 Stefan Roese <[email protected]> wrote:

Hi Marek,

Quoted 10 lines · Marek Behún

Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable.

Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable
env set omnia_ddr3_training old
env save

Quoted 8 lines
---
   arch/arm/mach-mvebu/Kconfig                   |  1 +
   board/CZ.NIC/turris_omnia/Makefile            |  1 +
   board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++++++++++++++++++
   board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
   4 files changed, 82 insertions(+), 1 deletion(-)

create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c

For turris_omnia_defconfig, this is dropped when compiled:

drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning:
'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function]

    776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32
value, u32 **ptr);
        |            ^~~~~~~~~~~~~~~~~~~  
Quoted 7 lines
Quoted 3 lines

And it also seems that there is still something wrong with this old DDR training code port. Some boards still experience random bugs with this, but not with the U-Boot from 2015. :-(

Hmmm, strange.

How to continue? Are these "old DDR training patches" on hold for now?

The first 5 patches should be fine, the "old DDR training" comes in the second half. Is it possible to merge only the first 5? And also the one patch I sent on April 30:
arm: mvebu: turris_omnia: Fix ethernet PHY reset gpio FDT fixup

Marek

#15 lore raw

Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var

Quoted 44 lines · Marek Behún
Quoted 41 lines · On Wed, 15 May 2024 11:10:09 +0200 Stefan Roese <[email protected]> wrote:

Hi Marek,

Quoted 37 lines · Marek Behún
Quoted 22 lines · On Mon, 6 May 2024 12:03:55 +0200 Stefan Roese <[email protected]> wrote:

Hi Marek,

Quoted 10 lines · Marek Behún

Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable.

Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable
env set omnia_ddr3_training old
env save

Quoted 8 lines
---
    arch/arm/mach-mvebu/Kconfig                   |  1 +
    board/CZ.NIC/turris_omnia/Makefile            |  1 +
    board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++++++++++++++++++
    board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
    4 files changed, 82 insertions(+), 1 deletion(-)

create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c

Quoted 8 lines

For turris_omnia_defconfig, this is dropped when compiled:

drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning:
'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function]

     776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32
value, u32 **ptr);
         |            ^~~~~~~~~~~~~~~~~~~

And it also seems that there is still something wrong with this old DDR training code port. Some boards still experience random bugs with this, but not with the U-Boot from 2015. :-(

Quoted 8 lines
Quoted 3 lines

Hmmm, strange.

How to continue? Are these "old DDR training patches" on hold for now?

The first 5 patches should be fine, the "old DDR training" comes in the second half. Is it possible to merge only the first 5? And also the one patch I sent on April 30:
arm: mvebu: turris_omnia: Fix ethernet PHY reset gpio FDT fixup

Yes, that might be possible. Let me check...

Thanks,
Stefan