Skip to contentSkip to conversation

ARM: mvebu: a38x: updates to ddr training code

PATCH Superseded Chris Packham 2 participants 8 messages Apr 9, 2018 – May 9, 2018

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 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.

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               |  737 ----------
 drivers/ddr/marvell/a38x/ddr3_a38x.h               |   93 --
 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h     |  226 ---
 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h      |   22 -
 drivers/ddr/marvell/a38x/ddr3_a38x_training.c      |   40 -
 drivers/ddr/marvell/a38x/ddr3_debug.c              |  742 ++++++----
 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c    |  148 --
 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h    |   49 -
 .../ddr/marvell/a38x/ddr3_hws_hw_training_def.h    |  464 ------
 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h   |   17 -
 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 +-
 drivers/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 +++++--
 .../marvell/a38x/ddr3_training_centralization.c    |  108 +-
 drivers/ddr/marvell/a38x/ddr3_training_db.c        |  267 +++-
 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c   |   98 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip.h        |   19 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h   |    6 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_db.h     |   71 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_def.h    |   34 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c | 1134 +++++++++------
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h |    9 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h   |  305 +---
 drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h |   17 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h |   31 -
 drivers/ddr/marvell/a38x/ddr3_training_leveling.c  | 1347 ++++++++++--------
 drivers/ddr/marvell/a38x/ddr3_training_leveling.h  |    2 +-
 drivers/ddr/marvell/a38x/ddr3_training_pbs.c       |  201 +--
 drivers/ddr/marvell/a38x/ddr3_training_static.c    |  539 -------
 drivers/ddr/marvell/a38x/ddr_ml_wrapper.h          |  149 ++
 drivers/ddr/marvell/a38x/ddr_topology_def.h        |   84 +-
 drivers/ddr/marvell/a38x/mv_ddr_build_message.c    |    1 +
 drivers/ddr/marvell/a38x/mv_ddr_common.c           |   48 +
 drivers/ddr/marvell/a38x/mv_ddr_common.h           |   21 +
 drivers/ddr/marvell/a38x/mv_ddr_plat.c             | 1451 +++++++++++++++++++
 drivers/ddr/marvell/a38x/mv_ddr_plat.h             |  237 ++++
 drivers/ddr/marvell/a38x/mv_ddr_regs.h             |  447 ++++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.c              |  378 +++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.h              |  290 ++++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c      |  103 ++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h      |  118 ++
 drivers/ddr/marvell/a38x/mv_ddr_topology.c         |  198 +++
 drivers/ddr/marvell/a38x/mv_ddr_topology.h         |  130 ++
 drivers/ddr/marvell/a38x/seq_exec.h                |   65 +
 drivers/ddr/marvell/a38x/silicon_if.h              |   17 -
 drivers/ddr/marvell/a38x/xor.c                     |  185 ++-
 drivers/ddr/marvell/a38x/xor.h                     |    3 +-
 60 files changed, 7998 insertions(+), 5968 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.16.2
#1 lore raw

PATCH v2 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 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 ca8a4d206a36..d6f0d4fcd381 100644
@@ -47,6 +47,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 06d0ab10aa2a..bca0af89a72d 100644
@@ -422,8 +422,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.16.2
#2 lore raw

PATCH v2 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 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 cc3e5e23c0dd..ec2d89a66b0b 100644
@@ -13,8 +13,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     */
@@ -235,3 +233,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 a413c51043ee..15626cbca7d5 100644
@@ -8,7 +8,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 55baad498ae5..032c4d54f359 100644
@@ -108,30 +108,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.16.2
#3 lore raw

PATCH v2 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 v2: New

 drivers/ddr/marvell/a38x/ddr3_a38x.c            |  51 ---
 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h  | 226 ------------
 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 ---
 drivers/ddr/marvell/a38x/ddr3_training_static.c | 438 ------------------------
 7 files changed, 795 deletions(-)
 delete mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h
drivers/ddr/marvell/a38x/ddr3_a38x.c +0 -51
index c082122f25c3..22390325003d 100644
@@ -77,41 +77,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 */
@@ -368,22 +333,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 -226

226 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_debug.c +0 -9
index a704a3e9d314..f0c8daa4b62c 100644
@@ -868,15 +868,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 032c4d54f359..4790ec1d8174 100644
@@ -60,20 +60,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) */
 
@@ -92,9 +78,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 */
@@ -343,18 +326,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 a4c75a9fa68f..cbf072cdef6f 100644
@@ -9,7 +9,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.16.2
#4 lore raw

PATCH v2 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 v2: New

 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               |  686 ---------
 drivers/ddr/marvell/a38x/ddr3_a38x.h               |   93 --
 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h      |   22 -
 drivers/ddr/marvell/a38x/ddr3_a38x_training.c      |   40 -
 drivers/ddr/marvell/a38x/ddr3_debug.c              |  733 ++++++----
 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c    |  148 --
 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h    |   49 -
 .../ddr/marvell/a38x/ddr3_hws_hw_training_def.h    |  462 -------
 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h   |   17 -
 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 +-
 drivers/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 ++++++--
 .../marvell/a38x/ddr3_training_centralization.c    |  108 +-
 drivers/ddr/marvell/a38x/ddr3_training_db.c        |  267 +++-
 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c   |   98 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip.h        |   19 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h   |    6 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_db.h     |   71 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_def.h    |   34 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c | 1134 +++++++++------
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h |    9 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h   |  305 +---
 drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h |   17 +-
 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h |   31 -
 drivers/ddr/marvell/a38x/ddr3_training_leveling.c  | 1347 ++++++++++--------
 drivers/ddr/marvell/a38x/ddr3_training_leveling.h  |    2 +-
 drivers/ddr/marvell/a38x/ddr3_training_pbs.c       |  201 +--
 drivers/ddr/marvell/a38x/ddr3_training_static.c    |  101 --
 drivers/ddr/marvell/a38x/ddr_ml_wrapper.h          |  149 ++
 drivers/ddr/marvell/a38x/ddr_topology_def.h        |   85 +-
 drivers/ddr/marvell/a38x/mv_ddr_build_message.c    |    1 +
 drivers/ddr/marvell/a38x/mv_ddr_common.c           |   48 +
 drivers/ddr/marvell/a38x/mv_ddr_common.h           |   21 +
 drivers/ddr/marvell/a38x/mv_ddr_plat.c             | 1456 ++++++++++++++++++++
 drivers/ddr/marvell/a38x/mv_ddr_plat.h             |  236 ++++
 drivers/ddr/marvell/a38x/mv_ddr_regs.h             |  447 ++++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.c              |  378 +++++
 drivers/ddr/marvell/a38x/mv_ddr_spd.h              |  290 ++++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.c      |  103 ++
 drivers/ddr/marvell/a38x/mv_ddr_sys_env_lib.h      |  118 ++
 drivers/ddr/marvell/a38x/mv_ddr_topology.c         |  198 +++
 drivers/ddr/marvell/a38x/mv_ddr_topology.h         |  124 ++
 drivers/ddr/marvell/a38x/seq_exec.h                |   65 +
 drivers/ddr/marvell/a38x/silicon_if.h              |   17 -
 drivers/ddr/marvell/a38x/xor.c                     |  184 ++-
 drivers/ddr/marvell/a38x/xor.h                     |    3 +-
 56 files changed, 7958 insertions(+), 5151 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 b03c0a3714b1..9477a802acde 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 7db0095f75ef..2a092cb80418 100644
@@ -12,7 +12,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;
@@ -56,7 +56,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},
@@ -65,17 +66,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 b95cd1d4aab5..e3b6f2d8a7e6 100644
@@ -12,7 +12,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;
@@ -77,7 +77,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},
@@ -86,17 +87,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 3d74a6dfb897..1b3b881c3996 100644
@@ -13,7 +13,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"
@@ -40,7 +40,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},
@@ -49,14 +50,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[] = {
@@ -122,7 +125,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 1472e9793e5f..75eb59ae3ee3 100644
@@ -12,7 +12,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;
@@ -70,7 +70,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},
@@ -79,17 +80,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 bf6ea4945f03..aadfb767e30d 100644
@@ -2,10 +2,9 @@
 # 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
@@ -15,5 +14,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 -686

686 lines not on this page · raw message

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

93 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_a38x_topology.h deleted +0 -22
deleted file mode 100644
index f27bbff73383..000000000000
@@ -1,22 +0,0 @@
-/*
- * 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/ddr3_a38x_training.c deleted +0 -40
deleted file mode 100644
index 52c43f75e080..000000000000
@@ -1,40 +0,0 @@
-/*
- * 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/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 -148

148 lines not on this page · raw message

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

49 lines not on this page · raw message

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

462 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h deleted +0 -17
deleted file mode 100644
index 544237a27620..000000000000
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) Marvell International Ltd. and its affiliates
- *
- * SPDX-License-Identifier:	GPL-2.0
- */
-
-#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

3 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 2de7c4fa312b..7c90ba5ea38b 100644

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

drivers/ddr/marvell/a38x/ddr3_patterns_64bit.h +1 -0
index 0ce0479a3ab6..257470113559 100644

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

drivers/ddr/marvell/a38x/ddr3_topology_def.h +4 -2
index a17eca041878..87f6c88ade16 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 ed92873697e3..a14ce63eef32 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h +5 -1
index 5c9bfe98a096..856b49839465 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 51a66d8491a2..731d1e896bd4 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 25b146216ecd..f2e651bc06d5 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 724b1062754f..5cf347750e3e 100644

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

drivers/ddr/marvell/a38x/ddr3_training_ip_static.h deleted +0 -31
deleted file mode 100644
index 878068b24d7a..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 f2b4177082c4..b6ebe731a1f7 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 -101

101 lines not on this page · raw message

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

149 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr_topology_def.h +38 -47

85 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 +48 -0

48 lines not on this page · raw message

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

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

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

1,456 lines not on this page · raw message

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

236 lines not on this page · raw message

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

447 lines not on this page · raw message

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

378 lines not on this page · raw message

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

290 lines not on this page · raw message

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

103 lines not on this page · raw message

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

118 lines not on this page · raw message

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

198 lines not on this page · raw message

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

124 lines not on this page · raw message

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

65 lines not on this page · raw message

drivers/ddr/marvell/a38x/silicon_if.h deleted +0 -17
deleted file mode 100644
index 7fce27da1238..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 7b1e3161772c..f389769409a1 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.16.2

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

#5 lore raw

PATCH v2 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 v2: New

 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 9477a802acde..3535e30e3ed9 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 2a092cb80418..aeb617172163 100644
@@ -70,7 +70,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 e3b6f2d8a7e6..073b5388080a 100644
@@ -91,7 +91,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 1b3b881c3996..0ad6825f3057 100644
@@ -54,7 +54,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 75eb59ae3ee3..901a558a90ac 100644
@@ -84,7 +84,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 0b414aba1fda..f65ff4db4ceb 100644
@@ -366,6 +366,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",
@@ -604,8 +605,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
@@ -1269,6 +1274,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,
@@ -1411,6 +1417,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 8fd0361dfbd4..b7f09fc53a75 100644
@@ -65,6 +65,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 058e262a61ad..1ab72e36189e 100644
@@ -675,11 +675,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 9fd5019ff235..3d801d4f382a 100644
@@ -37,6 +37,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.16.2
#6 lore raw

PATCH v2 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.

---
This has been reported upstream at
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/6

Changes in v2: New

 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 1ab72e36189e..5a527b67a84d 100644
@@ -996,7 +996,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 73e54c4b735c..8ea3c8b5c48d 100644
@@ -233,4 +233,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 368432165fa3..d2f90449d5ed 100644
@@ -348,6 +348,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.16.2
#7 lore raw

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

In reply to Chris Packham

Hi Chris,

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 6 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.

Changes in v2:
- remove unused #include

Many thanks for working on this. I tried to apply the patches today but failed. Most likely the license SPDX tag changes recently applied are the problem. Could you please rebase again against latest master and re-send?

Thanks,
Stefan