u-boot-brain/arch/arm
Marek Vasut 14eeb683a8 ARM: mx6: ddr: Add write leveling correction code
When the DDR calibration is enabled, a situation may happen that it
will fail on a few select boards out of a whole production lot. In
particular, after the first write leveling stage, the MPWLDECTRLx
registers will contain a value 0x1nn , for nn usually being 0x7f or
slightly lower.

What this means is that the HW write leveling detected that the DQS
rising edge on one or more bundles arrives slightly _after_ CLK and
therefore when the DDR DRAM samples CLK on the DQS rising edge, the
CLK signal is already high (cfr. AN4467 rev2 Figure 7 on page 18).

The HW write leveling then ends up adding almost an entire cycle (thus
the 0x17f) to the DQS delay, which indeed aligns it, but also triggers
subsequent calibration failure in DQS gating due to this massive offset.

There are two observations here:
- If the MPWLDECTRLx value is corrected from 0x17f to 0x0 , then the
  DQS gating passes, the entire calibration passes as well and the
  DRAM is perfectly stable even under massive load.
- When using the NXP DRAM calibrator for iMX6/7, the value 0x17f or so
  in MPWLDECTRx register is not there, but it is replaced by 0x0 as one
  would expect.

Someone from NXP finally explains why, quoting [1]:

    "
    Having said all that, the DDR Stress Test does something that we
    do not advertise to the users. The Stress Test iself looks at the
    values of the MPWLDECTRL0/1 fields before reporting results, and
    if it sees any filed with a value greater than 200/256 delay
    (reported as half-cycle = 0x1 and ABS_OFFSET > 0x48), the DDR
    Stress test will reset the Write Leveling delay for this lane
    to 0x000 and not report it in the log.

    The reason that the DDR Stress test does this is because a delay
    of more than 78% a clock cycle means that the DQS edge is arriving
    within the JEDEC tolerence of 25% of the clock edge. In most cases,
    DQS is arriving < 5% tCK of the SDCLK edge in the early case, and
    it does not make sense to delay the DQS strobe almost a full clock
    cycle and add extra latency to each Write burst just to make the
    two edges align exactly. In this case, we are guilty of making a
    decision for the customer without telling them we are doing it so
    that we don't have to provide the above explanation to every customer.
    They don't need to know it.
    "

This patch adds the correction described above, that is if the MPWLDECTRx
value is over 0x148, the value is corrected back to 0x0.

[1] https://community.nxp.com/thread/456246

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
2018-04-15 11:39:23 +02:00
..
cpu drivers: i2c: mxc: Update SYS_I2C_MXC_I2C support in Kconfig 2018-03-29 17:20:42 +02:00
dts ARM: dts: imx6ull: add wdog3 2018-03-29 17:29:11 +02:00
include imx7: Add src_base structure define macro 2018-03-29 17:32:52 +02:00
lib libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h> 2018-03-05 10:16:28 -05:00
mach-aspeed aspeed: Refactor SCU to use consistent mask & shift 2017-05-08 11:57:35 -04:00
mach-at91 spl: eMMC/SD: Provide one __weak spl_boot_mode() function 2018-02-07 22:06:18 -05:00
mach-bcm283x bcm283x: Add pinctrl driver 2018-01-28 12:27:32 -05:00
mach-davinci spl: eMMC/SD: Provide one __weak spl_boot_mode() function 2018-02-07 22:06:18 -05:00
mach-exynos usb: net: migrate USB Ethernet adapters to Kconfig 2017-09-08 10:23:00 -04:00
mach-highbank
mach-imx ARM: mx6: ddr: Add write leveling correction code 2018-04-15 11:39:23 +02:00
mach-integrator env: Convert CONFIG_ENV_IS_IN... to a choice 2017-08-15 20:50:01 -04:00
mach-keystone cmd: ti: Generalize cmd_ddr3 command 2018-01-19 15:49:26 -05:00
mach-kirkwood spi: Migrate CONFIG_KIRKWOOD_SPI to Kconfig 2018-02-13 23:01:44 -05:00
mach-meson libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h> 2018-03-05 10:16:28 -05:00
mach-mvebu libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h> 2018-03-05 10:16:28 -05:00
mach-omap2 libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h> 2018-03-05 10:16:28 -05:00
mach-orion5x spl: add hierarchical defaults for SPL_LDSCRIPT 2017-08-13 17:12:37 +02:00
mach-qemu ARM: qemu-arm: Add support for AArch64 2018-01-19 15:49:30 -05:00
mach-rmobile ARM: rmobile: Add R8A77965 M3N IDs 2018-03-05 10:59:37 +01:00
mach-rockchip rockchip: rk3288: Fix wrong TPL_TEXT_BASE 2018-02-24 18:47:23 +01:00
mach-s5pc1xx
mach-snapdragon db820c: add qualcomm dragonboard 820C support 2018-01-15 16:29:02 -05:00
mach-socfpga libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h> 2018-03-05 10:16:28 -05:00
mach-sti board: Add STMicroelectronics STiH410-B2260 support 2017-03-14 20:40:21 -04:00
mach-stm32 board: stm32: Fix stm32f746-disco boot 2018-01-29 12:48:30 -05:00
mach-sunxi spl: eMMC/SD: Provide one __weak spl_boot_mode() function 2018-02-07 22:06:18 -05:00
mach-tegra aes: Allow non-zero initialization vector 2018-01-29 12:50:13 -05:00
mach-uniphier libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h> 2018-03-05 10:16:28 -05:00
mach-versatile
mach-zynq mmc: Added Kconfig support for CONFIG_ZYNQ_SDHCI_MAX_FREQ 2018-03-01 16:44:10 +01:00
thumb1/include/asm/proc-armv
config.mk binman: arm: Include the binman symbol table 2017-12-12 19:53:45 -07:00
Kconfig ARM: Kconfig: Move TI_SECURE_DEVICE to a common area 2018-02-23 10:21:41 -05:00
Kconfig.debug
Makefile imx: add i.MX8M into Kconfig 2018-02-04 12:00:58 +01:00