TI中文支持网
TI专业的中文技术问题搜集分享网站

[FAQ] [常见问题解答] 如何在 uboot 中配置 512MB*2 DDR RAM

Other Parts Discussed in Thread:AM6548

客户:我们将使用 AM6548 SR2.0 来启动 EVM 板,届时 EVM 中将有 2 个 512MB、总共 1GB 的 DDR4。

在这种情况下,我们有两个问题需要与您确认。

1.如何修改 k3-am654-board-board.dts 中的存储区?SDK 的默认值为 4G。

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

2.在 evm.c 中,我们按如下方式修改 ram_size,正确吗?我不确定是否需要设置 gd->bd->bi_dram[1] 。

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
/* 将 U-Boot 使用的 RAM 限制为 DDR 低位区域 */
if (gd->ram_top > 0x40000000)
return 0x40000000;
#endif

return gd->ram_top;
}

int dram_init_banksize(void)
{
/* 组 0 声明 DDR 低位区域中可用 内存*/
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
/* 组 1 声明 DDR 高位区域中可用内存 */
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;

答案:这是不是从 0x80000000 开始的连续 1GB 空间?

客户:是的,它将是连续的 1GB 空间。并且带宽为 16 bit*2。

答案:这是我将 AM654 存储器减少到 1GB 时使用的 diff 命令。

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)

{

               /* 组 0 声明 DDR 低位区域中可用内存 */

               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

–              /* 组 1 声明 DDR 高位区域中可用内存*/

–              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 配置 */

-#define CONFIG_SYS_SDRAM_BASE1                    0x880000000

/* SPL 加载程序配置 */

#ifdef CONFIG_TARGET_AM654_A53_EVM

#define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SPL_TEXT_BASE +     \

通过上述补丁,我可以看到 u-boot 可识别到 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

客户:我已经在 TI AM654 EVM 板上验证了该解决方案是有效的。

Annie Liu:

我们建议您始终在发布新问题之前先搜索 E2E。  E2E 已经拥有数十万个已得到解答的话题。  这通常是解决问题的最快方法。

赞(0)
未经允许不得转载:TI中文支持网 » [FAQ] [常见问题解答] 如何在 uboot 中配置 512MB*2 DDR RAM
分享到: 更多 (0)