Skip to contentSkip to conversation

Add SPL support including DDR init for Marvell Armada 38x

PATCH Superseded Stefan Roese 1 participant 13 messages Jun 3, 2015

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

Kevin Smith (1):
tools/kwbimage.c: Correct header size for SPI boot

Stefan Roese (11):
tools/kwboot: Add parameters to set delay and timeout via cmdline
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
arm: mvebu: Disable L2 cache before enabling d-cache
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: db-88f6820: Add SPL support with DDR init code

 Makefile                                           |    2 +-
 arch/arm/mach-mvebu/Makefile                       |    4 +-
 arch/arm/mach-mvebu/cpu.c                          |   26 +
 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         |   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 +++
 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                          |    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                              |    2 +-
 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    |  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 ++
 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 +-
 tools/kwbimage.c                                   |   22 +-
 tools/kwboot.c                                     |   14 +-
 98 files changed, 22736 insertions(+), 21 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.2
#1 lore raw

PATCH 1/12 tools/kwbimage.c: Correct header size for SPI boot

From: Kevin Smith <[email protected]>

If defined, the macro CONFIG_SYS_SPI_U_BOOT_OFFS allows a board to specify the offset of the payload image into the kwb image file. This value was being used to locate the image, but was not used in the "header size" field of the main header. Move the use of this macro into the function that returns the header size so that the same value is used in all places.

---

 tools/kwbimage.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
tools/kwbimage.c +12 -10
index 9540e7e..1ff17ca 100644
@@ -420,6 +420,18 @@ static size_t image_headersz_v1(struct image_tool_params *params,
 			*hasext = 1;
 	}
 
+#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS)
+	if (headersz > CONFIG_SYS_SPI_U_BOOT_OFFS) {
+		fprintf(stderr, "Error: Image header (incl. SPL image) too big!\n");
+		fprintf(stderr, "header=0x%x CONFIG_SYS_SPI_U_BOOT_OFFS=0x%x!\n",
+			(int)headersz, CONFIG_SYS_SPI_U_BOOT_OFFS);
+		fprintf(stderr, "Increase CONFIG_SYS_SPI_U_BOOT_OFFS!\n");
+		return 0;
+	} else {
+		headersz = CONFIG_SYS_SPI_U_BOOT_OFFS;
+	}
+#endif
+
 	/*
 	 * The payload should be aligned on some reasonable
 	 * boundary
@@ -869,16 +881,6 @@ static int kwbimage_generate(struct image_tool_params *params,
 			sizeof(struct ext_hdr_v0);
 	} else {
 		alloc_len = image_headersz_v1(params, NULL);
-#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS)
-		if (alloc_len > CONFIG_SYS_SPI_U_BOOT_OFFS) {
-			fprintf(stderr, "Error: Image header (incl. SPL image) too big!\n");
-			fprintf(stderr, "header=0x%x CONFIG_SYS_SPI_U_BOOT_OFFS=0x%x!\n",
-				alloc_len, CONFIG_SYS_SPI_U_BOOT_OFFS);
-			fprintf(stderr, "Increase CONFIG_SYS_SPI_U_BOOT_OFFS!\n");
-		} else {
-			alloc_len = CONFIG_SYS_SPI_U_BOOT_OFFS;
-		}
-#endif
 	}
 
 	hdr = malloc(alloc_len);
Signature · 1 line
2.4.2
#2 lore raw

PATCH 2/12 tools/kwboot: Add parameters to set delay and timeout via cmdline

In reply to Stefan Roese

To support the Armada 38x, new values for the request-delay and the response-timeout are needed. As the values already implemented in this tool (for Kirkwood and Armada XP) don't seem to work here. To make this more flexible, lets add make those 2 parameters configurable via the cmdline. Here the new parameters:

-q <req-delay>: use specific request-delay
-s <resp-timeo>: use specific response-timeout

For the Marvell DB-88F6820 these values are known to work:

One board:
-q 2 -s 1

2nd board:
-q 5 -s 5

So this seems to be even board specific. But with this patch now those values can be specified and tested via the cmdline.

Cc Kevin Smith <[email protected]>
Cc Dirk Eibach <[email protected]>
Cc Luka Perkov <[email protected]>

---

 tools/kwboot.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tools/kwboot.c +12 -2
index 1368b4c..af7a6ee 100644
@@ -657,7 +657,7 @@ static void
 kwboot_usage(FILE *stream, char *progname)
 {
 	fprintf(stream,
-		"Usage: %s [-d | -a | -b <image> | -D <image> ] [ -t ] [-B <baud> ] <TTY>\n",
+		"Usage: %s [-d | -a | -q <req-delay> | -s <resp-timeo> | -b <image> | -D <image> ] [ -t ] [-B <baud> ] <TTY>\n",
 		progname);
 	fprintf(stream, "\n");
 	fprintf(stream,
@@ -667,6 +667,8 @@ kwboot_usage(FILE *stream, char *progname)
 		"  -D <image>: boot <image> without preamble (Dove)\n");
 	fprintf(stream, "  -d: enter debug mode\n");
 	fprintf(stream, "  -a: use timings for Armada XP\n");
+	fprintf(stream, "  -q <req-delay>:  use specific request-delay\n");
+	fprintf(stream, "  -s <resp-timeo>: use specific response-timeout\n");
 	fprintf(stream, "\n");
 	fprintf(stream, "  -t: mini terminal\n");
 	fprintf(stream, "\n");
@@ -699,7 +701,7 @@ main(int argc, char **argv)
 	kwboot_verbose = isatty(STDOUT_FILENO);
 
 	do {
-		int c = getopt(argc, argv, "hb:ptaB:dD:");
+		int c = getopt(argc, argv, "hb:ptaB:dD:q:s:");
 		if (c < 0)
 			break;
 
@@ -731,6 +733,14 @@ main(int argc, char **argv)
 			msg_rsp_timeo = KWBOOT_MSG_RSP_TIMEO_AXP;
 			break;
 
+		case 'q':
+			msg_req_delay = atoi(optarg);
+			break;
+
+		case 's':
+			msg_rsp_timeo = atoi(optarg);
+			break;
+
 		case 'B':
 			speed = kwboot_tty_speed(atoi(optarg));
 			if (speed == -1)
Signature · 1 line
2.4.2
#3 lore raw

PATCH 3/12 arm: mvebu: Use default reg base address for SPL on A38x

In reply to Stefan Roese

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.

---

 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 0a9307c..d07e462 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.2
#4 lore raw

PATCH 4/12 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.

---

 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.2
#5 lore raw

PATCH 5/12 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.

---

 arch/arm/mach-mvebu/cpu.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/mach-mvebu/cpu.c +18 -0
index 04681fc..b687422 100644
@@ -159,9 +159,27 @@ 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
 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);
 
Signature · 1 line
2.4.2
#6 lore raw

PATCH 6/12 arm: mvebu: Disable L2 cache before enabling d-cache

In reply to Stefan Roese

L2 cache may still be enabled by the BootROM. We need to first disable it before enabling d-cache support.

---

 arch/arm/mach-mvebu/cpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-mvebu/cpu.c +8 -0
index b687422..767336c 100644
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include <asm/pl310.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 
@@ -258,6 +259,13 @@ int cpu_eth_init(bd_t *bis)
 #ifndef CONFIG_SYS_DCACHE_OFF
 void enable_caches(void)
 {
+	struct pl310_regs *const pl310 =
+		(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
+
+	/* First disable L2 cache - may still be enable from BootROM */
+	if (mvebu_soc_family() == MVEBU_SOC_A38X)
+		clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
+
 	/* Avoid problem with e.g. neta ethernet driver */
 	invalidate_dcache_all();
 
Signature · 1 line
2.4.2
#7 lore raw

PATCH 7/12 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.

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 14f782e..13ff552 100644
@@ -886,7 +886,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.2
#8 lore raw

PATCH 8/12 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.

---

 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
 6 files changed, 2 insertions(+), 1 deletion(-)
 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
Signature · 1 line
2.4.2
#9 lore raw

PATCH 9/12 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.

---

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

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

#10 lore raw

PATCH 10/12 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)

---

 arch/arm/mach-mvebu/include/mach/cpu.h                        | 2 +-
 arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h          | 2 +-
 board/maxbcm/maxbcm.c                                         | 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 +-
 27 files changed, 6 insertions(+), 6 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 3b48460..45f3397 100644
@@ -123,7 +123,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,
board/maxbcm/maxbcm.c +1 -1
index 2fbb90c..a7ce837 100644
@@ -11,7 +11,7 @@
 #include <asm/arch/soc.h>
 #include <linux/mbus.h>
 
-#include "../drivers/ddr/mvebu/ddr3_hw_training.h"
+#include "../drivers/ddr/marvell/axp/ddr3_hw_training.h"
 #include "../arch/arm/mach-mvebu/serdes/high_speed_env_spec.h"
 
 DECLARE_GLOBAL_DATA_PTR;
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 77d3408..555efed 100644
@@ -110,7 +110,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 d8811a4..3803636 100644
@@ -110,7 +110,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.2
#11 lore raw

PATCH 11/12 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.

---

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

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

#12 lore raw

PATCH 12/12 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.

---

 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 5f53522..eac2f86 100644
@@ -1,3 +1,4 @@
+CONFIG_SPL=y
 CONFIG_ARM=y
 CONFIG_TARGET_DB_88F6820_GP=y
 CONFIG_CMD_NET=y
include/configs/db-88f6820-gp.h +35 -0
index 12a24ce..6280274 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
@@ -63,6 +64,40 @@
 #define CONFIG_SYS_CONSOLE_INFO_QUIET	/* don't print console @ startup */
 #define CONFIG_SYS_ALT_MEMTEST
 
+/* 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.2