AnsweredAssumed Answered

imx8mq GA release: DDR initialization in ATF

Question asked by KENT MEYER on Apr 16, 2018
Latest reply on Apr 22, 2018 by Yuri Muhin


We are porting our changes in U-Boot to the GA release branch. We have some problems
with the bl31.bin ATF binary (imx-atf Yocto package).
Our U-Boot version linked together with bl31.bin built from the GA release, doesn't boot.
It hangs in the SPL stage:

U-Boot SPL 2017.03-00872-g21de0e642c (Apr 06 2018 - 14:39:28)
Normal Boot
Trying to boot from MMC2


As we found, the reason of the hang is the LPDDR4 initialization code appeared in
the GA version, eg the following commit:


commit d2cbb20898f2d50d338c36bb594dfbffc68d6288
Author: Bai Ping <>
Date:   Mon Feb 12 12:37:35 2018 +0800


    plat: imx8mq: update the lpddr4 dvfs and retention flow
    Update the ddr retenton flow and dvfs flow used on imx8mq lpddr4 board.
    1. DVFS flow is changed from hwffc to swffc.
    2. frequency setpoint is change from 100mts to 667mts.
    3. ddr retention flow is updated to compatible with the new lpddr4 training fw.
    4. fix the retention failure issue caused by incorrect reset flow in retention exit.
    Signed-off-by: Bai Ping <>
    (cherry picked from commit 276520cc05e6bc76222761980d685b09b00dd411)


On the higher level, this commit adds the following call to the LPDDR4 initialization:

--- a/plat/freescale/imx8mq/imx8m_bl31_setup.c
+++ b/plat/freescale/imx8mq/imx8m_bl31_setup.c
@@ -315,7 +315,7 @@ void bl31_platform_setup(void)
+      /* switch DDR frequency to 3200 mts */
+      lpddr4_switch_to_3200();  }


With the call to lpddr4_switch_to_3200() commented out above, our U-Boot is able to
load the kernel.


In the BSP Porting Guide, there is no mention of the changes needed to be done in imx-atf for
a custom board. Moreover, as we see, there is duplicated code present in U-Boot for NXP EVK
and in imx-atf, eg lpddr4_800M_cfg_phy() in U-Boot and phy_cfg_before_csr_restore()
in imx-atf, or lpddr4_800MHz_cfg_umctl2() in U-Boot and lpddr4_cfg_umctl2() in imx-atf.


Could please someone explain the reasons why the board-specific LPDDR initialization code was
added to imx-atf?

Should we do the same with our LPDDR4 initialization code or it is OK to leave
lpddr4_switch_to_3200() in imx-atf commented out for our board? Note that Emcraft board
uses LPDDR4 of different model, so lowlevel initialization differ from the one of NXP EVK.