ddr: vybrid: Support for vf610 built-in DDR3 memory calibration
Subsystems (4)
v2 cover ddr: vybrid: Support for vf610 built-in DDR3 memory calibration
This patch series provides code to perform read leveling - RDLVL, which is adjusting the DQS strobe in relation to the DQ signals so that the strobe edge is centered in the window of valid read data.
The code is based on Vybrid's Reference Manual's:
"VFxxx Controller Reference Manual, Rev. 0, 10/2016", page 1600, 10.1.6.16.4.1 "Software Read Leveling in MC Evaluation Mode"
and uses clarification provided by following NXP's community thread:
"Vybrid: About DDR leveling feature on DDRMC."
https://community.nxp.com/thread/395323
It depends on a BITMAP rework patch:
usb: composite: Move bitmap related operations to ./include/linux/bitmap.h
http://patchwork.ozlabs.org/patch/1006448/
Changes in v2:
- CR93_SWLVL_EXIT -> CR94_SWLVL_EXIT (EXIT is in CR94)
- Add more defines to imx-regs.h (moved from *-calibration.h)
- CR93_SWLVL_EXIT -> CR94_SWLVL_EXIT (EXIT is in CR94)
- Update Kconfig information regarding DDRMC_VF610_CALIBRATION
- Update ddrmc-vf610-calibration. comment
- Update code after extending imx-regs.h
- Remove not needed #ifdef
Lukasz Majewski (3):
ddr: vybrid: Add DDRMC calibration related registers (DQS to DQ)
ddr: vybrid: Provide code to perform on-boot calibration
ddr: vybrid: Add calibration code to memory controler's (DDRMC) setup
code
arch/arm/include/asm/arch-vf610/imx-regs.h | 14 +- arch/arm/mach-imx/Kconfig | 12 + arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/ddrmc-vf610-calibration.c | 342 ++++++++++++++++++++++++++++ arch/arm/mach-imx/ddrmc-vf610-calibration.h | 45 ++++ arch/arm/mach-imx/ddrmc-vf610.c | 5 + 6 files changed, 418 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/ddrmc-vf610-calibration.c create mode 100644 arch/arm/mach-imx/ddrmc-vf610-calibration.h
Signature · 1 line
2.11.0
PATCH v2 1/3 ddr: vybrid: Add DDRMC calibration related registers (DQS to DQ)
This commit provides extra defines needed for DDR memory controller calibration (read leveling performing).
---
Changes in v2:
- CR93_SWLVL_EXIT -> CR94_SWLVL_EXIT (EXIT is in CR94)
- Add more defines to imx-regs.h (moved from *-calibration.h)
arch/arm/include/asm/arch-vf610/imx-regs.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-vf610/imx-regs.h +13 -1
@@ -206,15 +206,27 @@#define DDRMC_CR88_TODTL_CMD (v) (((v) & 0x1f) << 16)#define DDRMC_CR89_AODT_RWSMCS (v) ((v) & 0xf)#define DDRMC_CR91_R2W_SMCSDL (v) (((v) & 0x7) << 16) +#define DDRMC_CR93_SW_LVL_MODE_OFF (8) +#define DDRMC_CR93_SW_LVL_MODE (v) (((v) & 0x3) << DDRMC_CR93_SW_LVL_MODE_OFF) +#define DDRMC_CR93_SWLVL_LOAD BIT(16) +#define DDRMC_CR93_SWLVL_START BIT(24) +#define DDRMC_CR94_SWLVL_EXIT BIT(0) +#define DDRMC_CR94_SWLVL_OP_DONE BIT(8) +#define DDRMC_CR94_SWLVL_RESP_0_OFF (24) +#define DDRMC_CR95_SWLVL_RESP_1_OFF (0)#define DDRMC_CR96_WLMRD (v) (((v) & 0x3f) << 8)#define DDRMC_CR96_WLDQSEN (v) ((v) & 0x3f)#define DDRMC_CR97_WRLVL_EN (1 << 24)#define DDRMC_CR98_WRLVL_DL_0 (v) ((v) & 0xffff)#define DDRMC_CR99_WRLVL_DL_1 (v) ((v) & 0xffff) +#define DDRMC_CR101_PHY_RDLVL_EDGE_OFF (24) +#define DDRMC_CR101_PHY_RDLVL_EDGE BIT(DDRMC_CR101_PHY_RDLVL_EDGE_OFF)#define DDRMC_CR102_RDLVL_GT_REGEN (1 << 16)#define DDRMC_CR102_RDLVL_REG_EN (1 << 8) -#define DDRMC_CR105_RDLVL_DL_0 (v) (((v) & 0xff) << 8) +#define DDRMC_CR105_RDLVL_DL_0_OFF (8) +#define DDRMC_CR105_RDLVL_DL_0 (v) (((v) & 0xff) << DDRMC_CR105_RDLVL_DL_0_OFF)#define DDRMC_CR106_RDLVL_GTDL_0 (v) ((v) & 0xff) +#define DDRMC_CR110_RDLVL_DL_1_OFF (0)#define DDRMC_CR110_RDLVL_DL_1 (v) ((v) & 0xff)#define DDRMC_CR110_RDLVL_GTDL_1 (v) (((v) & 0xff) << 16)#define DDRMC_CR114_RDLVL_GTDL_2 (v) (((v) & 0xffff) << 8)
Signature · 1 line
2.11.0
PATCH v2 1/3 ddr: vybrid: Add DDRMC calibration related registers (DQS to DQ)
Quoted 4 lines
This commit provides extra defines needed for DDR memory controller calibration (read leveling performing).
Signed-off-by Lukasz Majewski <[email protected]>Reviewed-by Stefan Agner <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 2/3 ddr: vybrid: Provide code to perform on-boot calibration
In reply to Lukasz MajewskiThis patch provides the code to calibrate the DDR's DQS to DQ signals (RDLVL).
It is based on:
VFxxx Controller Reference Manual, Rev. 0, 10/2016, page 1600 10.1.6.16.4.1 "Software Read Leveling in MC Evaluation Mode"
and NXP's community thread:
"Vybrid: About DDR leveling feature on DDRMC."
https://community.nxp.com/thread/395323
---
Changes in v2:
- CR93_SWLVL_EXIT -> CR94_SWLVL_EXIT (EXIT is in CR94)
- Update Kconfig information regarding DDRMC_VF610_CALIBRATION
- Update ddrmc-vf610-calibration. comment
- Update code after extending imx-regs.h
arch/arm/mach-imx/Kconfig | 12 + arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/ddrmc-vf610-calibration.c | 342 ++++++++++++++++++++++++++++ arch/arm/mach-imx/ddrmc-vf610-calibration.h | 45 ++++ 4 files changed, 400 insertions(+) create mode 100644 arch/arm/mach-imx/ddrmc-vf610-calibration.c create mode 100644 arch/arm/mach-imx/ddrmc-vf610-calibration.h
arch/arm/mach-imx/Kconfig +12 -0
@@ -78,3 +78,15 @@ config NXP_BOARD_REVISION NXP boards based on i.MX6/7 contain the board revision information stored in the fuses. Select this option if you want to be able to retrieve the board revision information. + +config DDRMC_VF610_CALIBRATION + bool "Enable DDRMC (DDR3) on-chip calibration" + depends on ARCH_VF610 + help + Vybrid (vf610) SoC provides some on-chip facility to tune the DDR3 + memory parameters. Select this option if you want to calculate them + at boot time. + NOTE: + NXP does NOT recommend to perform this calibration at each boot. One + shall perform it on a new PCB and then use those values to program + the ddrmc_cr_setting on relevant board file.
arch/arm/mach-imx/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_SECURE_BOOT) += hab.o endif ifeq ($(SOC),$(filter $(SOC),vf610)) obj-y += ddrmc-vf610.o +obj-$(CONFIG_DDRMC_VF610_CALIBRATION) += ddrmc-vf610-calibration.o endif ifneq ($(CONFIG_SPL_BUILD),y) obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
arch/arm/mach-imx/ddrmc-vf610-calibration.c new file +342 -0
342 lines not on this page · raw message
arch/arm/mach-imx/ddrmc-vf610-calibration.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v2 2/3 ddr: vybrid: Provide code to perform on-boot calibration
Quoted 9 lines
This patch provides the code to calibrate the DDR's DQS to DQ signals (RDLVL).
It is based on:
VFxxx Controller Reference Manual, Rev. 0, 10/2016, page 1600 10.1.6.16.4.1 "Software Read Leveling in MC Evaluation Mode" and NXP's community thread:
"Vybrid: About DDR leveling feature on DDRMC."
https://community.nxp.com/thread/395323Signed-off-by Lukasz Majewski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 3/3 ddr: vybrid: Add calibration code to memory controler's (DDRMC) setup code
In reply to Lukasz MajewskiThis patch extends the vf610 DDR memory controller code to support SW leveling.
---
Changes in v2:
- Remove not needed #ifdef
arch/arm/mach-imx/ddrmc-vf610.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/mach-imx/ddrmc-vf610.c +5 -0
@@ -10,6 +10,7 @@#include <asm/arch/imx-regs.h> #include <asm/arch/iomux-vf610.h> #include <asm/arch/ddrmc-vf610.h> +#include "ddrmc-vf610-calibration.h" void ddrmc_setup_iomux (const iomux_v3_cfg_t *pads,int pads_count) {
@@ -233,4 +234,8 @@ void ddrmc_ctrl_init_ddr3(struct ddr3_jedec_timings const *timings,while (!(readl (&ddrmr->cr[80 ]) &0x100 ))udelay (10 ); + +#ifdef CONFIG_DDRMC_VF610_CALIBRATION +ddrmc_calibration (ddrmr); +#endif }
Signature · 1 line
2.11.0
PATCH v2 3/3 ddr: vybrid: Add calibration code to memory controler's (DDRMC) setup code
Quoted 4 lines
This patch extends the vf610 DDR memory controller code to support SW leveling.
Signed-off-by Lukasz Majewski <[email protected]>Reviewed-by Stefan Agner <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
v2 cover ddr: vybrid: Support for vf610 built-in DDR3 memory calibration
In reply to Lukasz MajewskiHi Fabio, Stefano,
Quoted 8 lines
This patch series provides code to perform read leveling - RDLVL, which is adjusting the DQS strobe in relation to the DQ signals so that the strobe edge is centered in the window of valid read data.
The code is based on Vybrid's Reference Manual's:
"VFxxx Controller Reference Manual, Rev. 0, 10/2016", page 1600, 10.1.6.16.4.1 "Software Read Leveling in MC Evaluation Mode"
Quoted 8 lines
and uses clarification provided by following NXP's community thread:
"Vybrid: About DDR leveling feature on DDRMC."
https://community.nxp.com/thread/395323It depends on a BITMAP rework patch:
usb: composite: Move bitmap related operations
to./include/linux/bitmap.hhttp://patchwork.ozlabs.org/patch/1006448/
The above patch has found its way to main line, so there is no obstacles to pull this code.
Moreover, some Stefan's patches:
[U-Boot,v1,0/4] ddr: vybrid: various fixes
http://patchwork.ozlabs.org/cover/1007547/
Are also related to DDR_MC setup on Vybrid and fix/cleanup some issues.
Quoted 20 lines
Changes in v2:
-CR93_SWLVL_EXIT->CR94_SWLVL_EXIT(EXIT is in CR94)
- Add more defines toimx-regs.h(moved from *-calibration.h)
-CR93_SWLVL_EXIT->CR94_SWLVL_EXIT(EXIT is in CR94)
- UpdateKconfiginformation regardingDDRMC_VF610_CALIBRATION
- Update ddrmc-vf610-calibration. comment
- Update code after extendingimx-regs.h
- Remove not needed #ifdefLukasz Majewski (3):
ddr: vybrid: Add DDRMC calibration related registers (DQS to DQ)
ddr: vybrid: Provide code to perform on-boot calibration
ddr: vybrid: Add calibration code to memory controler's (DDRMC)
setup codearch/arm/include/asm/arch-vf610/imx-regs.h | 14 +- arch/arm/mach-imx/Kconfig | 12 + arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/ddrmc-vf610-calibration.c | 342
Quoted 7 lines
++++++++++++++++++++++++++++
arch/arm/mach-imx/ddrmc-vf610-calibration.h| 45 ++++arch/arm/mach-imx/ddrmc-vf610.c| 5 + 6 files changed,
418 insertions(+), 1 deletion(-) create mode 100644arch/arm/mach-imx/ddrmc-vf610-calibration.ccreate mode 100644arch/arm/mach-imx/ddrmc-vf610-calibration.h
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190102/0f609e40/attachment.sig>