[FAQ] AM6548: How to configure 512MB*2 DDR ram in uboot?

Part Number: AM6548

Hi Ti,

We will use AM6548 SR2.0 to bring up our evm board, and there will be 512MB*2, total is 1GB ddr4 in our evm.

In this case, we have two question want to confirm with you.

1. How to modify the memory region in k3-am654-board-board.dts? The SDK is default for 4G.

memory@80000000 {
device_type = "memory";
/* 4G RAM */
reg = <0x00000000 0x80000000 0x00000000 0x80000000>,
<0x00000008 0x80000000 0x00000000 0x80000000>;
};

2. In evm.c, we modify the ram_size as below, is that correct? I'm not sure if we need gd->bd->bi_dram[1] setting or not.

int dram_init(void)
{
#ifdef CONFIG_PHYS_64BIT
gd->ram_size = 0x40000000;//ERIC*
#else
gd->ram_size = 0x80000000;
#endif

return 0;
}

ulong board_get_usable_ram_top(ulong total_size)
{
#ifdef CONFIG_PHYS_64BIT
/* Limit RAM used by U-Boot to the DDR low region */
if (gd->ram_top > 0x40000000)
return 0x40000000;
#endif

return gd->ram_top;
}

int dram_init_banksize(void)
{
/* Bank 0 declares the memory available in the DDR low region */
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = 0x40000000;
gd->ram_size = 0x40000000;

#ifdef CONFIG_PHYS_64BIT
/* Bank 1 declares the memory available in the DDR high region */
gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE1;
gd->bd->bi_dram[1].size = 0x40000000;//ERIC*
gd->ram_size = 0x40000000;//ERIC*
#endif

return 0;
}

Please help this.

Thanks.

  • Hi Eric,

    Will this be contiguous 1GB space starting 0x80000000?

    Best Regards,
    Keerthy

  • Hi

    yes, it will be contiguous 1GB space. And the bandwidth is 16bit*2.

    Thanks.

    Eric

  • Hi Eric,

    Here is the diff with which i reduced AM654 memory to 1GB.

    am65-1gb-diff.txt
    diff --git a/arch/arm/dts/k3-am654-base-board.dts b/arch/arm/dts/k3-am654-base-board.dts
    index afa7b5a353..e13eac4c15 100644
    --- a/arch/arm/dts/k3-am654-base-board.dts
    +++ b/arch/arm/dts/k3-am654-base-board.dts
    @@ -24,9 +24,8 @@
     
     	memory@80000000 {
     		device_type = "memory";
    -		/* 4G RAM */
    -		reg = <0x00000000 0x80000000 0x00000000 0x80000000>,
    -		      <0x00000008 0x80000000 0x00000000 0x80000000>;
    +		/* 1G RAM */
    +		reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
     	};
     
     	reserved-memory {
    diff --git a/arch/arm/mach-k3/arm64-mmu.c b/arch/arm/mach-k3/arm64-mmu.c
    index a0da3df593..d708c97f70 100644
    --- a/arch/arm/mach-k3/arm64-mmu.c
    +++ b/arch/arm/mach-k3/arm64-mmu.c
    @@ -44,12 +44,6 @@ struct mm_region am654_mem_map[NR_MMU_REGIONS] = {
     		.size = 0x5df00000UL,
     		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
     			 PTE_BLOCK_INNER_SHARE
    -	}, {
    -		.virt = 0x880000000UL,
    -		.phys = 0x880000000UL,
    -		.size = 0x80000000UL,
    -		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
    -			 PTE_BLOCK_INNER_SHARE
     	}, {
     		.virt = 0x500000000UL,
     		.phys = 0x500000000UL,
    diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
    index 045a43c498..9b6c969528 100644
    --- a/board/ti/am65x/evm.c
    +++ b/board/ti/am65x/evm.c
    @@ -77,11 +77,7 @@ int board_init(void)
     
     int dram_init(void)
     {
    -#ifdef CONFIG_PHYS_64BIT
    -	gd->ram_size = 0x100000000;
    -#else
    -	gd->ram_size = 0x80000000;
    -#endif
    +	gd->ram_size = 0x40000000;
     
     	return 0;
     }
    @@ -101,15 +97,8 @@ int dram_init_banksize(void)
     {
     	/* Bank 0 declares the memory available in the DDR low region */
     	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
    -	gd->bd->bi_dram[0].size = 0x80000000;
    -	gd->ram_size = 0x80000000;
    -
    -#ifdef CONFIG_PHYS_64BIT
    -	/* Bank 1 declares the memory available in the DDR high region */
    -	gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE1;
    -	gd->bd->bi_dram[1].size = 0x80000000;
    -	gd->ram_size = 0x100000000;
    -#endif
    +	gd->bd->bi_dram[0].size = 0x40000000;
    +	gd->ram_size = 0x40000000;
     
     	return 0;
     }
    diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
    index 93e539aba5..a08889b5ff 100644
    --- a/configs/am65x_evm_a53_defconfig
    +++ b/configs/am65x_evm_a53_defconfig
    @@ -12,7 +12,7 @@ CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
     CONFIG_ENV_SIZE=0x20000
     CONFIG_ENV_OFFSET=0x680000
     CONFIG_SPL_STACK_R_ADDR=0x82000000
    -CONFIG_NR_DRAM_BANKS=2
    +CONFIG_NR_DRAM_BANKS=1
     CONFIG_SPL_FS_FAT=y
     CONFIG_SPL_LIBDISK_SUPPORT=y
     CONFIG_SPL_SPI_FLASH_SUPPORT=y
    diff --git a/include/configs/am65x_evm.h b/include/configs/am65x_evm.h
    index 41c62785e4..f7ca664cd9 100644
    --- a/include/configs/am65x_evm.h
    +++ b/include/configs/am65x_evm.h
    @@ -15,9 +15,6 @@
     #include <environment/ti/k3_rproc.h>
     #include <environment/ti/k3_dfu.h>
     
    -/* DDR Configuration */
    -#define CONFIG_SYS_SDRAM_BASE1		0x880000000
    -
     /* SPL Loader Configuration */
     #ifdef CONFIG_TARGET_AM654_A53_EVM
     #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SPL_TEXT_BASE +	\
    

    With the above patch I can see that u-boot recognizes 1GB.

    U-Boot 2020.01-dirty (Mar 11 2021 - 13:02:48 +0530)

    SoC:   AM65X SR2.0
    Model: Texas Instruments AM654 Base Board
    Board: AM6-COMPROCEVM rev A
    DRAM:  1 GiB
    MMC:   sdhci@4f80000: 0, sdhci@4fa0000: 1
    Loading Environment from MMC... OK
    In:    serial
    Out:   serial
    Err:   serial
    Detected: AM6-IDKAPPEVM rev A
    Detected: SER-PCIE2LEVM rev A
    Net:   
    Warning: ethernet@46000000 using MAC address from ROM
    eth0: ethernet@46000000

    Best Regards,
    Keerthy

  • Hi

    I have verified the solution on Ti AM654 evm board, and it works.

    I will port it after we get our evm board in the future.

    Many thanks for your help.

    Eric

  • Hi Eric

    We also want to modify the DDR memory to 1GB. I would like to ask if we need to modify the code or configuration of the kernel? Thank you!

    James