Add full DDR init for Marvell Armada-XP MV78xx0 (AXP)
Subsystems (3)
v2 cover Add full DDR init for Marvell Armada-XP MV78xx0 (AXP)
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 AXP boot image. Not linked with the main U-Boot. With this code addition and the also included SERDES / PHY setup code, the Armada-XP 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. Hopefully other MVEBU SoC's will follow here.
Tested on AXP using a SPD DIMM setup on the Marvell DB-MV784MP-GP board and on a custom fixed DDR configuration board (maxbcm with MV78460).
Thanks,
Stefan
Changes in v2:
- Patch added to patch series (removal of dummy binary.0 files)
- Rebased on current master (2015.01, git ID ab77f241)
Stefan Roese (11):
arm: mvebu: maxbcm: Fix compilation warning and add Spansion SPI NOR
support
arm: mvebu: drivers/ddr: Add DDR3 driver with training code from
Marvell bin_hdr
arm: mvebu: Add Serdes PHY config code
arm: armada-xp: Add SPL support used to include the DDR training code scripts/Makefile.spl: Add MVEBU DDR code to SPL
tools: kwbimage: Support u-boot.img padding to
CONFIG_SYS_SPI_U_BOOT_OFFS
Makefile: Add another kwb build target used on Marvell Armada-XP (AXP)
arm: db-mv784mp-gp: Enable SPL to include DDR training code into
U-Boot
arm: maxbcm: Enable SPL to include DDR training code into U-Boot
arm: mvebu: Placeholder bin_hdr file can now be removed
arm: armada-xp: Change built target to include the SPL binary as
bin_hdr
Makefile | 6 + arch/arm/Kconfig | 2 + arch/arm/cpu/armv7/armada-xp/Makefile | 2 + arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S | 62 + arch/arm/cpu/armv7/armada-xp/spl.c | 38 + arch/arm/include/asm/arch-armada-xp/config.h | 4 + arch/arm/include/asm/arch-armada-xp/cpu.h | 16 + arch/arm/mvebu-common/Makefile | 2 + arch/arm/mvebu-common/serdes/Makefile | 6 + arch/arm/mvebu-common/serdes/board_env_spec.h | 262 ++++ arch/arm/mvebu-common/serdes/high_speed_env_lib.c | 1572 +++++++++++++++++++ arch/arm/mvebu-common/serdes/high_speed_env_spec.c | 185 +++ arch/arm/mvebu-common/serdes/high_speed_env_spec.h | 87 ++ arch/arm/mvebu-common/u-boot-spl.lds | 57 + board/Marvell/db-mv784mp-gp/binary.0 | 17 - board/Marvell/db-mv784mp-gp/kwbimage.cfg | 2 +- board/maxbcm/binary.0 | 17 - board/maxbcm/kwbimage.cfg | 2 +- board/maxbcm/maxbcm.c | 85 +- configs/db-mv784mp-gp_defconfig | 5 +- configs/maxbcm_defconfig | 5 +- drivers/ddr/mvebu/Makefile | 14 + drivers/ddr/mvebu/ddr3_axp.h | 510 +++++++ drivers/ddr/mvebu/ddr3_axp_config.h | 146 ++ drivers/ddr/mvebu/ddr3_axp_mc_static.h | 284 ++++ drivers/ddr/mvebu/ddr3_axp_training_static.h | 770 ++++++++++ drivers/ddr/mvebu/ddr3_axp_vars.h | 226 +++ drivers/ddr/mvebu/ddr3_dfs.c | 1552 +++++++++++++++++++ drivers/ddr/mvebu/ddr3_dqs.c | 1374 +++++++++++++++++ drivers/ddr/mvebu/ddr3_hw_training.c | 1115 ++++++++++++++ drivers/ddr/mvebu/ddr3_hw_training.h | 392 +++++ drivers/ddr/mvebu/ddr3_init.c | 1219 +++++++++++++++ drivers/ddr/mvebu/ddr3_init.h | 143 ++ drivers/ddr/mvebu/ddr3_patterns_64bit.h | 924 ++++++++++++ drivers/ddr/mvebu/ddr3_pbs.c | 1592 ++++++++++++++++++++ drivers/ddr/mvebu/ddr3_read_leveling.c | 1214 +++++++++++++++ drivers/ddr/mvebu/ddr3_sdram.c | 669 ++++++++ drivers/ddr/mvebu/ddr3_spd.c | 1300 ++++++++++++++++ drivers/ddr/mvebu/ddr3_write_leveling.c | 1366 +++++++++++++++++ drivers/ddr/mvebu/xor.c | 436 ++++++ drivers/ddr/mvebu/xor.h | 70 + drivers/ddr/mvebu/xor_regs.h | 103 ++ include/configs/db-mv784mp-gp.h | 49 + include/configs/maxbcm.h | 49 + scripts/Makefile.spl | 1 + tools/kwbimage.c | 11 + 46 files changed, 17919 insertions(+), 44 deletions(-) create mode 100644 arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S create mode 100644 arch/arm/cpu/armv7/armada-xp/spl.c create mode 100644 arch/arm/mvebu-common/serdes/Makefile create mode 100644 arch/arm/mvebu-common/serdes/board_env_spec.h create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_lib.c create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_spec.c create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_spec.h create mode 100644 arch/arm/mvebu-common/u-boot-spl.lds delete mode 100644 board/Marvell/db-mv784mp-gp/binary.0 delete mode 100644 board/maxbcm/binary.0 create mode 100644 drivers/ddr/mvebu/Makefile create mode 100644 drivers/ddr/mvebu/ddr3_axp.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_config.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_mc_static.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_training_static.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_vars.h create mode 100644 drivers/ddr/mvebu/ddr3_dfs.c create mode 100644 drivers/ddr/mvebu/ddr3_dqs.c create mode 100644 drivers/ddr/mvebu/ddr3_hw_training.c create mode 100644 drivers/ddr/mvebu/ddr3_hw_training.h create mode 100644 drivers/ddr/mvebu/ddr3_init.c create mode 100644 drivers/ddr/mvebu/ddr3_init.h create mode 100644 drivers/ddr/mvebu/ddr3_patterns_64bit.h create mode 100644 drivers/ddr/mvebu/ddr3_pbs.c create mode 100644 drivers/ddr/mvebu/ddr3_read_leveling.c create mode 100644 drivers/ddr/mvebu/ddr3_sdram.c create mode 100644 drivers/ddr/mvebu/ddr3_spd.c create mode 100644 drivers/ddr/mvebu/ddr3_write_leveling.c create mode 100644 drivers/ddr/mvebu/xor.c create mode 100644 drivers/ddr/mvebu/xor.h create mode 100644 drivers/ddr/mvebu/xor_regs.h
Signature · 1 line
2.2.2
PATCH v2 1/11 arm: mvebu: maxbcm: Fix compilation warning and add Spansion SPI NOR support
This patch fixes the following compilation warning for maxbcm:
Building maxbcm board...
text data bss dec hex filename
160075 6596 38240 204911 3206f ./u-bootboard/maxbcm/maxbcm.c: In function 'reset_phy':board/maxbcm/maxbcm.c:68:6: warning: unused variable 'reg' [-Wunused-variable]
u16 reg;
^
board/maxbcm/maxbcm.c:66:6: warning: unused variable 'devadr' [-Wunused-variable]
u16 devadr = CONFIG_PHY_BASE_ADDR;
^Additionally support Spansion SPI NOR flash is added. With larger SPI device support via the CONFIG_SPI_FLASH_BAR define.
---
Changes in v2: None
board/maxbcm/maxbcm.c | 2 -- include/configs/maxbcm.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
board/maxbcm/maxbcm.c +0 -2
@@ -63,9 +63,7 @@ int checkboard(void)/* Configure and enable MV88E6185 switch */ void reset_phy (void ) { -u16 devadr =CONFIG_PHY_BASE_ADDR ;char *name ="neta0" ; -u16 reg;if (miiphy_set_current_dev (name))return ;
include/configs/maxbcm.h +2 -0
@@ -43,6 +43,8 @@#define CONFIG_SF_DEFAULT_SPEED 1000000#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3#define CONFIG_SPI_FLASH_STMICRO +#define CONFIG_SPI_FLASH_SPANSION +#define CONFIG_SPI_FLASH_BAR /* Environment in SPI NOR flash */ #define CONFIG_ENV_IS_IN_SPI_FLASH
Signature · 1 line
2.2.2
PATCH v2 1/11 arm: mvebu: maxbcm: Fix compilation warning and add Spansion SPI NOR support
Quoted 13 lines · Stefan Roese
This patch fixes the following compilation warning for maxbcm:
Building maxbcm board...
text data bss dec hex filename
160075 6596 38240 204911 3206f ./u-bootboard/maxbcm/maxbcm.c: In function 'reset_phy':board/maxbcm/maxbcm.c:68:6: warning: unused variable 'reg' [-Wunused-variable]u16 reg; ^ board/maxbcm/maxbcm.c:66:6: warning: unused variable 'devadr' [-Wunused-variable] u16 devadr = CONFIG_PHY_BASE_ADDR; ^
Quoted 4 lines
Additionally support Spansion SPI NOR flash is added. With larger SPI device support via the
CONFIG_SPI_FLASH_BARdefine.Signed-off-by Stefan Roese <[email protected]>
Quoted 36 lines
---
Changes in v2: None
board/maxbcm/maxbcm.c | 2 -- include/configs/maxbcm.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)board/maxbcm/maxbcm.c +0
-2@@ -63,9 +63,7 @@ int checkboard(void)/* Configure and enable MV88E6185 switch */ void reset_phy (void ) { -u16 devadr =CONFIG_PHY_BASE_ADDR ;char *name ="neta0" ; -u16 reg;if (miiphy_set_current_dev (name))return ;include/configs/maxbcm.h +2
-1@@ -43,6 +43,8 @@#define CONFIG_SF_DEFAULT_SPEED 1000000#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3#define CONFIG_SPI_FLASH_STMICRO +#define CONFIG_SPI_FLASH_SPANSION +#define CONFIG_SPI_FLASH_BAR /* Environment in SPI NOR flash */ #define CONFIG_ENV_IS_IN_SPI_FLASH --
Quoted 1 line
2.2.2
thanks!
Signature · 1 line
Jagan.
PATCH v2 2/11 arm: mvebu: drivers/ddr: Add DDR3 driver with training code from Marvell bin_hdr
In reply to Stefan RoeseThis 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 AXP boot image. Not linked with the main U-Boot. With this code addition and the following serdes/PHY setup code, the Armada-XP 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. Hopefully other MVEBU SoC's will follow here.
Support for some SoC's has been removed in this version. This is:
MV_MSYS:
The code referred to by the MV_MSYS define is currently unused. And its not really planned to support this in mainline. So lets remove it to make the code clearer and increase the readability.
MV88F68XX (A38x):
The code referred to by the MV88F68XX define (A38x) is currently unused. And its partial and not sufficient for this device in this stage. So lets remove it to make the code clearer and increase the readability.
MV88F66XX (ALP):
The code referred to by the MV88F66XX define is currently unused. And its not really planned to support this in mainline. So lets remove it to make the code clearer and increase the readability.
MV88F78X60_Z1:
The code referred to by the MV88F78X60_Z1 define is currently unused. As the Z1 revision of the AXP is not supported in mainline anymore.
So lets remove it to make the code clearer and increase the readability.
Remove support for Z1 & A0 AXP revisions (steppings). The current stepping is B0 and this is the only one that is actively supported in this code version.
Tested on AXP using a SPD DIMM setup on the Marvell DB-MV784MP-GP board and on a custom fixed DDR configuration board (maxbcm).
Note:
This code has undergone many hours 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. This might be some task to tackly later on.
---
Changes in v2: None
drivers/ddr/mvebu/Makefile | 14 + drivers/ddr/mvebu/ddr3_axp.h | 510 +++++++++ drivers/ddr/mvebu/ddr3_axp_config.h | 146 +++ drivers/ddr/mvebu/ddr3_axp_mc_static.h | 284 +++++ drivers/ddr/mvebu/ddr3_axp_training_static.h | 770 +++++++++++++ drivers/ddr/mvebu/ddr3_axp_vars.h | 226 ++++ drivers/ddr/mvebu/ddr3_dfs.c | 1552 +++++++++++++++++++++++++ drivers/ddr/mvebu/ddr3_dqs.c | 1374 ++++++++++++++++++++++ drivers/ddr/mvebu/ddr3_hw_training.c | 1115 ++++++++++++++++++ drivers/ddr/mvebu/ddr3_hw_training.h | 392 +++++++ drivers/ddr/mvebu/ddr3_init.c | 1219 ++++++++++++++++++++ drivers/ddr/mvebu/ddr3_init.h | 143 +++ drivers/ddr/mvebu/ddr3_patterns_64bit.h | 924 +++++++++++++++ drivers/ddr/mvebu/ddr3_pbs.c | 1592 ++++++++++++++++++++++++++ drivers/ddr/mvebu/ddr3_read_leveling.c | 1214 ++++++++++++++++++++ drivers/ddr/mvebu/ddr3_sdram.c | 669 +++++++++++ drivers/ddr/mvebu/ddr3_spd.c | 1300 +++++++++++++++++++++ drivers/ddr/mvebu/ddr3_write_leveling.c | 1366 ++++++++++++++++++++++ drivers/ddr/mvebu/xor.c | 436 +++++++ drivers/ddr/mvebu/xor.h | 70 ++ drivers/ddr/mvebu/xor_regs.h | 103 ++ 21 files changed, 15419 insertions(+) create mode 100644 drivers/ddr/mvebu/Makefile create mode 100644 drivers/ddr/mvebu/ddr3_axp.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_config.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_mc_static.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_training_static.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_vars.h create mode 100644 drivers/ddr/mvebu/ddr3_dfs.c create mode 100644 drivers/ddr/mvebu/ddr3_dqs.c create mode 100644 drivers/ddr/mvebu/ddr3_hw_training.c create mode 100644 drivers/ddr/mvebu/ddr3_hw_training.h create mode 100644 drivers/ddr/mvebu/ddr3_init.c create mode 100644 drivers/ddr/mvebu/ddr3_init.h create mode 100644 drivers/ddr/mvebu/ddr3_patterns_64bit.h create mode 100644 drivers/ddr/mvebu/ddr3_pbs.c create mode 100644 drivers/ddr/mvebu/ddr3_read_leveling.c create mode 100644 drivers/ddr/mvebu/ddr3_sdram.c create mode 100644 drivers/ddr/mvebu/ddr3_spd.c create mode 100644 drivers/ddr/mvebu/ddr3_write_leveling.c create mode 100644 drivers/ddr/mvebu/xor.c create mode 100644 drivers/ddr/mvebu/xor.h create mode 100644 drivers/ddr/mvebu/xor_regs.h
drivers/ddr/mvebu/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-$(CONFIG_SPL_BUILD) += ddr3_dfs.o +obj-$(CONFIG_SPL_BUILD) += ddr3_dqs.o +obj-$(CONFIG_SPL_BUILD) += ddr3_hw_training.o +obj-$(CONFIG_SPL_BUILD) += ddr3_init.o +obj-$(CONFIG_SPL_BUILD) += ddr3_pbs.o +obj-$(CONFIG_SPL_BUILD) += ddr3_read_leveling.o +obj-$(CONFIG_SPL_BUILD) += ddr3_sdram.o +obj-$(CONFIG_SPL_BUILD) += ddr3_spd.o +obj-$(CONFIG_SPL_BUILD) += ddr3_write_leveling.o +obj-$(CONFIG_SPL_BUILD) += xor.o
drivers/ddr/mvebu/ddr3_axp.h new file +510 -0
510 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_axp_config.h new file +146 -0
146 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_axp_mc_static.h new file +284 -0
284 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_axp_training_static.h new file +770 -0
770 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_axp_vars.h new file +226 -0
226 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_dfs.c new file +1552 -0
1,050 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_dqs.c new file +1374 -0
1,374 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_hw_training.c new file +1115 -0
1,115 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_hw_training.h new file +392 -0
392 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_init.c new file +1219 -0
1,219 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_init.h new file +143 -0
143 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_patterns_64bit.h new file +924 -0
924 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_pbs.c new file +1592 -0
1,592 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_read_leveling.c new file +1214 -0
1,214 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_sdram.c new file +669 -0
669 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_spd.c new file +1300 -0
1,300 lines not on this page · raw message
drivers/ddr/mvebu/ddr3_write_leveling.c new file +1366 -0
1,366 lines not on this page · raw message
drivers/ddr/mvebu/xor.c new file +436 -0
436 lines not on this page · raw message
drivers/ddr/mvebu/xor.h new file +70 -0
70 lines not on this page · raw message
drivers/ddr/mvebu/xor_regs.h new file +103 -0
103 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.2.2
Part of the diff is not shown here. View the raw message.
PATCH v2 3/11 arm: mvebu: Add Serdes PHY config code
In reply to Stefan RoeseThis 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/mvebu-common/Makefile | 2 + arch/arm/mvebu-common/serdes/Makefile | 6 + arch/arm/mvebu-common/serdes/board_env_spec.h | 262 ++++ arch/arm/mvebu-common/serdes/high_speed_env_lib.c | 1572 ++++++++++++++++++++ arch/arm/mvebu-common/serdes/high_speed_env_spec.c | 185 +++ arch/arm/mvebu-common/serdes/high_speed_env_spec.h | 87 ++ 6 files changed, 2114 insertions(+) create mode 100644 arch/arm/mvebu-common/serdes/Makefile create mode 100644 arch/arm/mvebu-common/serdes/board_env_spec.h create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_lib.c create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_spec.c create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_spec.h
arch/arm/mvebu-common/Makefile +2 -0
@@ -10,3 +10,5 @@ obj-y = dram.o obj-y += gpio.o obj-$(CONFIG_ARMADA_XP) += mbus.o obj-y += timer.o + +obj-y += serdes/
arch/arm/mvebu-common/serdes/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-$(CONFIG_SPL_BUILD) = high_speed_env_lib.o +obj-$(CONFIG_SPL_BUILD) += high_speed_env_spec.o
arch/arm/mvebu-common/serdes/board_env_spec.h new file +262 -0
262 lines not on this page · raw message
arch/arm/mvebu-common/serdes/high_speed_env_lib.c new file +1572 -0
1,572 lines not on this page · raw message
arch/arm/mvebu-common/serdes/high_speed_env_spec.c new file +185 -0
185 lines not on this page · raw message
arch/arm/mvebu-common/serdes/high_speed_env_spec.h new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH v2 4/11 arm: armada-xp: Add SPL support used to include the DDR training code
In reply to Stefan RoeseThis patch adds SPL support to the Marvell Armada-XP. With this addition the bin_hdr integration is not needed any more. The SPL will first initialize the serdes/PHY and the call the DDR setup and training code now integrated into mainline U-Boot.
---
Changes in v2: None
arch/arm/cpu/armv7/armada-xp/Makefile | 2 + arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S | 62 +++++++++++++++++++++++++++++ arch/arm/cpu/armv7/armada-xp/spl.c | 38 ++++++++++++++++++ arch/arm/include/asm/arch-armada-xp/cpu.h | 13 ++++++ arch/arm/mvebu-common/u-boot-spl.lds | 57 ++++++++++++++++++++++++++ 5 files changed, 172 insertions(+) create mode 100644 arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S create mode 100644 arch/arm/cpu/armv7/armada-xp/spl.c create mode 100644 arch/arm/mvebu-common/u-boot-spl.lds
arch/arm/cpu/armv7/armada-xp/Makefile +2 -0
@@ -5,3 +5,5 @@ # obj-y = cpu.o +obj-$(CONFIG_SPL_BUILD) += spl.o +obj-$(CONFIG_SPL_BUILD) += lowlevel_spl.o
arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S new file +62 -0
62 lines not on this page · raw message
arch/arm/cpu/armv7/armada-xp/spl.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (C) 2014 Stefan Roese <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <spl.h> +#include <asm/io.h> +#include <asm/arch/cpu.h> +#include <asm/arch/soc.h> + +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{ +/* Right now only booting via SPI NOR flash is supported */ +return BOOT_DEVICE_SPI ; +} + +void board_init_f (ulong dummy) +{ +/* Set global data pointer */ + gd = &gdata; + +/* Linux expects the internal registers to be at 0xf1000000 */ +arch_cpu_init (); + +preloader_console_init (); + +/* First init the serdes PHY's */ +serdes_phy_config (); + +/* Setup DDR */ +ddr3_init (); + +board_init_r (NULL ,0 ); +}
arch/arm/include/asm/arch-armada-xp/cpu.h +13 -0
@@ -103,5 +103,18 @@ unsigned int mvebu_sdram_bar(enum memory_bank bank);unsigned int mvebu_sdram_bs (enum memory_bank bank);void mvebu_sdram_size_adjust (enum memory_bank bank);int mvebu_mbus_probe (struct mbus_win windows[],int count); + +/* +* Highspeed SERDES PHY config init, ported from bin_hdr +* to mainline U-Boot +*/ +int serdes_phy_config (void ); + +/* +* DDR3 init / training code ported from Marvell bin_hdr. Now +* available in mainline U-Boot in: +* drivers/ddr/mvebu/ +*/ +int ddr3_init (void );#endif /* __ASSEMBLY__ */ #endif /* _ARMADA_XP_CPU_H */
arch/arm/mvebu-common/u-boot-spl.lds new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH v2 5/11 scripts/Makefile.spl: Add MVEBU DDR code to SPL
In reply to Stefan Roese---
Changes in v2: None
scripts/Makefile.spl | 1 + 1 file changed, 1 insertion(+)
scripts/Makefile.spl +1 -0
@@ -57,6 +57,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_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.2.2
PATCH v2 6/11 tools: kwbimage: Support u-boot.img padding to CONFIG_SYS_SPI_U_BOOT_OFFS
In reply to Stefan RoeseThis is used on the AXP boards, to pad u-boot.img to the desired offset in SPI flash (only this boot target supported right now). This offset is used by the SPL then to load u-boot.img into SDRAM and execute it there.
---
Changes in v2: None
tools/kwbimage.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/kwbimage.c +11 -0
@@ -16,6 +16,7 @@#include <image.h> #include <stdint.h> #include "kwbimage.h" +#include <config.h> #define ALIGN_SUP (x, a) (((x) + (a - 1)) & ~(a - 1))
@@ -868,6 +869,16 @@ 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.2.2
PATCH v2 7/11 Makefile: Add another kwb build target used on Marvell Armada-XP (AXP)
In reply to Stefan RoeseThis build target now includes the SPL binary as the bin_hdr into the kwb image. Its used on the AXP port with the mainlined DDR training code.
---
Changes in v2: None
Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -849,12 +849,18 @@ MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ 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) + MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE $(call if_changed,mkimage) +u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) + MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) u-boot-dtb.img: u-boot-dtb.bin FORCE
Signature · 1 line
2.2.2
PATCH v2 8/11 arm: db-mv784mp-gp: Enable SPL to include DDR training code into U-Boot
In reply to Stefan RoeseThis patch adds SPL support to the db-mv784mp-gp eval board.
---
Changes in v2: None
arch/arm/Kconfig | 1 + board/Marvell/db-mv784mp-gp/kwbimage.cfg | 2 +- configs/db-mv784mp-gp_defconfig | 5 ++-- include/configs/db-mv784mp-gp.h | 49 ++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-)
arch/arm/Kconfig +1 -0
@@ -229,6 +229,7 @@ config KIRKWOOD config TARGET_DB_MV784MP_GP bool "Support db-mv784mp-gp" select CPU_V7 + select SUPPORT_SPL config TARGET_MAXBCM bool "Support maxbcm"
board/Marvell/db-mv784mp-gp/kwbimage.cfg +1 -1
@@ -9,4 +9,4 @@ VERSION 1 BOOT_FROM spi # Binary Header (bin_hdr) with DDR3 training code -BINARY board/Marvell/db-mv784mp-gp/binary.0 0000005b 00000068 +BINARY spl/u-boot-spl.bin 0000005b 00000068
configs/db-mv784mp-gp_defconfig +3 -2
@@ -1,2 +1,3 @@ -CONFIG_ARM=y -CONFIG_TARGET_DB_MV784MP_GP=y +CONFIG_SPL=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_DB_MV784MP_GP=y
include/configs/db-mv784mp-gp.h +49 -0
59 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH v2 9/11 arm: maxbcm: Enable SPL to include DDR training code into U-Boot
In reply to Stefan RoeseThis patch adds SPL support to the maxbcm MV78460 based board. Including the fixed DDR configuratrion needed for the DDR training code. And the the serdes PHY init code.
---
Changes in v2: None
arch/arm/Kconfig | 1 + arch/arm/include/asm/arch-armada-xp/cpu.h | 3 ++ board/maxbcm/kwbimage.cfg | 2 +- board/maxbcm/maxbcm.c | 83 ++++++++++++++++++++++++++++++- configs/maxbcm_defconfig | 5 +- include/configs/maxbcm.h | 47 +++++++++++++++++ 6 files changed, 136 insertions(+), 5 deletions(-)
arch/arm/Kconfig +1 -0
@@ -234,6 +234,7 @@ config TARGET_DB_MV784MP_GP config TARGET_MAXBCM bool "Support maxbcm" select CPU_V7 + select SUPPORT_SPL config TARGET_DEVKIT3250 bool "Support devkit3250"
arch/arm/include/asm/arch-armada-xp/cpu.h +3 -0
@@ -96,6 +96,9 @@ struct kwgpio_registers {u32 irq_level; }; +/* Needed for dynamic (board-specific) mbus configuration */ +extern struct mvebu_mbus_state mbus_state; +/* * functions */
board/maxbcm/kwbimage.cfg +1 -1
@@ -9,4 +9,4 @@ VERSION 1 BOOT_FROM spi # Binary Header (bin_hdr) with DDR3 training code -BINARY board/maxbcm/binary.0 0000005b 00000068 +BINARY spl/u-boot-spl.bin 0000005b 00000068
board/maxbcm/maxbcm.c +81 -2
95 lines not on this page · raw message
configs/maxbcm_defconfig +3 -2
@@ -1,2 +1,3 @@ -CONFIG_ARM=y -CONFIG_TARGET_MAXBCM=y +CONFIG_SPL=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_MAXBCM=y
include/configs/maxbcm.h +47 -0
51 lines not on this page · raw message
Signature · 1 line
2.2.2
PATCH v2 10/11 arm: mvebu: Placeholder bin_hdr file can now be removed
In reply to Stefan RoeseWith this patchset the Marvell bin_hdr (DDR training) code is intergrated into mainline U-Boot. We can remove the placeholder file again, which was only introduced to make U-Boot compile and link again.
---
Changes in v2:
- Patch added to patch series (removal of dummy binary.0 files)
board/Marvell/db-mv784mp-gp/binary.0 | 17 ----------------- board/maxbcm/binary.0 | 17 ----------------- 2 files changed, 34 deletions(-) delete mode 100644 board/Marvell/db-mv784mp-gp/binary.0 delete mode 100644 board/maxbcm/binary.0
board/Marvell/db-mv784mp-gp/binary.0 deleted +0 -17
@@ -1,17 +0,0 @@ --------- -WARNING: --------- -This file should contain the bin_hdr generated by the original Marvell -U-Boot implementation. As this is currently not included in this -U-Boot version, we have added this placeholder, so that the U-Boot -image can be generated without errors. - -If you have a known to be working bin_hdr for your board, then you -just need to replace this text file here with the binary header -and recompile U-Boot. - -In a few weeks, mainline U-Boot will get support to generate the -bin_hdr with the DDR training code itself. By implementing this code -as SPL U-Boot. Then this file will not be needed any more and will -get removed. -
board/maxbcm/binary.0 deleted +0 -17
@@ -1,17 +0,0 @@ --------- -WARNING: --------- -This file should contain the bin_hdr generated by the original Marvell -U-Boot implementation. As this is currently not included in this -U-Boot version, we have added this placeholder, so that the U-Boot -image can be generated without errors. - -If you have a known to be working bin_hdr for your board, then you -just need to replace this text file here with the binary header -and recompile U-Boot. - -In a few weeks, mainline U-Boot will get support to generate the -bin_hdr with the DDR training code itself. By implementing this code -as SPL U-Boot. Then this file will not be needed any more and will -get removed. -
Signature · 1 line
2.2.2
PATCH v2 11/11 arm: armada-xp: Change built target to include the SPL binary as bin_hdr
In reply to Stefan Roese---
Changes in v2:
- Rebased on current master (2015.01, git ID ab77f241)
arch/arm/include/asm/arch-armada-xp/config.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/include/asm/arch-armada-xp/config.h +4 -0
@@ -31,7 +31,11 @@#endif /* CONFIG_SYS_KWD_CONFIG */ /* Add target to build it automatically upon "make" */ +#ifdef CONFIG_SPL +#define CONFIG_BUILD_TARGET "u-boot-spl.kwb" +#else #define CONFIG_BUILD_TARGET "u-boot.kwb" +#endif /* end of 16M scrubbed by training in bootrom */ #define CONFIG_SYS_INIT_SP_ADDR 0x00FF0000
Signature · 1 line
2.2.2
v2 cover Add full DDR init for Marvell Armada-XP MV78xx0 (AXP)
In reply to Stefan RoeseQuoted 11 lines · 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 AXP boot image. Not linked with the main U-Boot. With this code addition and the also included SERDES / PHY setup code, the Armada-XP 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. Hopefully other MVEBU SoC's will follow here.Tested on AXP using a SPD DIMM setup on the Marvell DB-MV784MP-GP board and on a custom fixed DDR configuration board (maxbcm with MV78460).
I've tested entire series on Kirkwood board RaidSonic ICY BOX IB-NAS62x0. That said:
Tom, can you pull this series as-is or should I pull it in Marvell tree first?
Luka
Quoted 104 lines
Changes in v2:
- Patch added to patch series (removal of dummy binary.0 files)
- Rebased on current master (2015.01, git IDab77f241)Stefan Roese (11):
arm: mvebu: maxbcm: Fix compilation warning and add Spansion SPI NOR
support
arm: mvebu:drivers/ddr: Add DDR3 driver with training code from
Marvellbin_hdr
arm: mvebu: Add Serdes PHY config code
arm: armada-xp: Add SPL support used to include the DDR training codescripts/Makefile.spl: Add MVEBU DDR code to SPL
tools: kwbimage: Support u-boot.img padding to
CONFIG_SYS_SPI_U_BOOT_OFFS
Makefile: Add another kwb build target used on Marvell Armada-XP (AXP)
arm: db-mv784mp-gp: Enable SPL to include DDR training code into
U-Boot
arm: maxbcm: Enable SPL to include DDR training code into U-Boot
arm: mvebu: Placeholderbin_hdrfile can now be removed
arm: armada-xp: Change built target to include the SPL binary as
bin_hdrMakefile | 6 + arch/arm/Kconfig | 2 + arch/arm/cpu/armv7/armada-xp/Makefile | 2 + arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S | 62 + arch/arm/cpu/armv7/armada-xp/spl.c | 38 + arch/arm/include/asm/arch-armada-xp/config.h | 4 + arch/arm/include/asm/arch-armada-xp/cpu.h | 16 + arch/arm/mvebu-common/Makefile | 2 + arch/arm/mvebu-common/serdes/Makefile | 6 + arch/arm/mvebu-common/serdes/board_env_spec.h | 262 ++++ arch/arm/mvebu-common/serdes/high_speed_env_lib.c | 1572 +++++++++++++++++++ arch/arm/mvebu-common/serdes/high_speed_env_spec.c | 185 +++ arch/arm/mvebu-common/serdes/high_speed_env_spec.h | 87 ++ arch/arm/mvebu-common/u-boot-spl.lds | 57 + board/Marvell/db-mv784mp-gp/binary.0 | 17 - board/Marvell/db-mv784mp-gp/kwbimage.cfg | 2 +- board/maxbcm/binary.0 | 17 - board/maxbcm/kwbimage.cfg | 2 +- board/maxbcm/maxbcm.c | 85 +- configs/db-mv784mp-gp_defconfig | 5 +- configs/maxbcm_defconfig | 5 +- drivers/ddr/mvebu/Makefile | 14 + drivers/ddr/mvebu/ddr3_axp.h | 510 +++++++ drivers/ddr/mvebu/ddr3_axp_config.h | 146 ++ drivers/ddr/mvebu/ddr3_axp_mc_static.h | 284 ++++ drivers/ddr/mvebu/ddr3_axp_training_static.h | 770 ++++++++++ drivers/ddr/mvebu/ddr3_axp_vars.h | 226 +++ drivers/ddr/mvebu/ddr3_dfs.c | 1552 +++++++++++++++++++ drivers/ddr/mvebu/ddr3_dqs.c | 1374 +++++++++++++++++ drivers/ddr/mvebu/ddr3_hw_training.c | 1115 ++++++++++++++ drivers/ddr/mvebu/ddr3_hw_training.h | 392 +++++ drivers/ddr/mvebu/ddr3_init.c | 1219 +++++++++++++++ drivers/ddr/mvebu/ddr3_init.h | 143 ++ drivers/ddr/mvebu/ddr3_patterns_64bit.h | 924 ++++++++++++ drivers/ddr/mvebu/ddr3_pbs.c | 1592 ++++++++++++++++++++ drivers/ddr/mvebu/ddr3_read_leveling.c | 1214 +++++++++++++++ drivers/ddr/mvebu/ddr3_sdram.c | 669 ++++++++ drivers/ddr/mvebu/ddr3_spd.c | 1300 ++++++++++++++++ drivers/ddr/mvebu/ddr3_write_leveling.c | 1366 +++++++++++++++++ drivers/ddr/mvebu/xor.c | 436 ++++++ drivers/ddr/mvebu/xor.h | 70 + drivers/ddr/mvebu/xor_regs.h | 103 ++ include/configs/db-mv784mp-gp.h | 49 + include/configs/maxbcm.h | 49 + scripts/Makefile.spl | 1 + tools/kwbimage.c | 11 + 46 files changed, 17919 insertions(+), 44 deletions(-) create mode 100644 arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S create mode 100644 arch/arm/cpu/armv7/armada-xp/spl.c create mode 100644 arch/arm/mvebu-common/serdes/Makefile create mode 100644 arch/arm/mvebu-common/serdes/board_env_spec.h create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_lib.c create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_spec.c create mode 100644 arch/arm/mvebu-common/serdes/high_speed_env_spec.h create mode 100644 arch/arm/mvebu-common/u-boot-spl.lds delete mode 100644 board/Marvell/db-mv784mp-gp/binary.0 delete mode 100644 board/maxbcm/binary.0 create mode 100644 drivers/ddr/mvebu/Makefile create mode 100644 drivers/ddr/mvebu/ddr3_axp.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_config.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_mc_static.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_training_static.h create mode 100644 drivers/ddr/mvebu/ddr3_axp_vars.h create mode 100644 drivers/ddr/mvebu/ddr3_dfs.c create mode 100644 drivers/ddr/mvebu/ddr3_dqs.c create mode 100644 drivers/ddr/mvebu/ddr3_hw_training.c create mode 100644 drivers/ddr/mvebu/ddr3_hw_training.h create mode 100644 drivers/ddr/mvebu/ddr3_init.c create mode 100644 drivers/ddr/mvebu/ddr3_init.h create mode 100644 drivers/ddr/mvebu/ddr3_patterns_64bit.h create mode 100644 drivers/ddr/mvebu/ddr3_pbs.c create mode 100644 drivers/ddr/mvebu/ddr3_read_leveling.c create mode 100644 drivers/ddr/mvebu/ddr3_sdram.c create mode 100644 drivers/ddr/mvebu/ddr3_spd.c create mode 100644 drivers/ddr/mvebu/ddr3_write_leveling.c create mode 100644 drivers/ddr/mvebu/xor.c create mode 100644 drivers/ddr/mvebu/xor.h create mode 100644 drivers/ddr/mvebu/xor_regs.hSignature · 1 line
2.2.2
v2 cover Add full DDR init for Marvell Armada-XP MV78xx0 (AXP)
Quoted 13 lines · Luka Perkov
Quoted 11 lines · 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 AXP boot image. Not linked with the main U-Boot. With this code addition and the also included SERDES / PHY setup code, the Armada-XP 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. Hopefully other MVEBU SoC's will follow here.Tested on AXP using a SPD DIMM setup on the Marvell DB-MV784MP-GP board and on a custom fixed DDR configuration board (maxbcm with MV78460).
Quoted 7 lines
I've tested entire series on Kirkwood board RaidSonic ICY BOX IB-NAS62x0. That said:
Tested-by Luka Perkov <[email protected]>Tom, can you pull this series as-is or should I pull it in Marvell tree first?
Tom, any updates on this? I really would like to see this patch series applied for the next release. Its been on the list for quite some while with zero negative feedback so far.
Thanks,
Stefan
v2 cover Add full DDR init for Marvell Armada-XP MV78xx0 (AXP)
Quoted 17 lines · Stefan Roese
Quoted 16 lines · Luka Perkov
Quoted 11 lines · 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 AXP boot image. Not linked with the main U-Boot. With this code addition and the also included SERDES / PHY setup code, the Armada-XP 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. Hopefully other MVEBU SoC's will follow here.Tested on AXP using a SPD DIMM setup on the Marvell DB-MV784MP-GP board and on a custom fixed DDR configuration board (maxbcm with MV78460).
I've tested entire series on Kirkwood board RaidSonic ICY BOX IB-NAS62x0. That said:
Quoted 8 lines
Quoted 4 lines
Tested-by Luka Perkov <[email protected]>Tom, can you pull this series as-is or should I pull it in Marvell tree first?
Tom, any updates on this? I really would like to see this patch series applied for the next release. Its been on the list for quite some while with zero negative feedback so far.
Please make up a PR for it, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150202/735837b9/attachment.sig>