AnsweredAssumed Answered

How to get discrete DDR4 parameters for custom LS1046A board

Question asked by 文炳 项 on Feb 16, 2020
Latest reply on Feb 27, 2020 by Yiping Wang

@Hi all,
We designed a custom LS1046A board with 4GB DDR4,which use 4 NT5AD512M16A4-HRI(512MBx16).
The data bus is 64bits. And we use layerscape SDK 19.09, so we need modify the DDR initialization code in ATF component。
We defined CONFIG_STATIC_DDR, and try to figure out the struct ddr_cfg_regs from CodeWarrior DDR configuration tool.
When creating the project, we chose Auto configuration mode, Discrete DRAM, and slect 1600MT/s for test, the skews between CKL and DQS is got from PCB tool.
After enter Component Inspector page, we change the DQ mapping with Default,according with the schematic. The DQ pins didn't swap.


Keeping other parameters with the tools giving.
The following log is SD boot log.
There are 2 error:
1. DDR registers wirte error with Waiting for D_INIT timeout.
2. SD read error - DMA error = 10000000 in bl2 phase.

We dosen't have the hardware tools for DDR validation.
So how can we get the right DDR controller registers value without DDR validation? Anyone have some idea?
<QCVS DDR Tool User Guide> mentioned "Timing Configuration 1: Set four basic DDR timings: tCL, tRCD, tRP, tRAS specified usually as tCL-tRCD-tRP-
tRAS. Set rest of the parameters as per the datasheet of the DDR device." There are so many parameters in CodeWarrior, which are the important?
And in Error 2, the SD read error, what's the error code meaing?
By the way, we use custom RCW from CodeWarrior PLB configuration tool.

ATF LOG:
plat/nxp/soc-ls1046/soc.c get_boot_dev:374 INFO: RCW BOOT SRC is SD/EMMC
plat/nxp/soc-ls1046/soc.c get_boot_dev:374 INFO: RCW BOOT SRC is SD/EMMC
plat/nxp/drivers/sd/sd_mmc.c sd_mmc_init:1168 INFO: esdhc_emmc_init
plat/nxp/drivers/sd/sd_mmc.c esdhc_init:155 INFO: Card detected successfully
plat/nxp/drivers/sd/sd_mmc.c esdhc_emmc_init:1135 INFO: init done:
plat/nxp/soc-ls1046/ls1046ahtgw/ddr_init.c _init_ddr:390 INFO: platform clock 600000000
plat/nxp/soc-ls1046/ls1046ahtgw/ddr_init.c _init_ddr:391 INFO: DDR PLL1 2100000000
plat/nxp/soc-ls1046/ls1046ahtgw/ddr_init.c _init_ddr:392 INFO: DDR PLL2 0
plat/nxp/drivers/ddr/nxp-ddr/ddr.c dram_init:888 INFO: Time before programming controller 0 ms
plat/nxp/drivers/ddr/nxp-ddr/ddr.c dram_init:889 INFO: Program controller registers
plat/nxp/drivers/ddr/nxp-ddr/ddrc.c ddrc_set_regs:364 WARNING: Warning: Optimal CPO value not set.
plat/nxp/drivers/ddr/nxp-ddr/ddrc.c ddrc_set_regs:455 INFO: total size 4 GB
plat/nxp/drivers/ddr/nxp-ddr/ddrc.c ddrc_set_regs:456 INFO: Need to wait up to 1000 ms
plat/nxp/drivers/ddr/nxp-ddr/ddrc.c ddrc_set_regs:468 ERROR: Error: Waiting for D_INIT timeout.
plat/nxp/drivers/ddr/nxp-ddr/ddr.c write_ddrc_regs:817 ERROR: Writing DDR register(s) failed
plat/nxp/drivers/ddr/nxp-ddr/ddr.c dram_init:892 ERROR: Programing DDRC error
plat/nxp/soc-ls1046/ls1046ahtgw/ddr_init.c _init_ddr:404 ERROR: DDR init failed.
plat/nxp/common/ls_bl2_el3_setup.c populate_dram_regions_info:58 NOTICE: Incorrect DRAM0 size is defined in platfor_def.h
lib/xlat_tables_v2/xlat_tables_internal.c mmap_add_region_ctx:752 ERROR: mmap_add_region_check() failed. error -22
lib/xlat_tables_v2/xlat_tables_internal.c mmap_add_region_ctx:752 ERROR: mmap_add_region_check() failed. error -22
bl2/bl2_main.c bl2_main:32 WARNING: test
bl2/bl2_main.c bl2_main:32 INFO: test
bl2/bl2_main.c bl2_main:33 NOTICE: BL2: v1.5(release):LSDK-19.09-dirty
bl2/bl2_main.c bl2_main:34 NOTICE: BL2: Built : 16:53:17, Feb 14 2020
bl2/bl2_main.c bl2_main:38 NOTICE: BL2: bl2_arch_setup
plat/nxp/soc-ls1046/soc.c mem_access_setup:232 INFO: Configuring TrustZone Controller
drivers/arm/tzc/tzc400.c tzc400_configure_region:189 INFO: Value of region base = 7fdffffb
drivers/arm/tzc/tzc400.c tzc400_configure_region:189 INFO: Value of region base = 7ffffffb
drivers/arm/tzc/tzc400.c tzc400_configure_region:189 INFO: Value of region base = fbdffffb
bl2/bl2_main.c bl2_main:46 NOTICE: BL2: bl2_plat_preload_setup
bl2/bl2_image_load_v2.c bl2_load_images:36 NOTICE: BL2: plat_get_bl_image_load_info
bl2/bl2_image_load_v2.c bl2_load_images:53 INFO: BL2: Doing platform setup
bl2/bl2_image_load_v2.c bl2_load_images:55 NOTICE: BL2: bl2_platform_setup
bl2/bl2_image_load_v2.c bl2_load_images:61 NOTICE: BL2: bl2_plat_handle_pre_image_load
bl2/bl2_image_load_v2.c bl2_load_images:68 INFO: BL2: Loading image id 3
plat/nxp/drivers/sd/sd_mmc.c esdhc_read_data_dma:611 ERROR: SD read error - DMA error = 10000000
plat/nxp/drivers/sd/sd_mmc.c esdhc_read:1302 ERROR: Read error = fffffffb
common/bl_common.c load_image:229 WARNING: Failed to obtain reference to image id=3 (-2)
bl2/bl2_image_load_v2.c bl2_load_images:71 NOTICE: BL2: load_auth_image
bl2/bl2_image_load_v2.c bl2_load_images:73 ERROR: BL2: Failed to load image (-2)
Authentication failure

 

The attachments are the rcw file and DDR controller registers from Codewarrior.

welcome for any comments . TKS!

Outcomes