Skip to contentSkip to conversation

Add SPL support including DDR init for Marvell Armada 38x

PATCH New Stefan Roese 2 participants 14 messages Jul 20, 2015

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

v2 cover Add SPL support including DDR init for Marvell Armada 38x

This patch-set adds the DDR3 setup and training code taken from the Marvell U-Boot repository. This code used to be included as a binary (bin_hdr) into the A38x boot image. Not linked with the main U-Boot. With this code addition and the also included SERDES / PHY setup code, the Armada 38x support in mainline U-Boot is finally self-contained. So the complete image for booting can be built from mainline U-Boot. Without any additional external inclusion.

Tested on Marvell Armada 38x DB-88F6820-GP using onboard soldered SDRAM.

Thanks,
Stefan

Changes in v2:
- New patch "arm: mvebu: Call timer_init early before PHY and DDR init"
- New patch "arm: mvebu: a38x: Use correct PEX register access macros"
- Rebased on top of current version (v2015.07)

Stefan Roese (11):
arm: mvebu: Use default reg base address for SPL on A38x
arm: mvebu: spl.c: Add call to board_early_init_f()
arm: mvebu: Disable MMU before changing register base address
Makefile: Fix mvebu build target to use SPL load and exe-address
arm: mvebu: serdes: Move Armada XP SERDES / PHY init code into new
directory
arm: mvebu: Add Armada 38x SERDES / PHY init code from Marvell bin_hdr
arm: mvebu: drivers/ddr: Move Armada XP DDR init code into new
directory
arm: mvebu: Add Armada 38x DDR3 training code from Marvell bin_hdr
arm: mvebu: Call timer_init early before PHY and DDR init
arm: mvebu: a38x: Use correct PEX register access macros
arm: mvebu: db-88f6820: Add SPL support with DDR init code

 Makefile                                           |    2 +-
 arch/arm/mach-mvebu/Makefile                       |    4 +-
 arch/arm/mach-mvebu/cpu.c                          |   18 +
 arch/arm/mach-mvebu/include/mach/cpu.h             |    2 +-
 arch/arm/mach-mvebu/include/mach/soc.h             |   10 +
 arch/arm/mach-mvebu/serdes/a38x/Makefile           |   10 +
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c         |  347 +++
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h         |   86 +
 .../serdes/a38x/high_speed_env_spec-38x.c          |  158 ++
 .../mach-mvebu/serdes/a38x/high_speed_env_spec.c   | 2228 +++++++++++++++++
 .../mach-mvebu/serdes/a38x/high_speed_env_spec.h   |  251 ++
 .../serdes/a38x/high_speed_topology_spec-38x.c     | 1009 ++++++++
 .../serdes/a38x/high_speed_topology_spec.h         |  124 +
 arch/arm/mach-mvebu/serdes/a38x/seq_exec.c         |  170 ++
 arch/arm/mach-mvebu/serdes/a38x/seq_exec.h         |   65 +
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c      |  388 +++
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h      |  372 +++
 arch/arm/mach-mvebu/serdes/{ => axp}/Makefile      |    0
 .../mach-mvebu/serdes/{ => axp}/board_env_spec.h   |    0
 .../serdes/{ => axp}/high_speed_env_lib.c          |    0
 .../serdes/{ => axp}/high_speed_env_spec.c         |    0
 .../serdes/{ => axp}/high_speed_env_spec.h         |    2 +-
 arch/arm/mach-mvebu/spl.c                          |    9 +
 arch/arm/mach-mvebu/timer.c                        |    7 +
 board/Marvell/db-88f6820-gp/README                 |   18 +
 board/Marvell/db-88f6820-gp/db-88f6820-gp.c        |   31 +
 board/Marvell/db-88f6820-gp/kwbimage.cfg           |    2 +-
 board/maxbcm/maxbcm.c                              |    4 +-
 configs/db-88f6820-gp_defconfig                    |    1 +
 drivers/ddr/marvell/a38x/Makefile                  |   19 +
 drivers/ddr/marvell/a38x/ddr3_a38x.c               |  741 ++++++
 drivers/ddr/marvell/a38x/ddr3_a38x.h               |   98 +
 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              | 1551 ++++++++++++
 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    |  467 ++++
 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h   |   17 +
 drivers/ddr/marvell/a38x/ddr3_init.c               |  852 +++++++
 drivers/ddr/marvell/a38x/ddr3_init.h               |  395 +++
 drivers/ddr/marvell/a38x/ddr3_logging_def.h        |  101 +
 drivers/ddr/marvell/a38x/ddr3_patterns_64bit.h     |  924 +++++++
 drivers/ddr/marvell/a38x/ddr3_topology_def.h       |   76 +
 drivers/ddr/marvell/a38x/ddr3_training.c           | 2644 ++++++++++++++++++++
 drivers/ddr/marvell/a38x/ddr3_training_bist.c      |  289 +++
 .../marvell/a38x/ddr3_training_centralization.c    |  714 ++++++
 drivers/ddr/marvell/a38x/ddr3_training_db.c        |  652 +++++
 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c   |  686 +++++
 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.h   |   14 +
 drivers/ddr/marvell/a38x/ddr3_training_ip.h        |  180 ++
 drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h   |   54 +
 .../marvell/a38x/ddr3_training_ip_centralization.h |   15 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_db.h     |   34 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_def.h    |  173 ++
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c | 1354 ++++++++++
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h |   85 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h   |  349 +++
 drivers/ddr/marvell/a38x/ddr3_training_ip_pbs.h    |   41 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h |  107 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h |   31 +
 drivers/ddr/marvell/a38x/ddr3_training_leveling.c  | 1836 ++++++++++++++
 drivers/ddr/marvell/a38x/ddr3_training_leveling.h  |   17 +
 drivers/ddr/marvell/a38x/ddr3_training_pbs.c       |  995 ++++++++
 drivers/ddr/marvell/a38x/ddr3_training_static.c    |  538 ++++
 drivers/ddr/marvell/a38x/ddr_topology_def.h        |  112 +
 drivers/ddr/marvell/a38x/ddr_training_ip_db.h      |   16 +
 drivers/ddr/marvell/a38x/silicon_if.h              |   17 +
 drivers/ddr/marvell/a38x/xor.c                     |  356 +++
 drivers/ddr/marvell/a38x/xor.h                     |   92 +
 drivers/ddr/marvell/a38x/xor_regs.h                |  236 ++
 drivers/ddr/{mvebu => marvell/axp}/Makefile        |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp.h      |    0
 .../ddr/{mvebu => marvell/axp}/ddr3_axp_config.h   |    0
 .../{mvebu => marvell/axp}/ddr3_axp_mc_static.h    |    0
 .../axp}/ddr3_axp_training_static.h                |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_vars.h |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_dfs.c      |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_dqs.c      |    0
 .../ddr/{mvebu => marvell/axp}/ddr3_hw_training.c  |    0
 .../ddr/{mvebu => marvell/axp}/ddr3_hw_training.h  |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_init.c     |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_init.h     |    0
 .../{mvebu => marvell/axp}/ddr3_patterns_64bit.h   |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_pbs.c      |    0
 .../{mvebu => marvell/axp}/ddr3_read_leveling.c    |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_sdram.c    |    0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_spd.c      |    0
 .../{mvebu => marvell/axp}/ddr3_write_leveling.c   |    0
 drivers/ddr/{mvebu => marvell/axp}/xor.c           |    0
 drivers/ddr/{mvebu => marvell/axp}/xor.h           |    0
 drivers/ddr/{mvebu => marvell/axp}/xor_regs.h      |    0
 include/configs/db-88f6820-gp.h                    |   35 +
 include/configs/db-mv784mp-gp.h                    |    2 +-
 include/configs/maxbcm.h                           |    2 +-
 scripts/Makefile.spl                               |    3 +-
 97 files changed, 22713 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/Makefile
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec-38x.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec-38x.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/seq_exec.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/seq_exec.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h
 rename arch/arm/mach-mvebu/serdes/{ => axp}/Makefile (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/board_env_spec.h (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_lib.c (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_spec.c (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_spec.h (97%)
 create mode 100644 board/Marvell/db-88f6820-gp/README
 create mode 100644 drivers/ddr/marvell/a38x/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/xor.c
 create mode 100644 drivers/ddr/marvell/a38x/xor.h
 create mode 100644 drivers/ddr/marvell/a38x/xor_regs.h
 rename drivers/ddr/{mvebu => marvell/axp}/Makefile (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_config.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_mc_static.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_training_static.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_vars.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_dfs.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_dqs.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_hw_training.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_hw_training.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_init.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_init.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_patterns_64bit.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_pbs.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_read_leveling.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_sdram.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_spd.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_write_leveling.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/xor.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/xor.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/xor_regs.h (100%)
Signature · 1 line
2.4.6
#1 lore raw

PATCH v2 1/11 arm: mvebu: Use default reg base address for SPL on A38x

On A38x switching the regs base address without running from SDRAM doesn't seem to work. So let the SPL still use the default base address and switch to the new address in the mail u-boot later.

---

Changes in v2: None

 arch/arm/mach-mvebu/include/mach/soc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/mach-mvebu/include/mach/soc.h +10 -0
index 1aaea67..c295255 100644
@@ -28,7 +28,17 @@
 /* SOC specific definations */
 #define INTREG_BASE		0xd0000000
 #define INTREG_BASE_ADDR_REG	(INTREG_BASE + 0x20080)
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYS_MVEBU_DDR_A38X)
+/*
+ * On A38x switching the regs base address without running from
+ * SDRAM doesn't seem to work. So let the SPL still use the
+ * default base address and switch to the new address in the
+ * main u-boot later.
+ */
+#define SOC_REGS_PHY_BASE	0xd0000000
+#else
 #define SOC_REGS_PHY_BASE	0xf1000000
+#endif
 #define MVEBU_REGISTER(x)	(SOC_REGS_PHY_BASE + x)
 
 #define MVEBU_SDRAM_SCRATCH	(MVEBU_REGISTER(0x01504))
Signature · 1 line
2.4.6
#2 lore raw

PATCH v2 2/11 arm: mvebu: spl.c: Add call to board_early_init_f()

In reply to Stefan Roese

Pin muxing needs to be done before UART output, since on A38x the UART pins need some re-muxing for output to work.

---

Changes in v2: None

 arch/arm/mach-mvebu/spl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-mvebu/spl.c +7 -0
index 402e520..2df25aa 100644
@@ -26,6 +26,13 @@ void board_init_f(ulong dummy)
 	/* Linux expects the internal registers to be at 0xf1000000 */
 	arch_cpu_init();
 
+	/*
+	 * Pin muxing needs to be done before UART output, since
+	 * on A38x the UART pins need some re-muxing for output
+	 * to work.
+	 */
+	board_early_init_f();
+
 	preloader_console_init();
 
 	/* First init the serdes PHY's */
Signature · 1 line
2.4.6
#3 lore raw

PATCH v2 3/11 arm: mvebu: Disable MMU before changing register base address

In reply to Stefan Roese

Only with disabled MMU its possible to switch the base register address on Armada 38x. Without this the SDRAM located at >= 0x4000.0000 is also not accessible, as its still locked to cache.

---

Changes in v2: None

 arch/arm/mach-mvebu/cpu.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/mach-mvebu/cpu.c +18 -0
index 9bc9f00..9496d5f 100644
@@ -163,6 +163,14 @@ static void update_sdram_window_sizes(void)
 	}
 }
 
+void mmu_disable(void)
+{
+	asm volatile(
+		"mrc p15, 0, r0, c1, c0, 0\n"
+		"bic r0, #1\n"
+		"mcr p15, 0, r0, c1, c0, 0\n");
+}
+
 #ifdef CONFIG_ARCH_CPU_INIT
 static void set_cbar(u32 addr)
 {
@@ -172,6 +180,16 @@ static void set_cbar(u32 addr)
 
 int arch_cpu_init(void)
 {
+#ifndef CONFIG_SPL_BUILD
+	/*
+	 * Only with disabled MMU its possible to switch the base
+	 * register address on Armada 38x. Without this the SDRAM
+	 * located at >= 0x4000.0000 is also not accessible, as its
+	 * still locked to cache.
+	 */
+	mmu_disable();
+#endif
+
 	/* Linux expects the internal registers to be at 0xf1000000 */
 	writel(SOC_REGS_PHY_BASE, INTREG_BASE_ADDR_REG);
 	set_cbar(SOC_REGS_PHY_BASE + 0xC000);
Signature · 1 line
2.4.6
#4 lore raw

PATCH v2 4/11 Makefile: Fix mvebu build target to use SPL load and exe-address

In reply to Stefan Roese

The u-boot-spl.kwb build target needs the SPL text-base (CONFIG_SPL_TEXT_BASE) as load and execution address.

---

Changes in v2: None

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index a7dce06..744ae80 100644
@@ -887,7 +887,7 @@ MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 	-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
 
 MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
-	-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
+	-T kwbimage -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE)
 
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
Signature · 1 line
2.4.6
#5 lore raw

PATCH v2 5/11 arm: mvebu: serdes: Move Armada XP SERDES / PHY init code into new directory

In reply to Stefan Roese

With the upcoming addition of the Armada 38x SPL support, which is not compatible to the Armada XP SERDES init code, we need to introduce a new directory infrastructure. So lets move the AXP serdes init code into a new directory. This way the A38x code can be added in a clean way.

---

Changes in v2: None

 arch/arm/mach-mvebu/Makefile                               | 3 ++-
 arch/arm/mach-mvebu/serdes/{ => axp}/Makefile              | 0
 arch/arm/mach-mvebu/serdes/{ => axp}/board_env_spec.h      | 0
 arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_lib.c  | 0
 arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_spec.c | 0
 arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_spec.h | 0
 board/maxbcm/maxbcm.c                                      | 4 ++--
 7 files changed, 4 insertions(+), 3 deletions(-)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/Makefile (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/board_env_spec.h (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_lib.c (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_spec.c (100%)
 rename arch/arm/mach-mvebu/serdes/{ => axp}/high_speed_env_spec.h (100%)
arch/arm/mach-mvebu/Makefile +2 -1
index 4f477cd..9cdbefd 100644
@@ -20,5 +20,6 @@ obj-y	+= timer.o
 obj-$(CONFIG_SPL_BUILD) += spl.o
 obj-$(CONFIG_SPL_BUILD) += lowlevel_spl.o
 
-obj-y	+= serdes/
+obj-$(CONFIG_SYS_MVEBU_DDR_AXP)	+= serdes/axp/
+
 endif
arch/arm/mach-mvebu/serdes/axp/Makefile renamed from arch/arm/mach-mvebu/serdes/Makefile +0 -0
similarity index 100%
rename from arch/arm/mach-mvebu/serdes/Makefile
rename to arch/arm/mach-mvebu/serdes/axp/Makefile
arch/arm/mach-mvebu/serdes/axp/board_env_spec.h renamed from arch/arm/mach-mvebu/serdes/board_env_spec.h +0 -0
similarity index 100%
rename from arch/arm/mach-mvebu/serdes/board_env_spec.h
rename to arch/arm/mach-mvebu/serdes/axp/board_env_spec.h
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c renamed from arch/arm/mach-mvebu/serdes/high_speed_env_lib.c +0 -0
similarity index 100%
rename from arch/arm/mach-mvebu/serdes/high_speed_env_lib.c
rename to arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.c renamed from arch/arm/mach-mvebu/serdes/high_speed_env_spec.c +0 -0
similarity index 100%
rename from arch/arm/mach-mvebu/serdes/high_speed_env_spec.c
rename to arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.c
arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h renamed from arch/arm/mach-mvebu/serdes/high_speed_env_spec.h +0 -0
similarity index 100%
rename from arch/arm/mach-mvebu/serdes/high_speed_env_spec.h
rename to arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h
board/maxbcm/maxbcm.c +2 -2
index 2fbb90c..119ba4c 100644
@@ -11,8 +11,8 @@
 #include <asm/arch/soc.h>
 #include <linux/mbus.h>
 
-#include "../drivers/ddr/mvebu/ddr3_hw_training.h"
-#include "../arch/arm/mach-mvebu/serdes/high_speed_env_spec.h"
+#include "../drivers/ddr/marvell/axp/ddr3_hw_training.h"
+#include "../arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.4.6
#6 lore raw

PATCH v2 6/11 arm: mvebu: Add Armada 38x SERDES / PHY init code from Marvell bin_hdr

In reply to Stefan Roese

This code is ported from the Marvell bin_hdr code into mainline SPL U-Boot. It needs to be executed very early so that the devices connected to the serdes PHY are configured correctly.

---

Changes in v2: None

 arch/arm/mach-mvebu/Makefile                       |    1 +
 arch/arm/mach-mvebu/serdes/a38x/Makefile           |   10 +
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c         |  347 +++
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h         |   82 +
 .../serdes/a38x/high_speed_env_spec-38x.c          |  158 ++
 .../mach-mvebu/serdes/a38x/high_speed_env_spec.c   | 2228 ++++++++++++++++++++
 .../mach-mvebu/serdes/a38x/high_speed_env_spec.h   |  251 +++
 .../serdes/a38x/high_speed_topology_spec-38x.c     | 1009 +++++++++
 .../serdes/a38x/high_speed_topology_spec.h         |  124 ++
 arch/arm/mach-mvebu/serdes/a38x/seq_exec.c         |  170 ++
 arch/arm/mach-mvebu/serdes/a38x/seq_exec.h         |   65 +
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c      |  388 ++++
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h      |  372 ++++
 13 files changed, 5205 insertions(+)
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/Makefile
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec-38x.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec-38x.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/seq_exec.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/seq_exec.h
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c
 create mode 100644 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h
arch/arm/mach-mvebu/Makefile +1 -0
index 9cdbefd..446ce04 100644
@@ -20,6 +20,7 @@ obj-y	+= timer.o
 obj-$(CONFIG_SPL_BUILD) += spl.o
 obj-$(CONFIG_SPL_BUILD) += lowlevel_spl.o
 
+obj-$(CONFIG_SYS_MVEBU_DDR_A38X) += serdes/a38x/
 obj-$(CONFIG_SYS_MVEBU_DDR_AXP)	+= serdes/axp/
 
 endif
arch/arm/mach-mvebu/serdes/a38x/Makefile new file +10 -0
new file mode 100644
index 0000000..1503da8
@@ -0,0 +1,10 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-$(CONFIG_SPL_BUILD)	= ctrl_pex.o
+obj-$(CONFIG_SPL_BUILD)	+= high_speed_env_spec.o
+obj-$(CONFIG_SPL_BUILD)	+= high_speed_env_spec-38x.o
+obj-$(CONFIG_SPL_BUILD)	+= high_speed_topology_spec-38x.o
+obj-$(CONFIG_SPL_BUILD)	+= seq_exec.o
+obj-$(CONFIG_SPL_BUILD)	+= sys_env_lib.o
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c new file +347 -0

347 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h new file +82 -0

82 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec-38x.c new file +158 -0

158 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c new file +2228 -0

2,228 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h new file +251 -0

168 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec-38x.c new file +1009 -0

1,009 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec.h new file +124 -0

124 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/seq_exec.c new file +170 -0

170 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/seq_exec.h new file +65 -0

65 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c new file +388 -0

388 lines not on this page · raw message

arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h new file +372 -0

372 lines not on this page · raw message

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

Signature · 1 line
2.4.6

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

#7 lore raw

PATCH v2 6/11 arm: mvebu: Add Armada 38x SERDES / PHY init code from Marvell bin_hdr

Hi Stefan,

Quoted 6 lines · Stefan Roese

This code is ported from the Marvell bin_hdr code into mainline SPL U-Boot. It needs to be executed very early so that the devices connected to the serdes PHY are configured correctly.

---

...

arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h line 372

Quoted 2 lines
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h new file +2 -0
+#endif /* _SYS_ENV_LIB_H */
+

Please drop this extra newline, git am complains on it.

Luka

#8 lore raw

PATCH v2 7/11 arm: mvebu: drivers/ddr: Move Armada XP DDR init code into new directory

In reply to Stefan Roese

With the upcoming addition of the Armada 38x DDR support, which is not compatible to the Armada XP DDR init code, we need to introduce a new directory infrastructure. To support multiple Marvell DDR controller.

This will be the new structure:

drivers/ddr/marvell/axp
Supporting Armada XP (AXP) devices (and perhaps Armada 370)

drivers/ddr/marvell/a38x
Supporting Armada 38x devices (and perhaps Armada 39x)

---

Changes in v2: None

 arch/arm/mach-mvebu/include/mach/cpu.h                        | 2 +-
 arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h          | 2 +-
 drivers/ddr/{mvebu => marvell/axp}/Makefile                   | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp.h                 | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_config.h          | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_mc_static.h       | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_training_static.h | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_vars.h            | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_dfs.c                 | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_dqs.c                 | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_hw_training.c         | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_hw_training.h         | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_init.c                | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_init.h                | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_patterns_64bit.h      | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_pbs.c                 | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_read_leveling.c       | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_sdram.c               | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_spd.c                 | 0
 drivers/ddr/{mvebu => marvell/axp}/ddr3_write_leveling.c      | 0
 drivers/ddr/{mvebu => marvell/axp}/xor.c                      | 0
 drivers/ddr/{mvebu => marvell/axp}/xor.h                      | 0
 drivers/ddr/{mvebu => marvell/axp}/xor_regs.h                 | 0
 include/configs/db-mv784mp-gp.h                               | 2 +-
 include/configs/maxbcm.h                                      | 2 +-
 scripts/Makefile.spl                                          | 2 +-
 26 files changed, 5 insertions(+), 5 deletions(-)
 rename drivers/ddr/{mvebu => marvell/axp}/Makefile (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_config.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_mc_static.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_training_static.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_axp_vars.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_dfs.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_dqs.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_hw_training.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_hw_training.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_init.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_init.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_patterns_64bit.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_pbs.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_read_leveling.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_sdram.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_spd.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/ddr3_write_leveling.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/xor.c (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/xor.h (100%)
 rename drivers/ddr/{mvebu => marvell/axp}/xor_regs.h (100%)
arch/arm/mach-mvebu/include/mach/cpu.h +1 -1
index 4bdb633..8bcdef6 100644
@@ -125,7 +125,7 @@ int serdes_phy_config(void);
 /*
  * DDR3 init / training code ported from Marvell bin_hdr. Now
  * available in mainline U-Boot in:
- * drivers/ddr/mvebu/
+ * drivers/ddr/marvell
  */
 int ddr3_init(void);
 #endif /* __ASSEMBLY__ */
arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h +1 -1
index e5aa1b0..e10574e 100644
@@ -7,7 +7,7 @@
 #ifndef __HIGHSPEED_ENV_SPEC_H
 #define __HIGHSPEED_ENV_SPEC_H
 
-#include "../../../drivers/ddr/mvebu/ddr3_hw_training.h"
+#include "../../../drivers/ddr/marvell/axp/ddr3_hw_training.h"
 
 typedef enum {
 	SERDES_UNIT_UNCONNECTED	= 0x0,
drivers/ddr/marvell/axp/Makefile renamed from drivers/ddr/mvebu/Makefile +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/Makefile
rename to drivers/ddr/marvell/axp/Makefile
drivers/ddr/marvell/axp/ddr3_axp.h renamed from drivers/ddr/mvebu/ddr3_axp.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_axp.h
rename to drivers/ddr/marvell/axp/ddr3_axp.h
drivers/ddr/marvell/axp/ddr3_axp_config.h renamed from drivers/ddr/mvebu/ddr3_axp_config.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_axp_config.h
rename to drivers/ddr/marvell/axp/ddr3_axp_config.h
drivers/ddr/marvell/axp/ddr3_axp_mc_static.h renamed from drivers/ddr/mvebu/ddr3_axp_mc_static.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_axp_mc_static.h
rename to drivers/ddr/marvell/axp/ddr3_axp_mc_static.h
drivers/ddr/marvell/axp/ddr3_axp_training_static.h renamed from drivers/ddr/mvebu/ddr3_axp_training_static.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_axp_training_static.h
rename to drivers/ddr/marvell/axp/ddr3_axp_training_static.h
drivers/ddr/marvell/axp/ddr3_axp_vars.h renamed from drivers/ddr/mvebu/ddr3_axp_vars.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_axp_vars.h
rename to drivers/ddr/marvell/axp/ddr3_axp_vars.h
drivers/ddr/marvell/axp/ddr3_dfs.c renamed from drivers/ddr/mvebu/ddr3_dfs.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_dfs.c
rename to drivers/ddr/marvell/axp/ddr3_dfs.c
drivers/ddr/marvell/axp/ddr3_dqs.c renamed from drivers/ddr/mvebu/ddr3_dqs.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_dqs.c
rename to drivers/ddr/marvell/axp/ddr3_dqs.c
drivers/ddr/marvell/axp/ddr3_hw_training.c renamed from drivers/ddr/mvebu/ddr3_hw_training.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_hw_training.c
rename to drivers/ddr/marvell/axp/ddr3_hw_training.c
drivers/ddr/marvell/axp/ddr3_hw_training.h renamed from drivers/ddr/mvebu/ddr3_hw_training.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_hw_training.h
rename to drivers/ddr/marvell/axp/ddr3_hw_training.h
drivers/ddr/marvell/axp/ddr3_init.c renamed from drivers/ddr/mvebu/ddr3_init.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_init.c
rename to drivers/ddr/marvell/axp/ddr3_init.c
drivers/ddr/marvell/axp/ddr3_init.h renamed from drivers/ddr/mvebu/ddr3_init.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_init.h
rename to drivers/ddr/marvell/axp/ddr3_init.h
drivers/ddr/marvell/axp/ddr3_patterns_64bit.h renamed from drivers/ddr/mvebu/ddr3_patterns_64bit.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_patterns_64bit.h
rename to drivers/ddr/marvell/axp/ddr3_patterns_64bit.h
drivers/ddr/marvell/axp/ddr3_pbs.c renamed from drivers/ddr/mvebu/ddr3_pbs.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_pbs.c
rename to drivers/ddr/marvell/axp/ddr3_pbs.c
drivers/ddr/marvell/axp/ddr3_read_leveling.c renamed from drivers/ddr/mvebu/ddr3_read_leveling.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_read_leveling.c
rename to drivers/ddr/marvell/axp/ddr3_read_leveling.c
drivers/ddr/marvell/axp/ddr3_sdram.c renamed from drivers/ddr/mvebu/ddr3_sdram.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_sdram.c
rename to drivers/ddr/marvell/axp/ddr3_sdram.c
drivers/ddr/marvell/axp/ddr3_spd.c renamed from drivers/ddr/mvebu/ddr3_spd.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_spd.c
rename to drivers/ddr/marvell/axp/ddr3_spd.c
drivers/ddr/marvell/axp/ddr3_write_leveling.c renamed from drivers/ddr/mvebu/ddr3_write_leveling.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/ddr3_write_leveling.c
rename to drivers/ddr/marvell/axp/ddr3_write_leveling.c
drivers/ddr/marvell/axp/xor.c renamed from drivers/ddr/mvebu/xor.c +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/xor.c
rename to drivers/ddr/marvell/axp/xor.c
drivers/ddr/marvell/axp/xor.h renamed from drivers/ddr/mvebu/xor.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/xor.h
rename to drivers/ddr/marvell/axp/xor.h
drivers/ddr/marvell/axp/xor_regs.h renamed from drivers/ddr/mvebu/xor_regs.h +0 -0
similarity index 100%
rename from drivers/ddr/mvebu/xor_regs.h
rename to drivers/ddr/marvell/axp/xor_regs.h
include/configs/db-mv784mp-gp.h +1 -1
index c33a588..ace915c 100644
@@ -109,7 +109,7 @@
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 
 /* Enable DDR support in SPL (DDR3 training from Marvell bin_hdr) */
-#define CONFIG_SYS_MVEBU_DDR
+#define CONFIG_SYS_MVEBU_DDR_AXP
 #define CONFIG_SPD_EEPROM		0x4e
 
 #endif /* _CONFIG_DB_MV7846MP_GP_H */
include/configs/maxbcm.h +1 -1
index 4826044..0fb117f 100644
@@ -108,7 +108,7 @@
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 
 /* Enable DDR support in SPL (DDR3 training from Marvell bin_hdr) */
-#define CONFIG_SYS_MVEBU_DDR
+#define CONFIG_SYS_MVEBU_DDR_AXP
 #define CONFIG_DDR_FIXED_SIZE		(1 << 20)	/* 1GiB */
 
 #endif /* _CONFIG_DB_MV7846MP_GP_H */
scripts/Makefile.spl +1 -1
index fd572f4..3c9a9a0 100644
@@ -59,7 +59,7 @@ libs-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/
 libs-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/
 libs-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/
 libs-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += drivers/ddr/fsl/
-libs-$(CONFIG_SYS_MVEBU_DDR) += drivers/ddr/mvebu/
+libs-$(CONFIG_SYS_MVEBU_DDR_AXP) += drivers/ddr/marvell/axp/
 libs-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/
 libs-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/
 libs-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/
Signature · 1 line
2.4.6
#9 lore raw

PATCH v2 8/11 arm: mvebu: Add Armada 38x DDR3 training code from Marvell bin_hdr

In reply to Stefan Roese

This patch adds the DDR3 setup and training code taken from the Marvell U-Boot repository. This code used to be included as a binary (bin_hdr) into the Armada A38x boot image. Not linked with the main U-Boot. With this code addition and the serdes/PHY setup code, the Armada A38x support in mainline U-Boot is finally self-contained. So the complete image for booting can be built from mainline U-Boot. Without any additional external inclusion.

Note:
This code has undergone many hours (days!) of coding-style cleanup and refactoring. It still is not checkpatch clean though, I'm afraid. As the factoring of the code has so many levels of indentation that many lines are longer than 80 chars.

---

Changes in v2: None

 drivers/ddr/marvell/a38x/Makefile                  |   19 +
 drivers/ddr/marvell/a38x/ddr3_a38x.c               |  741 ++++++
 drivers/ddr/marvell/a38x/ddr3_a38x.h               |   98 +
 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              | 1551 ++++++++++++
 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    |  472 ++++
 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h   |   17 +
 drivers/ddr/marvell/a38x/ddr3_init.c               |  852 +++++++
 drivers/ddr/marvell/a38x/ddr3_init.h               |  395 +++
 drivers/ddr/marvell/a38x/ddr3_logging_def.h        |  101 +
 drivers/ddr/marvell/a38x/ddr3_patterns_64bit.h     |  924 +++++++
 drivers/ddr/marvell/a38x/ddr3_topology_def.h       |   76 +
 drivers/ddr/marvell/a38x/ddr3_training.c           | 2644 ++++++++++++++++++++
 drivers/ddr/marvell/a38x/ddr3_training_bist.c      |  289 +++
 .../marvell/a38x/ddr3_training_centralization.c    |  714 ++++++
 drivers/ddr/marvell/a38x/ddr3_training_db.c        |  652 +++++
 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c   |  686 +++++
 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.h   |   14 +
 drivers/ddr/marvell/a38x/ddr3_training_ip.h        |  180 ++
 drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h   |   54 +
 .../marvell/a38x/ddr3_training_ip_centralization.h |   15 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_db.h     |   34 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_def.h    |  173 ++
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c | 1354 ++++++++++
 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h |   85 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h   |  349 +++
 drivers/ddr/marvell/a38x/ddr3_training_ip_pbs.h    |   41 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h |  107 +
 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h |   31 +
 drivers/ddr/marvell/a38x/ddr3_training_leveling.c  | 1836 ++++++++++++++
 drivers/ddr/marvell/a38x/ddr3_training_leveling.h  |   17 +
 drivers/ddr/marvell/a38x/ddr3_training_pbs.c       |  995 ++++++++
 drivers/ddr/marvell/a38x/ddr3_training_static.c    |  538 ++++
 drivers/ddr/marvell/a38x/ddr_topology_def.h        |  112 +
 drivers/ddr/marvell/a38x/ddr_training_ip_db.h      |   16 +
 drivers/ddr/marvell/a38x/silicon_if.h              |   17 +
 drivers/ddr/marvell/a38x/xor.c                     |  356 +++
 drivers/ddr/marvell/a38x/xor.h                     |   92 +
 drivers/ddr/marvell/a38x/xor_regs.h                |  236 ++
 scripts/Makefile.spl                               |    1 +
 44 files changed, 17369 insertions(+)
 create mode 100644 drivers/ddr/marvell/a38x/Makefile
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_mc_static.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_topology.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_a38x_training.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_debug.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_init.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_init.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_logging_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_patterns_64bit.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_bist.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_centralization.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_db.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_hw_algo.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_bist.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_centralization.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_engine.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_flow.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_pbs.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_prv_if.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_ip_static.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_leveling.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_leveling.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_pbs.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr3_training_static.c
 create mode 100644 drivers/ddr/marvell/a38x/ddr_topology_def.h
 create mode 100644 drivers/ddr/marvell/a38x/ddr_training_ip_db.h
 create mode 100644 drivers/ddr/marvell/a38x/silicon_if.h
 create mode 100644 drivers/ddr/marvell/a38x/xor.c
 create mode 100644 drivers/ddr/marvell/a38x/xor.h
 create mode 100644 drivers/ddr/marvell/a38x/xor_regs.h
drivers/ddr/marvell/a38x/Makefile new file +19 -0
new file mode 100644
index 0000000..bf6ea49
@@ -0,0 +1,19 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-$(CONFIG_SPL_BUILD) += ddr3_a38x.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_a38x_training.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_debug.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_hws_hw_training.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_init.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_bist.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_centralization.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_db.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_hw_algo.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_ip_engine.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_leveling.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_pbs.o
+obj-$(CONFIG_SPL_BUILD) += ddr3_training_static.o
+obj-$(CONFIG_SPL_BUILD) += xor.o
drivers/ddr/marvell/a38x/ddr3_a38x.c new file +741 -0

741 lines not on this page · raw message

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

98 lines not on this page · raw message

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

226 lines not on this page · raw message

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

1,551 lines not on this page · raw message

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

148 lines not on this page · raw message

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

49 lines not on this page · raw message

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

106 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_hws_sil_training.h new file +17 -0
new file mode 100644
index 0000000..544237a

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

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

852 lines not on this page · raw message

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

395 lines not on this page · raw message

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

101 lines not on this page · raw message

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

924 lines not on this page · raw message

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

76 lines not on this page · raw message

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

2,644 lines not on this page · raw message

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

289 lines not on this page · raw message

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

714 lines not on this page · raw message

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

652 lines not on this page · raw message

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

686 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_hw_algo.h new file +14 -0
new file mode 100644
index 0000000..6e1bab2

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

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

180 lines not on this page · raw message

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

54 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_ip_centralization.h new file +15 -0
new file mode 100644
index 0000000..7c57603

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

drivers/ddr/marvell/a38x/ddr3_training_ip_db.h new file +34 -0
new file mode 100644
index 0000000..c0afa77

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

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

173 lines not on this page · raw message

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

1,354 lines not on this page · raw message

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

85 lines not on this page · raw message

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

349 lines not on this page · raw message

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

41 lines not on this page · raw message

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

107 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_ip_static.h new file +31 -0
new file mode 100644
index 0000000..878068b

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

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

1,836 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr3_training_leveling.h new file +17 -0
new file mode 100644
index 0000000..f2b4177

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

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

995 lines not on this page · raw message

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

538 lines not on this page · raw message

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

112 lines not on this page · raw message

drivers/ddr/marvell/a38x/ddr_training_ip_db.h new file +16 -0
new file mode 100644
index 0000000..ff5f817

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

drivers/ddr/marvell/a38x/silicon_if.h new file +17 -0
new file mode 100644
index 0000000..7fce27d

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

drivers/ddr/marvell/a38x/xor.c new file +356 -0

356 lines not on this page · raw message

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

92 lines not on this page · raw message

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

236 lines not on this page · raw message

scripts/Makefile.spl +1 -0
index 3c9a9a0..481ee5e 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.4.6

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

#10 lore raw

PATCH v2 9/11 arm: mvebu: Call timer_init early before PHY and DDR init

In reply to Stefan Roese

Without calling timer_init(), the xdelay() functions return immediately. We need to call timer_init() early, so that these functions work and the PHY and DDR init code works correctly.

---

Changes in v2:
- New patch "arm: mvebu: Call timer_init early before PHY and DDR init"

 arch/arm/mach-mvebu/spl.c   | 2 ++
 arch/arm/mach-mvebu/timer.c | 7 +++++++
 2 files changed, 9 insertions(+)
arch/arm/mach-mvebu/spl.c +2 -0
index 2df25aa..e65f6ca 100644
@@ -35,6 +35,8 @@ void board_init_f(ulong dummy)
 
 	preloader_console_init();
 
+	timer_init();
+
 	/* First init the serdes PHY's */
 	serdes_phy_config();
 
arch/arm/mach-mvebu/timer.c +7 -0
index 40c4bc2..c516c41 100644
@@ -41,6 +41,8 @@
 #define timestamp			gd->arch.tbl
 #define lastdec				gd->arch.lastinc
 
+static int init_done;
+
 /* Timer reload and current value registers */
 struct kwtmr_val {
 	u32 reload;	/* Timer reload reg */
@@ -112,6 +114,11 @@ void __udelay(unsigned long usec)
  */
 int timer_init(void)
 {
+	/* Only init the timer once */
+	if (init_done)
+		return 0;
+	init_done = 1;
+
 	/* load value into timer */
 	writel(TIMER_LOAD_VAL, CNTMR_RELOAD_REG(UBOOT_CNTR));
 	writel(TIMER_LOAD_VAL, CNTMR_VAL_REG(UBOOT_CNTR));
Signature · 1 line
2.4.6
#11 lore raw

PATCH v2 9/11 arm: mvebu: Call timer_init early before PHY and DDR init

Hi Stefan,

Quoted 10 lines · Stefan Roese

Without calling timer_init(), the xdelay() functions return immediately. We need to call timer_init() early, so that these functions work and the PHY and DDR init code works correctly.

---

Changes in v2:
- New patch "arm: mvebu: Call timer_init early before PHY and DDR init"

This seems to be already merged in marvell/master. Can you please rebase on top of that branch?

That said, the patch 2 in this series fails to apply.

Luka

#12 lore raw

PATCH v2 10/11 arm: mvebu: a38x: Use correct PEX register access macros

In reply to Stefan Roese

Remove the incorrect PEX macros from the DDR header. And insert the correct ones in ctrl_pex.h instead.

---

Changes in v2:
- New patch "arm: mvebu: a38x: Use correct PEX register access macros"

 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h          | 4 ++++
 drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h +4 -0
index 5032759..df395bf 100644
@@ -19,6 +19,10 @@
 #define MV_MISC_REGS_BASE		MISC_REGS_OFFSET
 #define SOC_CTRL_REG			(MV_MISC_REGS_BASE + 0x4)
 
+#define PEX_IF_REGS_OFFSET(if)		((if) > 0 ?			\
+					 (0x40000 + ((if) - 1) * 0x4000) : \
+					 0x80000)
+#define PEX_IF_REGS_BASE(if)		(PEX_IF_REGS_OFFSET(if))
 #define PEX_CAPABILITIES_REG(if)	((PEX_IF_REGS_BASE(if)) + 0x60)
 #define PEX_LINK_CTRL_STATUS2_REG(if)	((PEX_IF_REGS_BASE(if)) + 0x90)
 #define PEX_CTRL_REG(if)		((PEX_IF_REGS_BASE(if)) + 0x1a00)
drivers/ddr/marvell/a38x/ddr3_hws_hw_training_def.h +0 -5
index 02d8c61..7500a72 100644
@@ -421,11 +421,6 @@
 #define PCCRIR_REVID_MASK			(0xff << PCCRIR_REVID_OFFS)
 
 /* Power Management Clock Gating Control Register */
-#define MV_PEX_IF_REGS_OFFSET(pex_if)				\
-	(pex_if < 8 ? (0x40000 + ((pex_if) / 4) * 0x40000 +	\
-		       ((pex_if) % 4) * 0x4000) :		\
-	 (0x42000 + ((pex_if) % 8) * 0x40000))
-#define PEX_IF_REGS_BASE(unit)			(MV_PEX_IF_REGS_OFFSET(unit))
 #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))
Signature · 1 line
2.4.6
#13 lore raw

PATCH v2 11/11 arm: mvebu: db-88f6820: Add SPL support with DDR init code

In reply to Stefan Roese

This patch adds SPL support for the Marvell DB-88F6820-GP board. With this change, the bin_hdr from the original Marvell U-boot is not needed any more on this board. The sources from bin_hdr (SERDES/PHY and DDR setup) are now integrated in mainline U-Boot. And this patch enables them for this board.

---

Changes in v2:
- Rebased on top of current version (v2015.07)

 board/Marvell/db-88f6820-gp/README          | 18 +++++++++++++++
 board/Marvell/db-88f6820-gp/db-88f6820-gp.c | 31 +++++++++++++++++++++++++
 board/Marvell/db-88f6820-gp/kwbimage.cfg    |  2 +-
 configs/db-88f6820-gp_defconfig             |  1 +
 include/configs/db-88f6820-gp.h             | 35 +++++++++++++++++++++++++++++
 5 files changed, 86 insertions(+), 1 deletion(-)
 create mode 100644 board/Marvell/db-88f6820-gp/README
board/Marvell/db-88f6820-gp/README new file +18 -0
new file mode 100644
index 0000000..9bea5b3
@@ -0,0 +1,18 @@
+Update from original Marvell U-Boot to mainline U-Boot:
+-------------------------------------------------------
+
+The resulting image including the SPL binary with the
+full DDR setup is "u-boot-spl.kwb".
+
+To update the SPI NOR flash, please use the following
+command:
+
+=> sf probe;tftpboot 2000000 db-88f6820-gp/u-boot-spl.kwb;\
+sf update 2000000 0 60000
+
+Note that the original Marvell U-Boot seems to have
+problems with the "sf update" command. This does not
+work reliable. So here this command should be used:
+
+=> sf probe;tftpboot 2000000 db-88f6820-gp/u-boot-spl.kwb;\
+sf erase 0 60000;sf write 2000000 0 60000
board/Marvell/db-88f6820-gp/db-88f6820-gp.c +31 -0
index 51ac495..e661fa1 100644
@@ -11,6 +11,8 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 
+#include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #define BIT(nr)				(1UL << (nr))
@@ -54,6 +56,35 @@ static struct marvell_io_exp io_exp[] = {
 	{ 0x21, 3, 0xC0 }  /* Output Data, register#1 */
 };
 
+/*
+ * Define the DDR layout / topology here in the board file. This will
+ * 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 = {
+	0x1, /* active interfaces */
+	/* cs_mask, mirror, dqs_swap, ck_swap X PUPs */
+	{ { { {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0},
+	      {0x1, 0, 0, 0} },
+	    SPEED_BIN_DDR_1866L,	/* speed_bin */
+	    BUS_WIDTH_8,		/* memory_width */
+	    MEM_4G,			/* mem_size */
+	    DDR_FREQ_800,		/* frequency */
+	    0, 0,			/* cas_l cas_wl */
+	    HWS_TEMP_LOW} },		/* temperature */
+	5,				/* Num Of Bus Per Interface*/
+	BUS_MASK_32BIT			/* Busses mask */
+};
+
+struct hws_topology_map *ddr3_get_topology_map(void)
+{
+	/* Return the board topology as defined in the board code */
+	return &board_topology_map;
+}
+
 int board_early_init_f(void)
 {
 	/* Configure MPP */
board/Marvell/db-88f6820-gp/kwbimage.cfg +1 -1
index e812454..cc05792 100644
@@ -9,4 +9,4 @@ VERSION		1
 BOOT_FROM	spi
 
 # Binary Header (bin_hdr) with DDR3 training code
-BINARY board/Marvell/db-88f6820-gp/binary.0 0000005b 00000068
+BINARY spl/u-boot-spl.bin 0000005b 00000068
configs/db-88f6820-gp_defconfig +1 -0
index 569ddfd..0ff6706 100644
@@ -1,3 +1,4 @@
+CONFIG_SPL=y
 CONFIG_ARM=y
 CONFIG_TARGET_DB_88F6820_GP=y
 # CONFIG_CMD_IMLS is not set
include/configs/db-88f6820-gp.h +35 -0
index a429107..73b3236 100644
@@ -11,6 +11,7 @@
  * High Level Configuration Options (easy to change)
  */
 #define CONFIG_ARMADA_XP		/* SOC Family Name */
+#define CONFIG_ARMADA_38X
 #define CONFIG_DB_88F6820_GP		/* Board target name for DDR training */
 
 #define CONFIG_SYS_L2_PL310
@@ -108,6 +109,40 @@
 	"fdt_high=0x10000000\0"		\
 	"initrd_high=0x10000000\0"
 
+/* SPL */
+/* Defines for SPL */
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_SIZE			(140 << 10)
+#define CONFIG_SPL_TEXT_BASE		0x40000030
+#define CONFIG_SPL_MAX_SIZE		(CONFIG_SPL_SIZE - 0x0030)
+
+#define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
+#define CONFIG_SPL_BSS_MAX_SIZE		(16 << 10)
+
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SPL_BSS_START_ADDR + \
+					 CONFIG_SPL_BSS_MAX_SIZE)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	(16 << 10)
+
+#define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
+#define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
+
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+
+/* SPL related SPI defines */
+#define CONFIG_SPL_SPI_SUPPORT
+#define CONFIG_SPL_SPI_FLASH_SUPPORT
+#define CONFIG_SPL_SPI_LOAD
+#define CONFIG_SPL_SPI_BUS		0
+#define CONFIG_SPL_SPI_CS		0
+#define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
+
+/* Enable DDR support in SPL (DDR3 training from Marvell bin_hdr) */
+#define CONFIG_SYS_MVEBU_DDR_A38X
+#define CONFIG_DDR3
+
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
Signature · 1 line
2.4.6