Skip to contentSkip to conversation

ARM: mvebu: a38x: updates to ddr training code

PATCH New Chris Packham 2 participants 8 messages May 10, 2018 – May 14, 2018

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

v3 cover ARM: mvebu: a38x: updates to ddr training code

This series updates the ddr training code in u-boot with the latest publicly available version from Marvell which can be found at
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git
(mv_ddr-armada-17.10 branch).

I've tried to make the delta as small as possible without breaking bisect-ability.

The first 2 patches have already been sent as
http://patchwork.ozlabs.org/patch/894866/ and
http://patchwork.ozlabs.org/patch/894865/

The bulk of the changes are in patch 4. Naturally this doesn't pass checkpatch.pl but I'm erring on the side of being able to diff with the upstream source. Also due to it's size this patch may not make it to the mailing list so the full series can be retrieved from the mv-ddr branch of https://github.com/cpackham/u-boot.git.

I've tested this series on the db-88f6820-amc board and on a custom board that is not upstream (yet). I've also build tested the other a38x boards. More testing on actual hardware would be greatly appreciated.

This version is rebased against master to mop up the SPDX changes.

Changes in v3:
- Update to current SPDX style

Changes in v2:
- remove unused #include

Chris Packham (6):
ARM: mvebu: a38x: move definition of PEX_CFG_DIRECT_ACCESS
ARM: mvebu: a38x: move sys_env_device_rev_get
ARM: mvebu: a38x: remove some unused code
ARM: mvebu: a38x: sync ddr training code with upstream
ARM: mvebu: a38x: restore support for setting timing
ARM: mvebu: a38x: use non-zero size for ddr scrubbing

 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h    |    1 +
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c |   26 +-
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h |    1 -
 board/CZ.NIC/turris_omnia/turris_omnia.c      |   38 +-
 board/Marvell/db-88f6820-amc/db-88f6820-amc.c |   21 +-
 board/Marvell/db-88f6820-gp/db-88f6820-gp.c   |   21 +-
 board/gdsys/a38x/controlcenterdc.c            |   22 +-
 board/solidrun/clearfog/clearfog.c            |   21 +-
 drivers/ddr/marvell/a38x/Makefile             |   10 +-
 drivers/ddr/marvell/a38x/ddr3_a38x.c          |  736 --------
 drivers/ddr/marvell/a38x/ddr3_a38x.h          |   92 -
 .../ddr/marvell/a38x/ddr3_a38x_mc_static.h    |  225 ---
 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h |   21 -
 drivers/ddr/marvell/a38x/ddr3_a38x_training.c |   39 -
 drivers/ddr/marvell/a38x/ddr3_debug.c         |  742 +++++---
 .../ddr/marvell/a38x/ddr3_hws_hw_training.c   |  147 --
 .../ddr/marvell/a38x/ddr3_hws_hw_training.h   |   48 -
 .../marvell/a38x/ddr3_hws_hw_training_def.h   |  463 -----
 .../ddr/marvell/a38x/ddr3_hws_sil_training.h  |   16 -
 drivers/ddr/marvell/a38x/ddr3_init.c          |  798 ++-------
 drivers/ddr/marvell/a38x/ddr3_init.h          |  300 +---
 drivers/ddr/marvell/a38x/ddr3_logging_def.h   |   10 +-
 .../ddr/marvell/a38x/ddr3_patterns_64bit.h    |    1 +
 drivers/ddr/marvell/a38x/ddr3_topology_def.h  |    6 +-
 drivers/ddr/marvell/a38x/ddr3_training.c      | 1491 ++++++++++-------
 drivers/ddr/marvell/a38x/ddr3_training_bist.c |  548 ++++--
 .../a38x/ddr3_training_centralization.c       |  108 +-
 drivers/ddr/marvell/a38x/ddr3_training_db.c   |  267 ++-
 .../ddr/marvell/a38x/ddr3_training_hw_algo.c  |   98 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip.h   |   19 +-
 .../ddr/marvell/a38x/ddr3_training_ip_bist.h  |    6 +-
 .../ddr/marvell/a38x/ddr3_training_ip_db.h    |   71 +-
 .../ddr/marvell/a38x/ddr3_training_ip_def.h   |   34 +-
 .../marvell/a38x/ddr3_training_ip_engine.c    | 1134 ++++++++-----
 .../marvell/a38x/ddr3_training_ip_engine.h    |    9 +-
 .../ddr/marvell/a38x/ddr3_training_ip_flow.h  |  305 +---
 .../marvell/a38x/ddr3_training_ip_prv_if.h    |   17 +-
 .../marvell/a38x/ddr3_training_ip_static.h    |   30 -
 .../ddr/marvell/a38x/ddr3_training_leveling.c | 1347 ++++++++-------
 .../ddr/marvell/a38x/ddr3_training_leveling.h |    2 +-
 drivers/ddr/marvell/a38x/ddr3_training_pbs.c  |  201 ++-
 .../ddr/marvell/a38x/ddr3_training_static.c   |  538 ------
 drivers/ddr/marvell/a38x/ddr_ml_wrapper.h     |  148 ++
 drivers/ddr/marvell/a38x/ddr_topology_def.h   |   82 +-
 .../ddr/marvell/a38x/mv_ddr_build_message.c   |    1 +
 drivers/ddr/marvell/a38x/mv_ddr_common.c      |   47 +
 drivers/ddr/marvell/a38x/mv_ddr_common.h      |   20 +
 drivers/ddr/marvell/a38x/mv_ddr_plat.c        | 1450 ++++++++++++++++
 drivers/ddr/marvell/a38x/mv_ddr_plat.h        |  236 +++
 drivers/ddr/marvell/a38x/mv_ddr_regs.h        |  446 +++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.c         |  377 +++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.h         |  289 ++++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c |  102 ++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h |  117 ++
 drivers/ddr/marvell/a38x/mv_ddr_topology.c    |  197 +++
 drivers/ddr/marvell/a38x/mv_ddr_topology.h    |  129 ++
 drivers/ddr/marvell/a38x/seq_exec.h           |   64 +
 drivers/ddr/marvell/a38x/silicon_if.h         |   16 -
 drivers/ddr/marvell/a38x/xor.c                |  185 +-
 drivers/ddr/marvell/a38x/xor.h                |    3 +-
 60 files changed, 7984 insertions(+), 5955 deletions(-)
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.c
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_training.c
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr_ml_wrapper.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_build_message.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_common.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_common.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_plat.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_plat.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_regs.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_spd.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_spd.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_topology.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/seq_exec.h
 delete mode 100644 drivers/ddr/marvell/a38x/silicon_if.h
Signature · 1 line
2.17.0
#1 lore raw

PATCH v3 1/6 ARM: mvebu: a38x: move definition of PEX_CFG_DIRECT_ACCESS

PEX_CFG_DIRECT_ACCESS was defined in ddr3_hws_hw_training_def.h despite only being used in the serdes code. Move this definition to ctrl_pex.h where all the other PEX defines are. Also remove the duplicate definition of PEX_DEVICE_AND_VENDOR_ID which is already defined in ctrl_pex.h.

---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h          | 1 +
 drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h +1 -0
index 53ed4eab3203..3f30b6bf972e 100644
@@ -46,6 +46,7 @@
 
 /* Controller revision info */
 #define PEX_DEVICE_AND_VENDOR_ID	0x000
+#define PEX_CFG_DIRECT_ACCESS(if, reg)	(PEX_IF_REGS_BASE(if) + (reg))
 
 /* PCI Express Configuration Address Register */
 #define PXCAR_REG_NUM_OFFS		2
drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h +0 -2
index c99437be22aa..a87fc404cb7d 100644
@@ -421,8 +421,6 @@
 
 /* Power Management Clock Gating Control Register */
 #define POWER_MNG_CTRL_REG			0x18220
-#define PEX_DEVICE_AND_VENDOR_ID		0x000
-#define PEX_CFG_DIRECT_ACCESS(if, reg)	(PEX_IF_REGS_BASE(if) + (reg))
 #define PMC_PEXSTOPCLOCK_OFFS(p)	((p) < 8 ? (5 + (p)) : (18 + (p)))
 #define PMC_PEXSTOPCLOCK_MASK(p)	(1 << PMC_PEXSTOPCLOCK_OFFS(p))
 #define PMC_PEXSTOPCLOCK_EN(p)		(1 << PMC_PEXSTOPCLOCK_OFFS(p))
Signature · 1 line
2.17.0
#2 lore raw

PATCH v3 2/6 ARM: mvebu: a38x: move sys_env_device_rev_get

In reply to Chris Packham

Move sys_env_device_rev_get() from the ddr training code to sys_env_lib.c (which currently resides with the serdes code). This brings sys_env_device_rev_get() into line with sys_env_device_id_get() and sys_env_model_get().

---

Changes in v3: None
Changes in v2:
- remove unused #include

 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c | 26 +++++++++++++++++--
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h |  1 -
 drivers/ddr/marvell/a38x/ddr3_init.c          | 24 -----------------
 3 files changed, 24 insertions(+), 27 deletions(-)
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c +24 -2
index d26068e1d774..d387893af37d 100644
@@ -12,8 +12,6 @@
 #include "seq_exec.h"
 #include "sys_env_lib.h"
 
-#include "../../../drivers/ddr/marvell/a38x/ddr3_a38x.h"
-
 #ifdef CONFIG_ARMADA_38X
 enum unit_id sys_env_soc_unit_nums[MAX_UNITS_ID][MAX_DEV_ID_NUM] = {
 /*                     6820    6810     6811     6828     */
@@ -234,3 +232,27 @@ u32 sys_env_device_id_get(void)
 
 	return g_dev_id;
 }
+
+/*
+ * sys_env_device_rev_get - Get Marvell controller device revision number
+ *
+ * DESCRIPTION:
+ *       This function returns 8bit describing the device revision as defined
+ *       Revision ID Register.
+ *
+ * INPUT:
+ *       None.
+ *
+ * OUTPUT:
+ *       None.
+ *
+ * RETURN:
+ *       8bit desscribing Marvell controller revision number
+ */
+u8 sys_env_device_rev_get(void)
+{
+	u32 value;
+
+	value = reg_read(DEV_VERSION_ID_REG);
+	return (value & (REVISON_ID_MASK)) >> REVISON_ID_OFFS;
+}
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h +0 -1
index c5461067fd88..953445b7d7ae 100644
@@ -7,7 +7,6 @@
 #define _SYS_ENV_LIB_H
 
 #include "../../../drivers/ddr/marvell/a38x/ddr3_init.h"
-#include "../../../drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h"
 
 /* Serdes definitions */
 #define COMMON_PHY_BASE_ADDR		0x18300
drivers/ddr/marvell/a38x/ddr3_init.c +0 -24
index 6ee13c10e493..1c5b1f75ca4f 100644
@@ -107,30 +107,6 @@ static int ddr3_hws_tune_training_params(u8 dev_num);
 /* A39x revisions */
 #define MV_88F69XX_Z1_ID		0x2
 
-/*
- * sys_env_device_rev_get - Get Marvell controller device revision number
- *
- * DESCRIPTION:
- *       This function returns 8bit describing the device revision as defined
- *       Revision ID Register.
- *
- * INPUT:
- *       None.
- *
- * OUTPUT:
- *       None.
- *
- * RETURN:
- *       8bit desscribing Marvell controller revision number
- */
-u8 sys_env_device_rev_get(void)
-{
-	u32 value;
-
-	value = reg_read(DEV_VERSION_ID_REG);
-	return (value & (REVISON_ID_MASK)) >> REVISON_ID_OFFS;
-}
-
 /*
  * sys_env_dlb_config_ptr_get
  *
Signature · 1 line
2.17.0
#3 lore raw

PATCH v3 3/6 ARM: mvebu: a38x: remove some unused code

In reply to Chris Packham

No in-tree code defines SUPPORT_STATIC_DUNIT_CONFIG or STATIC_ALGO_SUPPORT. Remove ddr3_a38x_mc_static.h and use unifdef to remove unused sections in the rest of the ddr/marvell/a38x code.

---
Much of this code is moved/removed in the updated DDR code so this commit helps minimise the final delta.

Changes in v3: None
Changes in v2: None

 drivers/ddr/marvell/a38x/ddr3_a38x.c          |  51 --
 .../ddr/marvell/a38x/ddr3_a38x_mc_static.h    | 225 ---------
 drivers/ddr/marvell/a38x/ddr3_debug.c         |   9 -
 drivers/ddr/marvell/a38x/ddr3_init.c          |  29 --
 drivers/ddr/marvell/a38x/ddr3_init.h          |   1 -
 drivers/ddr/marvell/a38x/ddr3_training.c      |  41 --
 .../ddr/marvell/a38x/ddr3_training_static.c   | 438 ------------------
 7 files changed, 794 deletions(-)
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h
drivers/ddr/marvell/a38x/ddr3_a38x.c +0 -51
index e152e842aef1..c356d0900870 100644
@@ -76,41 +76,6 @@ struct trip_delay_element a38x_board_round_trip_delay_array[] = {
 	{ 4282, 6160 }	/* ECC PUP */
 };
 
-#ifdef STATIC_ALGO_SUPPORT
-/* package trace */
-static struct trip_delay_element a38x_package_round_trip_delay_array[] = {
-	/* IF BUS DQ_DELAY CK_DELAY */
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 },
-	{ 0, 0 }
-};
-
-static int a38x_silicon_delay_offset[] = {
-	/* board 0 */
-	0,
-	/* board 1 */
-	0,
-	/* board 2 */
-	0
-};
-#endif
 
 static u8 a38x_bw_per_freq[DDR_FREQ_LIMIT] = {
 	0x3,			/* DDR_FREQ_100 */
@@ -367,22 +332,6 @@ static int ddr3_tip_init_a38x_silicon(u32 dev_num, u32 board_id)
 
 	ddr3_tip_register_dq_table(dev_num, dq_bit_map_2_phy_pin);
 
-#ifdef STATIC_ALGO_SUPPORT
-	{
-		struct hws_tip_static_config_info static_config;
-		u32 board_offset =
-		    board_id * A38X_NUMBER_OF_INTERFACES *
-		    tm->num_of_bus_per_interface;
-
-		static_config.silicon_delay =
-			a38x_silicon_delay_offset[board_id];
-		static_config.package_trace_arr =
-			a38x_package_round_trip_delay_array;
-		static_config.board_trace_arr =
-			&a38x_board_round_trip_delay_array[board_offset];
-		ddr3_tip_init_static_config_db(dev_num, &static_config);
-	}
-#endif
 	status = ddr3_tip_a38x_get_init_freq(dev_num, &ddr_freq);
 	if (MV_OK != status) {
 		DEBUG_TRAINING_ACCESS(DEBUG_LEVEL_ERROR,
drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h deleted +0 -225

225 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_debug.c +0 -9
index 68ab9476ccdf..c14400840e7e 100644
@@ -867,15 +867,6 @@ static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32 value, u32 **ptr)
 	case 0x25:
 		*ptr = (u32 *)&is_adll_calib_before_init;
 		break;
-#ifdef STATIC_ALGO_SUPPORT
-	case 0x26:
-		*ptr = (u32 *)&(silicon_delay[0]);
-		break;
-
-	case 0x27:
-		*ptr = (u32 *)&wl_debug_delay;
-		break;
-#endif
 	case 0x28:
 		*ptr = (u32 *)&is_tune_result;
 		break;
drivers/ddr/marvell/a38x/ddr3_init.c +0 -29
index 1c5b1f75ca4f..73d984ba66a8 100644
@@ -59,20 +59,6 @@ struct dram_modes {
 };
 
 struct dram_modes ddr_modes[] = {
-#ifdef SUPPORT_STATIC_DUNIT_CONFIG
-	/* Conf name, CPUFreq, Fab_freq, Chip ID, Chip/Board, MC regs*/
-#ifdef CONFIG_CUSTOMER_BOARD_SUPPORT
-	{"a38x_customer_0_800", DDR_FREQ_800, 0, 0x0, A38X_CUSTOMER_BOARD_ID0,
-	 ddr3_customer_800},
-	{"a38x_customer_1_800", DDR_FREQ_800, 0, 0x0, A38X_CUSTOMER_BOARD_ID1,
-	 ddr3_customer_800},
-#else
-	{"a38x_533", DDR_FREQ_533, 0, 0x0, MARVELL_BOARD, ddr3_a38x_533},
-	{"a38x_667", DDR_FREQ_667, 0, 0x0, MARVELL_BOARD, ddr3_a38x_667},
-	{"a38x_800", DDR_FREQ_800, 0, 0x0, MARVELL_BOARD, ddr3_a38x_800},
-	{"a38x_933", DDR_FREQ_933, 0, 0x0, MARVELL_BOARD, ddr3_a38x_933},
-#endif
-#endif
 };
 #endif /* defined(CONFIG_ARMADA_38X) */
 
@@ -91,9 +77,6 @@ static char *ddr_type = "DDR3";
  */
 u8 generic_init_controller = 1;
 
-#ifdef SUPPORT_STATIC_DUNIT_CONFIG
-static u32 ddr3_get_static_ddr_mode(void);
-#endif
 static int ddr3_hws_tune_training_params(u8 dev_num);
 
 /* device revision */
@@ -342,18 +325,6 @@ int ddr3_init(void)
 	/* Set X-BAR windows for the training sequence */
 	ddr3_save_and_set_training_windows(win);
 
-#ifdef SUPPORT_STATIC_DUNIT_CONFIG
-	/*
-	 * Load static controller configuration (in case dynamic/generic init
-	 * is not enabled
-	 */
-	if (generic_init_controller == 0) {
-		ddr3_tip_init_specific_reg_config(0,
-						  ddr_modes
-						  [ddr3_get_static_ddr_mode
-						   ()].regs);
-	}
-#endif
 
 	/* Tune training algo paramteres */
 	status = ddr3_hws_tune_training_params(0);
drivers/ddr/marvell/a38x/ddr3_init.h +0 -1
index 05ff62b04154..8cb645ffb59b 100644
@@ -8,7 +8,6 @@
 
 #if defined(CONFIG_ARMADA_38X)
 #include "ddr3_a38x.h"
-#include "ddr3_a38x_mc_static.h"
 #include "ddr3_a38x_topology.h"
 #endif
 #include "ddr3_hws_hw_training.h"
drivers/ddr/marvell/a38x/ddr3_training.c +0 -41

59 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_static.c +0 -438

444 lines not on this page · raw message

Signature · 1 line
2.17.0
#4 lore raw

PATCH v3 4/6 ARM: mvebu: a38x: sync ddr training code with upstream

In reply to Chris Packham

This syncs drivers/ddr/marvell/a38x/ with the mv_ddr-armada-17.10 branch of https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git.

The upstream code is incorporated omitting the ddr4 and apn806 and folding the nested a38x directory up one level. After that a semi-automated step is used to drop unused features with unifdef

  find drivers/ddr/marvell/a38x/ -name '*.[ch]' | \
    xargs unifdef -m -UMV_DDR -UMV_DDR_ATF -UCONFIG_DDR4 \
		-UCONFIG_APN806 -UCONFIG_MC_STATIC \
		-UCONFIG_MC_STATIC_PRINT -UCONFIG_PHY_STATIC \
		-UCONFIG_64BIT

INTER_REGS_BASE is updated to be defined as SOC_REGS_PHY_BASE.

Some now empty files are removed and the ternary license is replaced with a SPDX GPL-2.0+ identifier.

---

Changes in v3:
- Update to current SPDX style

Changes in v2: None

 board/CZ.NIC/turris_omnia/turris_omnia.c      |   36 +-
 board/Marvell/db-88f6820-amc/db-88f6820-amc.c |   20 +-
 board/Marvell/db-88f6820-gp/db-88f6820-gp.c   |   20 +-
 board/gdsys/a38x/controlcenterdc.c            |   21 +-
 board/solidrun/clearfog/clearfog.c            |   20 +-
 drivers/ddr/marvell/a38x/Makefile             |   10 +-
 drivers/ddr/marvell/a38x/ddr3_a38x.c          |  685 --------
 drivers/ddr/marvell/a38x/ddr3_a38x.h          |   92 --
 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h |   21 -
 drivers/ddr/marvell/a38x/ddr3_a38x_training.c |   39 -
 drivers/ddr/marvell/a38x/ddr3_debug.c         |  733 ++++++---
 .../ddr/marvell/a38x/ddr3_hws_hw_training.c   |  147 --
 .../ddr/marvell/a38x/ddr3_hws_hw_training.h   |   48 -
 .../marvell/a38x/ddr3_hws_hw_training_def.h   |  461 ------
 .../ddr/marvell/a38x/ddr3_hws_sil_training.h  |   16 -
 drivers/ddr/marvell/a38x/ddr3_init.c          |  745 ++-------
 drivers/ddr/marvell/a38x/ddr3_init.h          |  299 +---
 drivers/ddr/marvell/a38x/ddr3_logging_def.h   |   10 +-
 .../ddr/marvell/a38x/ddr3_patterns_64bit.h    |    1 +
 drivers/ddr/marvell/a38x/ddr3_topology_def.h  |    6 +-
 drivers/ddr/marvell/a38x/ddr3_training.c      | 1450 +++++++++-------
 drivers/ddr/marvell/a38x/ddr3_training_bist.c |  548 +++++--
 .../a38x/ddr3_training_centralization.c       |  108 +-
 drivers/ddr/marvell/a38x/ddr3_training_db.c   |  267 ++-
 .../ddr/marvell/a38x/ddr3_training_hw_algo.c  |   98 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip.h   |   19 +-
 .../ddr/marvell/a38x/ddr3_training_ip_bist.h  |    6 +-
 .../ddr/marvell/a38x/ddr3_training_ip_db.h    |   71 +-
 .../ddr/marvell/a38x/ddr3_training_ip_def.h   |   34 +-
 .../marvell/a38x/ddr3_training_ip_engine.c    | 1134 ++++++++-----
 .../marvell/a38x/ddr3_training_ip_engine.h    |    9 +-
 .../ddr/marvell/a38x/ddr3_training_ip_flow.h  |  305 +---
 .../marvell/a38x/ddr3_training_ip_prv_if.h    |   17 +-
 .../marvell/a38x/ddr3_training_ip_static.h    |   30 -
 .../ddr/marvell/a38x/ddr3_training_leveling.c | 1347 ++++++++-------
 .../ddr/marvell/a38x/ddr3_training_leveling.h |    2 +-
 drivers/ddr/marvell/a38x/ddr3_training_pbs.c  |  201 +--
 .../ddr/marvell/a38x/ddr3_training_static.c   |  100 --
 drivers/ddr/marvell/a38x/ddr_ml_wrapper.h     |  148 ++
 drivers/ddr/marvell/a38x/ddr_topology_def.h   |   83 +-
 .../ddr/marvell/a38x/mv_ddr_build_message.c   |    1 +
 drivers/ddr/marvell/a38x/mv_ddr_common.c      |   47 +
 drivers/ddr/marvell/a38x/mv_ddr_common.h      |   20 +
 drivers/ddr/marvell/a38x/mv_ddr_plat.c        | 1455 +++++++++++++++++
 drivers/ddr/marvell/a38x/mv_ddr_plat.h        |  235 +++
 drivers/ddr/marvell/a38x/mv_ddr_regs.h        |  446 +++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.c         |  377 +++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.h         |  289 ++++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c |  102 ++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h |  117 ++
 drivers/ddr/marvell/a38x/mv_ddr_topology.c    |  197 +++
 drivers/ddr/marvell/a38x/mv_ddr_topology.h    |  123 ++
 drivers/ddr/marvell/a38x/seq_exec.h           |   64 +
 drivers/ddr/marvell/a38x/silicon_if.h         |   16 -
 drivers/ddr/marvell/a38x/xor.c                |  184 ++-
 drivers/ddr/marvell/a38x/xor.h                |    3 +-
 56 files changed, 7944 insertions(+), 5139 deletions(-)
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.c
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_training.c
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr_ml_wrapper.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_build_message.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_common.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_common.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_plat.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_plat.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_regs.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_spd.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_spd.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_topology.c
 create mode 100644 drivers/ddr/marvell/a38x/mv_ddr_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/seq_exec.h
 delete mode 100644 drivers/ddr/marvell/a38x/silicon_if.h
board/CZ.NIC/turris_omnia/turris_omnia.c +20 -16
index 58d1f5fe3536..29f81cdccfd4 100644
@@ -27,7 +27,7 @@
 # include <wdt.h>
 #endif
 
-#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+#include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include <../serdes/a38x/high_speed_env_spec.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -200,7 +200,8 @@ static bool omnia_read_eeprom(struct omnia_eeprom *oep)
  * be used by the DDR3 init code in the SPL U-Boot version to configure
  * the DDR3 controller.
  */
-static struct hws_topology_map board_topology_map_1g = {
+static struct mv_ddr_topology_map board_topology_map_1g = {
+	DEBUG_LEVEL_ERROR,
 	0x1, /* active interfaces */
 	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
 	{ { { {0x1, 0, 0, 0},
@@ -209,17 +210,19 @@ static struct hws_topology_map board_topology_map_1g = {
 	      {0x1, 0, 0, 0},
 	      {0x1, 0, 0, 0} },
 	    SPEED_BIN_DDR_1600K,	/* speed_bin */
-	    BUS_WIDTH_16,		/* memory_width */
-	    MEM_4G,			/* mem_size */
+	    MV_DDR_DEV_WIDTH_16BIT,	/* memory_width */
+	    MV_DDR_DIE_CAP_4GBIT,			/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    HWS_TEMP_NORMAL,		/* temperature */
-	    HWS_TIM_2T} },		/* timing (force 2t) */
-	5,				/* Num Of Bus Per Interface*/
-	BUS_MASK_32BIT			/* Busses mask */
+	    MV_DDR_TEMP_NORMAL} },	/* temperature */
+	BUS_MASK_32BIT,			/* Busses mask */
+	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
+	{ {0} },			/* raw spd data */
+	{0}				/* timing parameters */
 };
 
-static struct hws_topology_map board_topology_map_2g = {
+static struct mv_ddr_topology_map board_topology_map_2g = {
+	DEBUG_LEVEL_ERROR,
 	0x1, /* active interfaces */
 	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
 	{ { { {0x1, 0, 0, 0},
@@ -228,17 +231,18 @@ static struct hws_topology_map board_topology_map_2g = {
 	      {0x1, 0, 0, 0},
 	      {0x1, 0, 0, 0} },
 	    SPEED_BIN_DDR_1600K,	/* speed_bin */
-	    BUS_WIDTH_16,		/* memory_width */
-	    MEM_8G,			/* mem_size */
+	    MV_DDR_DEV_WIDTH_16BIT,	/* memory_width */
+	    MV_DDR_DIE_CAP_8GBIT,			/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    HWS_TEMP_NORMAL,		/* temperature */
-	    HWS_TIM_2T} },		/* timing (force 2t) */
-	5,				/* Num Of Bus Per Interface*/
-	BUS_MASK_32BIT			/* Busses mask */
+	    MV_DDR_TEMP_NORMAL} },	/* temperature */
+	BUS_MASK_32BIT,			/* Busses mask */
+	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
+	{ {0} },			/* raw spd data */
+	{0}				/* timing parameters */
 };
 
-struct hws_topology_map *ddr3_get_topology_map(void)
+struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 {
 	static int mem = 0;
 	struct omnia_eeprom oep;
board/Marvell/db-88f6820-amc/db-88f6820-amc.c +11 -9
index ba9738c0f7ee..e39dc75f9228 100644
@@ -11,7 +11,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 
-#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+#include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include <../serdes/a38x/high_speed_env_spec.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -55,7 +55,8 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
  * be used by the DDR3 init code in the SPL U-Boot version to configure
  * the DDR3 controller.
  */
-static struct hws_topology_map board_topology_map = {
+static struct mv_ddr_topology_map board_topology_map = {
+	DEBUG_LEVEL_ERROR,
 	0x1, /* active interfaces */
 	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
 	{ { { {0x1, 0, 0, 0},
@@ -64,17 +65,18 @@ static struct hws_topology_map board_topology_map = {
 	      {0x1, 0, 0, 0},
 	      {0x1, 0, 0, 0} },
 	    SPEED_BIN_DDR_1866L,	/* speed_bin */
-	    BUS_WIDTH_8,		/* memory_width */
-	    MEM_2G,			/* mem_size */
+	    MV_DDR_DEV_WIDTH_8BIT,	/* memory_width */
+	    MV_DDR_DIE_CAP_2GBIT,	/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    HWS_TEMP_LOW,		/* temperature */
-	    HWS_TIM_DEFAULT} },		/* timing */
-	5,				/* Num Of Bus Per Interface*/
-	BUS_MASK_32BIT			/* Busses mask */
+	    MV_DDR_TEMP_LOW} },		/* temperature */
+	BUS_MASK_32BIT,			/* Busses mask */
+	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
+	{ {0} },			/* raw spd data */
+	{0}				/* timing parameters */
 };
 
-struct hws_topology_map *ddr3_get_topology_map(void)
+struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 {
 	/* Return the board topology as defined in the board code */
 	return &board_topology_map;
board/Marvell/db-88f6820-gp/db-88f6820-gp.c +11 -9
index fc405b939b9c..ee12ca68ec2a 100644
@@ -11,7 +11,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 
-#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+#include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include <../serdes/a38x/high_speed_env_spec.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -76,7 +76,8 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
  * be used by the DDR3 init code in the SPL U-Boot version to configure
  * the DDR3 controller.
  */
-static struct hws_topology_map board_topology_map = {
+static struct mv_ddr_topology_map board_topology_map = {
+	DEBUG_LEVEL_ERROR,
 	0x1, /* active interfaces */
 	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
 	{ { { {0x1, 0, 0, 0},
@@ -85,17 +86,18 @@ static struct hws_topology_map board_topology_map = {
 	      {0x1, 0, 0, 0},
 	      {0x1, 0, 0, 0} },
 	    SPEED_BIN_DDR_1866L,	/* speed_bin */
-	    BUS_WIDTH_8,		/* memory_width */
-	    MEM_4G,			/* mem_size */
+	    MV_DDR_DEV_WIDTH_8BIT,	/* memory_width */
+	    MV_DDR_DIE_CAP_4GBIT,	/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    HWS_TEMP_LOW,		/* temperature */
-	    HWS_TIM_DEFAULT} },		/* timing */
-	5,				/* Num Of Bus Per Interface*/
-	BUS_MASK_32BIT			/* Busses mask */
+	    MV_DDR_TEMP_LOW} },		/* temperature */
+	BUS_MASK_32BIT,			/* Busses mask */
+	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
+	{ {0} },			/* raw spd data */
+	{0}				/* timing parameters */
 };
 
-struct hws_topology_map *ddr3_get_topology_map(void)
+struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 {
 	/* Return the board topology as defined in the board code */
 	return &board_topology_map;
board/gdsys/a38x/controlcenterdc.c +12 -9
index 5599767dffb0..f750e47b7228 100644
@@ -12,7 +12,7 @@
 #include <asm/arch/cpu.h>
 #include <asm-generic/gpio.h>
 
-#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+#include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include "../arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h"
 
 #include "keyprogram.h"
@@ -39,7 +39,8 @@ DECLARE_GLOBAL_DATA_PTR;
  * be used by the DDR3 init code in the SPL U-Boot version to configure
  * the DDR3 controller.
  */
-static struct hws_topology_map ddr_topology_map = {
+static struct mv_ddr_topology_map ddr_topology_map = {
+	DEBUG_LEVEL_ERROR,
 	0x1, /* active interfaces */
 	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
 	{ { { {0x1, 0, 0, 0},
@@ -48,14 +49,16 @@ static struct hws_topology_map ddr_topology_map = {
 	      {0x1, 0, 0, 0},
 	      {0x1, 0, 0, 0} },
 	    SPEED_BIN_DDR_1600K,	/* speed_bin */
-	    BUS_WIDTH_16,		/* memory_width */
-	    MEM_4G,			/* mem_size */
+	    MV_DDR_DEV_WIDTH_16BIT,	/* memory_width */
+	    MV_DDR_DIE_CAP_4GBIT,	/* mem_size */
 	    DDR_FREQ_533,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    HWS_TEMP_LOW,		/* temperature */
-	    HWS_TIM_DEFAULT} },		/* timing */
-	5,				/* Num Of Bus Per Interface*/
-	BUS_MASK_32BIT			/* Busses mask */
+	    MV_DDR_TEMP_LOW} },		/* temperature */
+	BUS_MASK_32BIT,			/* Busses mask */
+	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
+	{ {0} },			/* raw spd data */
+	{0}				/* timing parameters */
+
 };
 
 static struct serdes_map serdes_topology_map[] = {
@@ -121,7 +124,7 @@ void board_pex_config(void)
 #endif
 }
 
-struct hws_topology_map *ddr3_get_topology_map(void)
+struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 {
 	return &ddr_topology_map;
 }
board/solidrun/clearfog/clearfog.c +11 -9
index 61de16d19e0c..cc11feb85e30 100644
@@ -11,7 +11,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 
-#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+#include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include <../serdes/a38x/high_speed_env_spec.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -69,7 +69,8 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
  * be used by the DDR3 init code in the SPL U-Boot version to configure
  * the DDR3 controller.
  */
-static struct hws_topology_map board_topology_map = {
+static struct mv_ddr_topology_map board_topology_map = {
+	DEBUG_LEVEL_ERROR,
 	0x1, /* active interfaces */
 	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
 	{ { { {0x1, 0, 0, 0},
@@ -78,17 +79,18 @@ static struct hws_topology_map board_topology_map = {
 	      {0x1, 0, 0, 0},
 	      {0x1, 0, 0, 0} },
 	    SPEED_BIN_DDR_1600K,	/* speed_bin */
-	    BUS_WIDTH_16,		/* memory_width */
-	    MEM_4G,			/* mem_size */
+	    MV_DDR_DEV_WIDTH_16BIT,	/* memory_width */
+	    MV_DDR_DIE_CAP_4GBIT,	/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    HWS_TEMP_LOW,		/* temperature */
-	    HWS_TIM_DEFAULT} },		/* timing */
-	5,				/* Num Of Bus Per Interface*/
-	BUS_MASK_32BIT			/* Busses mask */
+	    MV_DDR_TEMP_LOW} },		/* temperature */
+	BUS_MASK_32BIT,			/* Busses mask */
+	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
+	{ {0} },			/* raw spd data */
+	{0}				/* timing parameters */
 };
 
-struct hws_topology_map *ddr3_get_topology_map(void)
+struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 {
 	/* Return the board topology as defined in the board code */
 	return &board_topology_map;
drivers/ddr/marvell/a38x/Makefile +6 -4
index 5e258bfe6a4c..8251d6db6608 100644
@@ -1,9 +1,8 @@
 # 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) += mv_ddr_plat.o
+obj-$(CONFIG_SPL_BUILD) += mv_ddr_sys_env_lib.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
@@ -13,5 +12,8 @@ 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
+obj-$(CONFIG_SPL_BUILD) += mv_ddr_build_message.o
+obj-$(CONFIG_SPL_BUILD) += mv_ddr_common.o
+obj-$(CONFIG_SPL_BUILD) += mv_ddr_spd.o
+obj-$(CONFIG_SPL_BUILD) += mv_ddr_topology.o
 obj-$(CONFIG_SPL_BUILD) += xor.o
drivers/ddr/marvell/a38x/ddr3_a38x.c deleted +0 -685

685 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_a38x.h deleted +0 -92

92 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_a38x_topology.h deleted +0 -21
deleted file mode 100644
index be8de88f4e87..000000000000
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) Marvell International Ltd. and its affiliates
- */
-
-#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/ddr3_a38x_training.c deleted +0 -39
deleted file mode 100644
index 7a05e5898835..000000000000
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) Marvell International Ltd. and its affiliates
- */
-
-#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/ddr3_debug.c +483 -250

1,218 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c deleted +0 -147

147 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h deleted +0 -48

48 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h deleted +0 -461

461 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h deleted +0 -16
deleted file mode 100644
index 2f8e3fdd944b..000000000000
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) Marvell International Ltd. and its affiliates
- */
-
-#ifndef _DDR3_HWS_SIL_TRAINING_H
-#define _DDR3_HWS_SIL_TRAINING_H
-
-#include "ddr3_training_ip.h"
-#include "ddr3_training_ip_prv_if.h"
-
-int ddr3_silicon_pre_config(void);
-int ddr3_silicon_init(void);
-int ddr3_silicon_get_ddr_target_freq(u32 *ddr_freq);
-
-#endif /* _DDR3_HWS_SIL_TRAINING_H */
drivers/ddr/marvell/a38x/ddr3_init.c +127 -618

12 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_init.h +53 -246

299 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_logging_def.h +7 -3
index fe929bb72ac0..ad9da1cfffb4 100644

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

drivers/ddr/marvell/a38x/ddr3_patterns_64bit.h +1 -0
index ee41048c6859..1e2260b8710e 100644

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

drivers/ddr/marvell/a38x/ddr3_topology_def.h +4 -2
index eda2b13f9049..1963bae3e62f 100644

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

drivers/ddr/marvell/a38x/ddr3_training.c +858 -592

1,450 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_bist.c +431 -117

548 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_centralization.c +55 -53

108 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_db.c +215 -52

267 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c +41 -57

98 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_ip.h +13 -6
index 0102e6919486..531103c1abd5 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h +5 -1
index 1d7af4dcd3f8..38058cba8a1f 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_db.h +66 -5

71 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_ip_def.h +29 -5
index 2a30f80f7983..2318ceba2920 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c +728 -406

1,134 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h +5 -4
index b19bab1ef1c6..8fbcff50bb26 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h +76 -229

305 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h +14 -3
index 352bc0ce264a..f614d688c915 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_static.h deleted +0 -30
deleted file mode 100644
index d5760fce0821..000000000000

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

drivers/ddr/marvell/a38x/ddr3_training_leveling.c +749 -598

1,347 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_leveling.h +1 -1
index 4c3c4177732d..96d945a33d6e 100644

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

drivers/ddr/marvell/a38x/ddr3_training_pbs.c +108 -93

201 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_static.c deleted +0 -100

100 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr_ml_wrapper.h new file +148 -0

148 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr_topology_def.h +37 -46

83 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_build_message.c new file +1 -0
new file mode 100644
index 000000000000..8e60448318f2

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

drivers/ddr/marvell/a38x/mv_ddr_common.c new file +47 -0

47 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_common.h new file +20 -0
new file mode 100644
index 000000000000..c71ff442edd3

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

drivers/ddr/marvell/a38x/mv_ddr_plat.c new file +1455 -0

1,455 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_plat.h new file +235 -0

235 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_regs.h new file +446 -0

446 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_spd.c new file +377 -0

377 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_spd.h new file +289 -0

289 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c new file +102 -0

102 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h new file +117 -0

117 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_topology.c new file +197 -0

197 lines not on this page · raw message

drivers/ddr/marvell/a38x/mv_ddr_topology.h new file +123 -0

123 lines not on this page · raw message

drivers/ddr/marvell/a38x/seq_exec.h new file +64 -0

64 lines not on this page · raw message

drivers/ddr/marvell/a38x/silicon_if.h deleted +0 -16
deleted file mode 100644
index 4efd9b8b0127..000000000000

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

drivers/ddr/marvell/a38x/xor.c +145 -39

184 lines not on this page · raw message

drivers/ddr/marvell/a38x/xor.h +1 -2
index 9ca973504015..1e0265036934 100644

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

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

Signature · 1 line
2.17.0

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

#5 lore raw

PATCH v3 5/6 ARM: mvebu: a38x: restore support for setting timing

In reply to Chris Packham

This restores support for configuring the timing mode based on the ddr_topology. This was originally implemented in commit 90bcc3d38d2b ("driver/ddr: Add support for setting timing in hws_topology_map") but was removed as part of the upstream sync.

---

Changes in v3: None
Changes in v2: None

 board/CZ.NIC/turris_omnia/turris_omnia.c      | 6 ++++--
 board/Marvell/db-88f6820-amc/db-88f6820-amc.c | 3 ++-
 board/Marvell/db-88f6820-gp/db-88f6820-gp.c   | 3 ++-
 board/gdsys/a38x/controlcenterdc.c            | 3 ++-
 board/solidrun/clearfog/clearfog.c            | 3 ++-
 drivers/ddr/marvell/a38x/ddr3_training.c      | 8 ++++++++
 drivers/ddr/marvell/a38x/ddr_topology_def.h   | 3 +++
 drivers/ddr/marvell/a38x/mv_ddr_plat.c        | 5 -----
 drivers/ddr/marvell/a38x/mv_ddr_topology.h    | 6 ++++++
 9 files changed, 29 insertions(+), 11 deletions(-)
board/CZ.NIC/turris_omnia/turris_omnia.c +4 -2
index 29f81cdccfd4..da663cf1bb0c 100644
@@ -214,7 +214,8 @@ static struct mv_ddr_topology_map board_topology_map_1g = {
 	    MV_DDR_DIE_CAP_4GBIT,			/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    MV_DDR_TEMP_NORMAL} },	/* temperature */
+	    MV_DDR_TEMP_NORMAL,		/* temperature */
+	    MV_DDR_TIM_2T} },		/* timing */
 	BUS_MASK_32BIT,			/* Busses mask */
 	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
 	{ {0} },			/* raw spd data */
@@ -235,7 +236,8 @@ static struct mv_ddr_topology_map board_topology_map_2g = {
 	    MV_DDR_DIE_CAP_8GBIT,			/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    MV_DDR_TEMP_NORMAL} },	/* temperature */
+	    MV_DDR_TEMP_NORMAL,		/* temperature */
+	    MV_DDR_TIM_2T} },		/* timing */
 	BUS_MASK_32BIT,			/* Busses mask */
 	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
 	{ {0} },			/* raw spd data */
board/Marvell/db-88f6820-amc/db-88f6820-amc.c +2 -1
index e39dc75f9228..92d7ae77f07e 100644
@@ -69,7 +69,8 @@ static struct mv_ddr_topology_map board_topology_map = {
 	    MV_DDR_DIE_CAP_2GBIT,	/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    MV_DDR_TEMP_LOW} },		/* temperature */
+	    MV_DDR_TEMP_LOW,		/* temperature */
+	    MV_DDR_TIM_DEFAULT} },	/* timing */
 	BUS_MASK_32BIT,			/* Busses mask */
 	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
 	{ {0} },			/* raw spd data */
board/Marvell/db-88f6820-gp/db-88f6820-gp.c +2 -1
index ee12ca68ec2a..a8cfe8af0a88 100644
@@ -90,7 +90,8 @@ static struct mv_ddr_topology_map board_topology_map = {
 	    MV_DDR_DIE_CAP_4GBIT,	/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    MV_DDR_TEMP_LOW} },		/* temperature */
+	    MV_DDR_TEMP_LOW,		/* temperature */
+	    MV_DDR_TIM_DEFAULT} },	/* timing */
 	BUS_MASK_32BIT,			/* Busses mask */
 	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
 	{ {0} },			/* raw spd data */
board/gdsys/a38x/controlcenterdc.c +2 -1
index f750e47b7228..320bc100c9da 100644
@@ -53,7 +53,8 @@ static struct mv_ddr_topology_map ddr_topology_map = {
 	    MV_DDR_DIE_CAP_4GBIT,	/* mem_size */
 	    DDR_FREQ_533,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    MV_DDR_TEMP_LOW} },		/* temperature */
+	    MV_DDR_TEMP_LOW,		/* temperature */
+	    MV_DDR_TIM_DEFAULT} },	/* timing */
 	BUS_MASK_32BIT,			/* Busses mask */
 	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
 	{ {0} },			/* raw spd data */
board/solidrun/clearfog/clearfog.c +2 -1
index cc11feb85e30..ede303d4ebf9 100644
@@ -83,7 +83,8 @@ static struct mv_ddr_topology_map board_topology_map = {
 	    MV_DDR_DIE_CAP_4GBIT,	/* mem_size */
 	    DDR_FREQ_800,		/* frequency */
 	    0, 0,			/* cas_wl cas_l */
-	    MV_DDR_TEMP_LOW} },		/* temperature */
+	    MV_DDR_TEMP_LOW,		/* temperature */
+	    MV_DDR_TIM_DEFAULT} },	/* timing */
 	BUS_MASK_32BIT,			/* Busses mask */
 	MV_DDR_CFG_DEFAULT,		/* ddr configuration data source */
 	{ {0} },			/* raw spd data */
drivers/ddr/marvell/a38x/ddr3_training.c +8 -0
index 1f26d506da3a..799c5ba089a0 100644
@@ -365,6 +365,7 @@ int hws_ddr3_tip_init_controller(u32 dev_num, struct init_cntr_param *init_cntr_
 	u32 octets_per_if_num = ddr3_tip_dev_attr_get(dev_num, MV_ATTR_OCTET_PER_INTERFACE);
 	struct mv_ddr_topology_map *tm = mv_ddr_topology_map_get();
 	enum hws_ddr_freq freq = tm->interface_params[0].memory_freq;
+	enum mv_ddr_timing timing;
 
 	DEBUG_TRAINING_IP(DEBUG_LEVEL_TRACE,
 			  ("Init_controller, do_mrs_phy=%d, is_ctrl64_bit=%d\n",
@@ -603,8 +604,12 @@ int hws_ddr3_tip_init_controller(u32 dev_num, struct init_cntr_param *init_cntr_
 				      DUNIT_CTRL_HIGH_REG,
 				      (init_cntr_prm->msys_init << 7), (1 << 7)));
 
+			timing = tm->interface_params[if_id].timing;
+
 			if (mode_2t != 0xff) {
 				t2t = mode_2t;
+			} else if (timing != MV_DDR_TIM_DEFAULT) {
+				t2t = (timing == MV_DDR_TIM_2T) ? 1 : 0;
 			} else {
 				/* calculate number of CS (per interface) */
 				CHECK_STATUS(calc_cs_num
@@ -1268,6 +1273,7 @@ int ddr3_tip_freq_set(u32 dev_num, enum hws_access_type access_type,
 	u32 octets_per_if_num = ddr3_tip_dev_attr_get(dev_num, MV_ATTR_OCTET_PER_INTERFACE);
 	struct mv_ddr_topology_map *tm = mv_ddr_topology_map_get();
 	unsigned int tclk;
+	enum mv_ddr_timing timing = tm->interface_params[if_id].timing;
 
 	DEBUG_TRAINING_IP(DEBUG_LEVEL_TRACE,
 			  ("dev %d access %d IF %d freq %d\n", dev_num,
@@ -1410,6 +1416,8 @@ int ddr3_tip_freq_set(u32 dev_num, enum hws_access_type access_type,
 		/* Calculate 2T mode */
 		if (mode_2t != 0xff) {
 			t2t = mode_2t;
+		} else if (timing != MV_DDR_TIM_DEFAULT) {
+			t2t = (timing == MV_DDR_TIM_2T) ? 1 : 0;
 		} else {
 			/* Calculate number of CS per interface */
 			CHECK_STATUS(calc_cs_num(dev_num, if_id, &cs_num));
drivers/ddr/marvell/a38x/ddr_topology_def.h +3 -0
index 2c589eb3a655..812224909ae4 100644
@@ -64,6 +64,9 @@ struct if_params {
 
 	/* operation temperature */
 	enum mv_ddr_temperature interface_temp;
+
+	/* 2T vs 1T mode (by default computed from number of CSs) */
+	enum mv_ddr_timing timing;
 };
 
 struct mv_ddr_topology_map {
drivers/ddr/marvell/a38x/mv_ddr_plat.c +0 -5
index ce672e9dd4fa..2070bb38b099 100644
@@ -674,11 +674,6 @@ static int mv_ddr_sw_db_init(u32 dev_num, u32 board_id)
 	dfs_low_freq = DFS_LOW_FREQ_VALUE;
 	calibration_update_control = 1;
 
-#ifdef CONFIG_ARMADA_38X
-	/* For a38x only, change to 2T mode to resolve low freq instability */
-	mode_2t = 1;
-#endif
-
 	ddr3_tip_a38x_get_medium_freq(dev_num, &medium_freq);
 
 	return MV_OK;
drivers/ddr/marvell/a38x/mv_ddr_topology.h +6 -0
index eb017a149726..7bef2d1e0e87 100644
@@ -36,6 +36,12 @@ enum mv_ddr_temperature {
 	MV_DDR_TEMP_HIGH
 };
 
+enum mv_ddr_timing {
+	MV_DDR_TIM_DEFAULT,
+	MV_DDR_TIM_1T,
+	MV_DDR_TIM_2T
+};
+
 enum mv_ddr_timing_data {
 	MV_DDR_TCK_AVG_MIN, /* sdram min cycle time (t ck avg min) */
 	MV_DDR_TAA_MIN, /* min cas latency time (t aa min) */
Signature · 1 line
2.17.0
#6 lore raw

PATCH v3 6/6 ARM: mvebu: a38x: use non-zero size for ddr scrubbing

In reply to Chris Packham

From: Chris Packham <[email protected]>

Make ddr3_calc_mem_cs_size() global scope and use it in ddr3_new_tip_ecc_scrub to correctly initialize all of DDR memory.

---

Changes in v3: None
Changes in v2: None

 drivers/ddr/marvell/a38x/mv_ddr_plat.c | 2 +-
 drivers/ddr/marvell/a38x/mv_ddr_plat.h | 1 +
 drivers/ddr/marvell/a38x/xor.c         | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/ddr/marvell/a38x/mv_ddr_plat.c +1 -1
index 2070bb38b099..2f318cb9ea7b 100644
@@ -995,7 +995,7 @@ static u32 ddr3_get_device_size(u32 cs)
 	}
 }
 
-static int ddr3_calc_mem_cs_size(u32 cs, uint64_t *cs_size)
+int ddr3_calc_mem_cs_size(u32 cs, uint64_t *cs_size)
 {
 	u32 cs_mem_size;
 
drivers/ddr/marvell/a38x/mv_ddr_plat.h +1 -0
index 61f10302fcca..9c5fdecd9341 100644
@@ -232,4 +232,5 @@ u32 mv_ddr_dm_pad_get(void);
 int mv_ddr_pre_training_fixup(void);
 int mv_ddr_post_training_fixup(void);
 int mv_ddr_manual_cal_do(void);
+int ddr3_calc_mem_cs_size(u32 cs, uint64_t *cs_size);
 #endif /* _MV_DDR_PLAT_H */
drivers/ddr/marvell/a38x/xor.c +3 -0
index 024cecd777c5..f859596d8953 100644
@@ -347,6 +347,9 @@ void ddr3_new_tip_ecc_scrub(void)
 	for (cs_c = 0; cs_c < max_cs; cs_c++)
 		cs_ena |= 1 << cs_c;
 
+	/* assume that all CS have same size */
+	ddr3_calc_mem_cs_size(0, &cs_mem_size);
+
 	mv_sys_xor_init(max_cs, cs_ena, cs_mem_size, 0);
 	total_mem_size = max_cs * cs_mem_size;
 	mv_xor_mem_init(0, 0, total_mem_size, 0xdeadbeef, 0xdeadbeef);
Signature · 1 line
2.17.0
#7 lore raw

v3 cover ARM: mvebu: a38x: updates to ddr training code

In reply to Chris Packham
Quoted 18 lines · Chris Packham

This series updates the ddr training code in u-boot with the latest publicly available version from Marvell which can be found at
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git
(mv_ddr-armada-17.10 branch).

I've tried to make the delta as small as possible without breaking bisect-ability.

The first 2 patches have already been sent as
http://patchwork.ozlabs.org/patch/894866/ and
http://patchwork.ozlabs.org/patch/894865/

The bulk of the changes are in patch 4. Naturally this doesn't pass checkpatch.pl but I'm erring on the side of being able to diff with the upstream source. Also due to it's size this patch may not make it to the mailing list so the full series can be retrieved from the mv-ddr branch of https://github.com/cpackham/u-boot.git.

Quoted 8 lines

I've tested this series on the db-88f6820-amc board and on a custom board that is not upstream (yet). I've also build tested the other a38x boards. More testing on actual hardware would be greatly appreciated.

This version is rebased against master to mop up the SPDX changes.

Changes in v3:
- Update to current SPDX style

Applied to u-boot-marvell/master

Thanks,
Stefan