]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: arbel: correct the dram bank size
authorJim Liu <jim.t90615@gmail.com>
Wed, 4 Sep 2024 02:41:04 +0000 (10:41 +0800)
committerTom Rini <trini@konsulko.com>
Mon, 16 Sep 2024 22:43:35 +0000 (16:43 -0600)
If CONFIG_SYS_MEM_TOP_HIDE is defined, gd->ram_size is reduced by
CONFIG_SYS_MEM_TOP_HIDE. Need to correct the actual ram size in
dram_init_banksize.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
board/nuvoton/arbel_evb/arbel_evb.c

index 1f519219e7e641ff5465b10425acec63281e1001..55e93a77f0fb2948cced56e8e014793645365128 100644 (file)
@@ -59,17 +59,21 @@ int dram_init(void)
 
 int dram_init_banksize(void)
 {
+       phys_size_t ram_size = gd->ram_size;
 
        gd->bd->bi_dram[0].start = 0;
 
-       switch (gd->ram_size) {
+       #if defined(CONFIG_SYS_MEM_TOP_HIDE)
+               ram_size += CONFIG_SYS_MEM_TOP_HIDE;
+       #endif
+       switch (ram_size) {
        case DRAM_512MB_ECC_SIZE:
        case DRAM_512MB_SIZE:
        case DRAM_1GB_ECC_SIZE:
        case DRAM_1GB_SIZE:
        case DRAM_2GB_ECC_SIZE:
        case DRAM_2GB_SIZE:
-               gd->bd->bi_dram[0].size = gd->ram_size;
+               gd->bd->bi_dram[0].size = ram_size;
                gd->bd->bi_dram[1].start = 0;
                gd->bd->bi_dram[1].size = 0;
                break;