This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62-LP: how to issue MRW command to lpddr4 device?

Part Number: SK-AM62-LP
Other Parts Discussed in Thread: SYSCONFIG

Hello,

My SDK is ti-processor-sdk-linux-am62xx-evm-09.01.00.08. I haven't found MRW(Mode Register Write) command to lpddr4 from the u-boot directory. ( ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732 )

Please let me know which c file can support the function.

Thanks.

  • You should be able to use setmmrregister() and getmmrregister() in lpddr4.c

    Regards,

    james

  • Hello James,

    Thank you for your help. I want to execute the functions in cmd/mem.c. So, #include "../drivers/ram/k3-ddrss/lpddr4.h" was added to mem.c. However, the compilation still shows the error as below. Could you help me to overcome this error? 

    Thanks.

    Using /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732 as source for U-Boot
    CC cmd/version.o
    CC cmd/mem.o
    In file included from /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/mem.c:34:
    /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/../drivers/ram/k3-ddrss/lpddr4.h:12:10: fatal error: lpddr4_ctl_regs.h: No such file or directory
    12 | #include "lpddr4_ctl_regs.h"
    | ^~~~~~~~~~~~~~~~~~~
    compilation terminated.

  • Jeff, i think you would either have to add the directory for the file in your include directories in the build, or add the full path to the *.h file in the #include statement.

    Regards,

    James

  • James, using the full path in the #include statement had the same issue. could you let me know a little more detail for the other method?

  • can you provide the full log of your build process?  What commands are you using to build the code?

    Regards,

    James

  • James, please refer to the below build log. Thanks.


    ubuntu@ubuntu-virtual-machine:~/ti-processor-sdk-linux-am62xx-evm-09.01.00.08$ make u-boot PLATFORM=am62xx-lp-evm
    ===================================
    Building U-boot for R5
    ===================================
    mkdir -p /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make -j 2 -C /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot* ARCH=arm am62x_lpsk_r5_defconfig O=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make[1]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make[2]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    GEN Makefile
    #
    # configuration written to .config
    #
    make[2]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    make[1]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make -j 2 -C /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot* ARCH=arm CROSS_COMPILE=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi- \
    BINMAN_INDIRS=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/prebuilt-images/am62xx-lp-evm O=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make[1]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make[2]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    GEN Makefile
    scripts/kconfig/conf --syncconfig Kconfig
    CFG u-boot.cfg
    GEN include/autoconf.mk.dep
    CFG spl/u-boot.cfg
    GEN include/autoconf.mk
    GEN spl/include/autoconf.mk
    GEN Makefile
    UPD include/generated/timestamp_autogenerated.h
    ENVC include/generated/env.txt
    ENVP include/generated/env.in
    ENVT include/generated/environment.h
    Using /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732 as source for U-Boot
    CC cmd/version.o
    CC cmd/mem.o
    In file included from /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/mem.c:35:
    /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/../drivers/ram/k3-ddrss/lpddr4.h:12:10: fatal error: lpddr4_ctl_regs.h: No such file or directory
    12 | #include "lpddr4_ctl_regs.h"
    | ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[3]: *** [/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/scripts/Makefile.build:256: cmd/mem.o] Error 1
    make[2]: *** [/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/Makefile:1847: cmd] Error 2
    make[2]: *** Waiting for unfinished jobs....
    make[2]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    make[1]: *** [Makefile:177: sub-make] Error 2
    make[1]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make: *** [makerules/Makefile_u-boot:28: u-boot-r5] Error 2

  • What if you try this?

    #include <../drivers/ram/k3-ddrss/am64/lpddr4_ctl_regs.h>

    Regards,

    James

  • James, I added the #include statement in the mem.c file as below. However, it still has the compilation error. Thanks.

    #include "../drivers/ram/k3-ddrss/lpddr4.h"

    #include "../drivers/ram/k3-ddrss/am64/lpddr4_ctl_regs.h"
    "board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/mem.c" line 2 of 2003 --0%-- col 1

    ubuntu@ubuntu-virtual-machine:~/ti-processor-sdk-linux-am62xx-evm-09.01.00.08$ make u-boot PLATFORM=am62xx-lp-evm
    ===================================
    Building U-boot for R5
    ===================================
    mkdir -p /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make -j 2 -C /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot* ARCH=arm am62x_lpsk_r5_defconfig O=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make[1]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make[2]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    GEN Makefile
    #
    # configuration written to .config
    #
    make[2]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    make[1]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make -j 2 -C /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot* ARCH=arm CROSS_COMPILE=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi- \
    BINMAN_INDIRS=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/prebuilt-images/am62xx-lp-evm O=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make[1]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make[2]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    GEN Makefile
    scripts/kconfig/conf --syncconfig Kconfig
    CFG u-boot.cfg
    GEN include/autoconf.mk.dep
    CFG spl/u-boot.cfg
    GEN include/autoconf.mk
    GEN spl/include/autoconf.mk
    GEN Makefile
    UPD include/generated/timestamp_autogenerated.h
    ENVC include/generated/env.txt
    ENVP include/generated/env.in
    ENVT include/generated/environment.h
    Using /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732 as source for U-Boot
    CC cmd/version.o
    CC cmd/mem.o
    In file included from /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/mem.c:34:
    /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/../drivers/ram/k3-ddrss/lpddr4.h:12:10: fatal error: lpddr4_ctl_regs.h: No such file or directory
    12 | #include "lpddr4_ctl_regs.h"
    | ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[3]: *** [/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/scripts/Makefile.build:257: cmd/mem.o] Error 1
    make[2]: *** [/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/Makefile:1847: cmd] Error 2
    make[2]: *** Waiting for unfinished jobs....
    make[2]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    make[1]: *** [Makefile:177: sub-make] Error 2
    make[1]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make: *** [makerules/Makefile_u-boot:28: u-boot-r5] Error 2

  • Hi Jeff, i made the same changes, but i don't seem to get that compilation error.  Can you perform a 'git diff' at the uboot directory and send me the results.  Just want to make sure i have all of the same changes you are making.

    Regards,

    James

  • Hi James, that's strange. My git diff and build error messages are attached.

    ubuntu@ubuntu-virtual-machine:~/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732$ git status
    On branch ti-u-boot-2023.04
    Your branch is up to date with 'origin/ti-u-boot-2023.04'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   arch/arm/dts/k3-am62-r5-lp-sk.dts
    	modified:   arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi
    	modified:   arch/arm/dts/k3-am62x-sk-common.dtsi
    	modified:   board/ti/am62x/evm.c
    	modified:   cmd/mem.c
    	modified:   include/configs/am62x_evm.h
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    	arch/arm/dts/k3-am62-r5-lp-sk.dts.original
    	arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi.4Gb
    	arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi.original
    	arch/arm/dts/k3-am62x-sk-common.dtsi.original
    	board/ti/am62x/evm.c.original
    	cmd/mem.c.new
    	cmd/mem.c.original
    	include/configs/am62x_evm.h.original
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    ubuntu@ubuntu-virtual-machine:~/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732$ git diff | cat
    warning: CRLF will be replaced by LF in arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi.
    The file will have its original line endings in your working directory
    diff --git a/arch/arm/dts/k3-am62-r5-lp-sk.dts b/arch/arm/dts/k3-am62-r5-lp-sk.dts
    index 2c3196a4a8..995a9255c7 100644
    --- a/arch/arm/dts/k3-am62-r5-lp-sk.dts
    +++ b/arch/arm/dts/k3-am62-r5-lp-sk.dts
    @@ -22,8 +22,8 @@
     
     	memory@80000000 {
     		device_type = "memory";
    -		/* 2G RAM */
    -		reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
    +		/* 512MB RAM */
    +		reg = <0x00000000 0x80000000 0x00000000 0x20000000>;
     		bootph-pre-ram;
     	};
     };
    diff --git a/arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi b/arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi
    index 74693d12e1..f5415d4ffa 100644
    --- a/arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi
    +++ b/arch/arm/dts/k3-am62x-ddr-lp4-50-800-800.dtsi
    @@ -1,17 +1,21 @@
     // SPDX-License-Identifier: GPL-2.0+
     /*
      * This file was generated with the
    - * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.08.61
    - * Tue Mar 22 2022 17:03:08 GMT-0500 (Central Daylight Time)
    + * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.10.01
    + * Thu Mar 14 2024 11:07:39 GMT+0800 (Taipei Standard Time)
      * DDR Type: LPDDR4
    - * F0 = 50MHz    F1 = 800MHz    F2 = 800MHz
    - * Density (per channel): 16Gb
    + * F0 = 50MHz    F1 = NA     F2 = 800MHz
    + * Density (per channel): 4Gb
    + * Write DBI: Enable
      * Number of Ranks: 1
    - */
    +*/
     
    -#define DDRSS_PLL_FHS_CNT 6
    +
    +#define DDRSS_PLL_FHS_CNT 3
     #define DDRSS_PLL_FREQUENCY_1 400000000
     #define DDRSS_PLL_FREQUENCY_2 400000000
    +#define DDRSS_SDRAM_IDX 13
    +
     
     #define DDRSS_CTL_0_DATA 0x00000B00
     #define DDRSS_CTL_1_DATA 0x00000000
    @@ -283,10 +287,10 @@
     #define DDRSS_CTL_267_DATA 0x0000000F
     #define DDRSS_CTL_268_DATA 0x0000000F
     #define DDRSS_CTL_269_DATA 0x00000000
    -#define DDRSS_CTL_270_DATA 0x00000000
    +#define DDRSS_CTL_270_DATA 0x00001000
     #define DDRSS_CTL_271_DATA 0x00000015
     #define DDRSS_CTL_272_DATA 0x00000015
    -#define DDRSS_CTL_273_DATA 0x00000000
    +#define DDRSS_CTL_273_DATA 0x00000010
     #define DDRSS_CTL_274_DATA 0x00000015
     #define DDRSS_CTL_275_DATA 0x00000015
     #define DDRSS_CTL_276_DATA 0x00000020
    @@ -330,11 +334,11 @@
     #define DDRSS_CTL_314_DATA 0x00280028
     #define DDRSS_CTL_315_DATA 0x00000100
     #define DDRSS_CTL_316_DATA 0x01010000
    -#define DDRSS_CTL_317_DATA 0x00000000
    -#define DDRSS_CTL_318_DATA 0x3FFF0000
    +#define DDRSS_CTL_317_DATA 0x00000202
    +#define DDRSS_CTL_318_DATA 0x0FFF0000
     #define DDRSS_CTL_319_DATA 0x000FFF00
     #define DDRSS_CTL_320_DATA 0xFFFFFFFF
    -#define DDRSS_CTL_321_DATA 0x000FFF00
    +#define DDRSS_CTL_321_DATA 0x00FFFF00
     #define DDRSS_CTL_322_DATA 0x0B000000
     #define DDRSS_CTL_323_DATA 0x0001FFFF
     #define DDRSS_CTL_324_DATA 0x01010101
    @@ -448,7 +452,7 @@
     #define DDRSS_PI_9_DATA 0x00000000
     #define DDRSS_PI_10_DATA 0x00000000
     #define DDRSS_PI_11_DATA 0x00000002
    -#define DDRSS_PI_12_DATA 0x00000007
    +#define DDRSS_PI_12_DATA 0x00000005
     #define DDRSS_PI_13_DATA 0x00010001
     #define DDRSS_PI_14_DATA 0x08000000
     #define DDRSS_PI_15_DATA 0x00010300
    @@ -479,7 +483,7 @@
     #define DDRSS_PI_40_DATA 0x000000A9
     #define DDRSS_PI_41_DATA 0x000000A9
     #define DDRSS_PI_42_DATA 0x000000B5
    -#define DDRSS_PI_43_DATA 0x01000000
    +#define DDRSS_PI_43_DATA 0x00000000
     #define DDRSS_PI_44_DATA 0x00000000
     #define DDRSS_PI_45_DATA 0x00010100
     #define DDRSS_PI_46_DATA 0x00000015
    @@ -507,13 +511,13 @@
     #define DDRSS_PI_68_DATA 0x00000034
     #define DDRSS_PI_69_DATA 0x00000000
     #define DDRSS_PI_70_DATA 0x00000000
    -#define DDRSS_PI_71_DATA 0x0001FFFF
    +#define DDRSS_PI_71_DATA 0x0000FFFF
     #define DDRSS_PI_72_DATA 0x00000000
     #define DDRSS_PI_73_DATA 0x00000000
     #define DDRSS_PI_74_DATA 0x00000000
     #define DDRSS_PI_75_DATA 0x00000000
     #define DDRSS_PI_76_DATA 0x01000000
    -#define DDRSS_PI_77_DATA 0x08000100
    +#define DDRSS_PI_77_DATA 0x08020100
     #define DDRSS_PI_78_DATA 0x00020000
     #define DDRSS_PI_79_DATA 0x00010002
     #define DDRSS_PI_80_DATA 0x00000001
    @@ -740,7 +744,7 @@
     #define DDRSS_PI_301_DATA 0x00000000
     #define DDRSS_PI_302_DATA 0x00000000
     #define DDRSS_PI_303_DATA 0x00000000
    -#define DDRSS_PI_304_DATA 0x00000F27
    +#define DDRSS_PI_304_DATA 0x00100F27
     #define DDRSS_PI_305_DATA 0x00000000
     #define DDRSS_PI_306_DATA 0x00000024
     #define DDRSS_PI_307_DATA 0x00000012
    @@ -764,7 +768,7 @@
     #define DDRSS_PI_325_DATA 0x00000000
     #define DDRSS_PI_326_DATA 0x00000000
     #define DDRSS_PI_327_DATA 0x00000000
    -#define DDRSS_PI_328_DATA 0x00000F27
    +#define DDRSS_PI_328_DATA 0x00100F27
     #define DDRSS_PI_329_DATA 0x00000000
     #define DDRSS_PI_330_DATA 0x00000024
     #define DDRSS_PI_331_DATA 0x00000012
    @@ -901,7 +905,7 @@
     #define DDRSS_PHY_117_DATA 0x00800080
     #define DDRSS_PHY_118_DATA 0x00800080
     #define DDRSS_PHY_119_DATA 0x01800080
    -#define DDRSS_PHY_120_DATA 0x01A00001
    +#define DDRSS_PHY_120_DATA 0x01000000
     #define DDRSS_PHY_121_DATA 0x00000000
     #define DDRSS_PHY_122_DATA 0x00000000
     #define DDRSS_PHY_123_DATA 0x00080200
    @@ -1157,7 +1161,7 @@
     #define DDRSS_PHY_373_DATA 0x00800080
     #define DDRSS_PHY_374_DATA 0x00800080
     #define DDRSS_PHY_375_DATA 0x01800080
    -#define DDRSS_PHY_376_DATA 0x01A00001
    +#define DDRSS_PHY_376_DATA 0x01000000
     #define DDRSS_PHY_377_DATA 0x00000000
     #define DDRSS_PHY_378_DATA 0x00000000
     #define DDRSS_PHY_379_DATA 0x00080200
    @@ -2152,7 +2156,7 @@
     #define DDRSS_PHY_1368_DATA 0x00000002
     #define DDRSS_PHY_1369_DATA 0x00000000
     #define DDRSS_PHY_1370_DATA 0x00000000
    -#define DDRSS_PHY_1371_DATA 0x0001F7C0
    +#define DDRSS_PHY_1371_DATA 0x0001F7C2
     #define DDRSS_PHY_1372_DATA 0x00020002
     #define DDRSS_PHY_1373_DATA 0x00000000
     #define DDRSS_PHY_1374_DATA 0x00001142
    @@ -2180,11 +2184,10 @@
     #define DDRSS_PHY_1396_DATA 0x0089FF00
     #define DDRSS_PHY_1397_DATA 0x000C3F11
     #define DDRSS_PHY_1398_DATA 0x01990000
    -#define DDRSS_PHY_1399_DATA 0x000C3F11
    +#define DDRSS_PHY_1399_DATA 0x000C3F91
     #define DDRSS_PHY_1400_DATA 0x01990000
     #define DDRSS_PHY_1401_DATA 0x3F0DFF11
    -#define DDRSS_PHY_1402_DATA 0x019900E0
    +#define DDRSS_PHY_1402_DATA 0x01990000
     #define DDRSS_PHY_1403_DATA 0x00018011
     #define DDRSS_PHY_1404_DATA 0x0089FF00
     #define DDRSS_PHY_1405_DATA 0x20040004
    -
    diff --git a/arch/arm/dts/k3-am62x-sk-common.dtsi b/arch/arm/dts/k3-am62x-sk-common.dtsi
    index 49f3c280e0..23f0532e3a 100644
    --- a/arch/arm/dts/k3-am62x-sk-common.dtsi
    +++ b/arch/arm/dts/k3-am62x-sk-common.dtsi
    @@ -31,7 +31,7 @@
     	memory@80000000 {
     		device_type = "memory";
     		/* 2G RAM */
    -		reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
    +		reg = <0x00000000 0x80000000 0x00000000 0x20000000>;
     
     	};
     
    diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
    index d84c85b122..7673348a98 100644
    --- a/board/ti/am62x/evm.c
    +++ b/board/ti/am62x/evm.c
    @@ -166,6 +166,8 @@ static void fixup_ddr_driver_for_ecc(struct spl_image_info *spl_image)
     	ret = k3_ddrss_ddr_fdt_fixup(dev, spl_image->fdt_addr, gd->bd);
     	if (ret)
     		printf("Error fixing up ddr node for ECC use! %d\n", ret);
    +
    +	printf("dram_init done in fixup_ddr_driver_for_ecc!\n");
     }
     #else
     static void fixup_memory_node(struct spl_image_info *spl_image)
    @@ -188,6 +190,8 @@ static void fixup_memory_node(struct spl_image_info *spl_image)
     				     CONFIG_NR_DRAM_BANKS);
     	if (ret)
     		printf("Error fixing up memory node! %d\n", ret);
    +
    +	printf("dram_init done in fixup_memory_node!\n");
     }
     #endif
     
    diff --git a/cmd/mem.c b/cmd/mem.c
    index 66c2d36a14..09f357d5c0 100644
    --- a/cmd/mem.c
    +++ b/cmd/mem.c
    @@ -31,6 +31,8 @@
     #include <linux/compiler.h>
     #include <linux/ctype.h>
     #include <linux/delay.h>
    +#include "../drivers/ram/k3-ddrss/am64/lpddr4_ctl_regs.h"
    +#include "../drivers/ram/k3-ddrss/lpddr4.h"
     
     DECLARE_GLOBAL_DATA_PTR;
     
    diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h
    index ff369e907d..a863a324be 100644
    --- a/include/configs/am62x_evm.h
    +++ b/include/configs/am62x_evm.h
    @@ -14,6 +14,11 @@
     /* DDR Configuration */
     #define CFG_SYS_SDRAM_BASE1             0x880000000
     
    +#define CONFIG_CMD_MEMTEST
    +#define CONFIG_SYS_ALT_MEMTEST
    +#define CONFIG_SYS_MEMTEST_START   0x880000000
    +#define CONFIG_SYS_MEMTEST_END     0x890000000
    +
     /* Now for the remaining common defines */
     #include <configs/ti_armv7_common.h>
    
    ubuntu@ubuntu-virtual-machine:~/ti-processor-sdk-linux-am62xx-evm-09.01.00.08$ make u-boot PLATFORM=am62xx-lp-evm
    ===================================
    Building U-boot for R5
    ===================================
    mkdir -p /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make -j 2 -C /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot* ARCH=arm am62x_lpsk_r5_defconfig O=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make[1]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make[2]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
      GEN     Makefile
    #
    # configuration written to .config
    #
    make[2]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    make[1]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make -j 2 -C /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot* ARCH=arm CROSS_COMPILE=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi- \
    	BINMAN_INDIRS=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/prebuilt-images/am62xx-lp-evm  O=/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5
    make[1]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make[2]: Entering directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
      GEN     Makefile
    scripts/kconfig/conf  --syncconfig Kconfig
      CFG     u-boot.cfg
      GEN     include/autoconf.mk.dep
      CFG     spl/u-boot.cfg
      GEN     include/autoconf.mk
      GEN     spl/include/autoconf.mk
      GEN     Makefile
      UPD     include/generated/timestamp_autogenerated.h
      ENVC    include/generated/env.txt
      Using /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732 as source for U-Boot
      ENVP    include/generated/env.in
      ENVT    include/generated/environment.h
      CC      board/ti/am62x/evm.o
      CC      cmd/version.o
      AR      board/ti/am62x/built-in.o
      CC      cmd/mem.o
    In file included from /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/mem.c:35:
    /home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/cmd/../drivers/ram/k3-ddrss/lpddr4.h:12:10: fatal error: lpddr4_ctl_regs.h: No such file or directory
       12 | #include "lpddr4_ctl_regs.h"
          |          ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[3]: *** [/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/scripts/Makefile.build:257: cmd/mem.o] Error 1
    make[2]: *** [/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732/Makefile:1847: cmd] Error 2
    make[2]: *** Waiting for unfinished jobs....
    make[2]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/u-boot-build/r5'
    make[1]: *** [Makefile:177: sub-make] Error 2
    make[1]: Leaving directory '/home/ubuntu/ti-processor-sdk-linux-am62xx-evm-09.01.00.08/board-support/ti-u-boot-2023.04+gitAUTOINC+b0d717b732-gb0d717b732'
    make: *** [makerules/Makefile_u-boot:28: u-boot-r5] Error 2
    

  • Hi James, did you have a chance to review the git diff results? I think the modified codes on other files are not related to the compilation error.

  • Jeff, sorry for the long delay here.  Our u-boot is split across 2 processors, so during the build, there is a build for R5 and A53.  The error in the build you are seeing is occurring in the A53 build, because the DDR driver is never used in A53.  

    I think what you are trying to do is create u-boot commands to access DDR registers.  I think the best way to do this is to perform direct accesses to the DDR register memory, that way you don't need to rely on the DDR driver.  

    For this, you can use readl() and writel() functions to read/write registers directly.  For example, to write and read MR14:

    writel(0x0F3082F0, 0x0080000E);  //CTL_188 WRITE_MODEREG

    writel(0x0F308378, data);  //CTL_222 MRSINGLE_DATA
    writel(0x0F3082F0, 0x0280000E); //set bit 25 of WRITE_MODEREG to write


    //readback
    writel(0x0F3082F4, 0x00000E00 ); //CTL_189 READ_MODEREG
    writel(0x0F3082F4, 0x01000E00 ); //trigger read
    temp = readl(0x0F3082F8);  //CTL_190 PERIPHERAL_MRR_DATA

    Regards,

    James

  • James, thank you for the solution. However, u-boot crashes with mtest command after adding the writel and readl commands. I tried 16.0% DQ VREF of MR14 as the SysConfig default value as below.

    [ Code Added ]

    printf("\n\nIteration: %6d\r\n", iteration + 1);

    writel(0x0F3082F0, 0x0080000E); //CTL_188 WRITE_MODEREG
    writel(0x0F308378, 0x0F); //CTL_222 MRSINGLE_DATA(Range[0], 001111B:16.0%)
    writel(0x0F3082F0, 0x0280000E); //set bit 25 of WRITE_MODEREG to write

    writel(0x0F3082F4, 0x00000E00 ); //CTL_189 READ_MODEREG
    writel(0x0F3082F4, 0x01000E00 ); //trigger read
    temp = readl(0x0F3082F8); //CTL_190 PERIPHERAL_MRR_DATA
    printf("\n\nMRR value: %X\r", temp);

    [U-boot crash at mtest command ]

    =>
    => mtest 0x80000000 0x98000000 1
    Testing 80000000 ... 98000000:


    Iteration: ÿ
    U-Boot SPL 2023.04-dirty (Apr 26 2024 - 16:22:24 +0800)
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.1.8--v09.01.08 (Kool Koala)')
    SPL initial stack usage: 13384 bytes

  • Jeff, u-boot executes out of DDR, so if you change anything on the fly like VREF, it may fail.  I guess let me ask overall what are you trying to do?

    Regards,

    James

  • James, the mem.c file includes a for loop to iterate the memory tests at a fixed condition. I'd like to change the MR14 or other MR registers in the interation loop to see the effect. 

    Thanks,

    Jeff

  • James, I tried to exchange the 1st argument and the 2nd argument of the writel function as below. The u-boot is not crashing. However, the MRR doesn't return the correct value (0x0F).

    • modified code

    for (iteration = 0; !iteration_limit || iteration < iteration_limit; iteration++) {
    if (ctrlc()) {
    errs = -1UL;
    break;
    }

    printf("\n\nIteration: %6d\r\n", iteration + 1);

    writel(0x0080000E, 0x0F3082F0); //CTL_188 WRITE_MODEREG
    writel(0x0000000F, 0x0F308378); //CTL_222 MRSINGLE_DATA(Range[0], 001111B:16.0%)
    writel(0x0280000E, 0x0F3082F0); //set bit 25 of WRITE_MODEREG to write

    writel(0x00000E00, 0x0F3082F4); //CTL_189 READ_MODEREG
    writel(0x01000E00, 0x0F3082F4); //trigger read
    temp = readl(0x0F3082F8); //CTL_190 PERIPHERAL_MRR_DATA
    udelay(1000000); //wait 1sec
    printf("\n\nMRR value: %X\r", temp);

    • test result

    => mtest 0x80000000 0x98000000 1
    Testing 80000000 ... 98000000:


    Iteration: 1


    MRR value: 0

  • Jeff, sorry i got the parameter order wrong.  Have you confirmed you are writing the registers correctly?  

    The only other thing i can think of is to put a small delay between the read trigger and the readl() function.  I have gotten this sequence to work, but it was with a debugger script which would run much slower than u-boot.  That is why i'm thinking a delay may help.

    Regards,

    James

  • James, thank you. adding 1sec delay to both write trigger and read trigger made the MRR stable. btw, is there any kind of status register to check if the write register is completed? If so, I'd like to use a while loop to make sure the completion instead of the 1sec delay time.

  • Hi Jeff, you can check bit3 of int_status_mode parameter in CTL_343 at 0x0F30855C

    To clear this bit, write a 1 to int_ack_mode parameter in CTL_351 at 0x0F30857C

    Regards,

    James