ARM: uniphier: set gd->ram_base correctly
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 30 Jan 2020 13:20:37 +0000 (22:20 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 31 Jan 2020 16:14:32 +0000 (01:14 +0900)
gd->ram_base is not set at all if the end address of the DRAM ch0
exceeds the 4GB limit.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/mach-uniphier/dram_init.c

index 13821a9..5f9d90f 100644 (file)
@@ -248,12 +248,7 @@ int dram_init(void)
 
                max_size = (1ULL << 32) - dram_map[i].base;
 
-               if (dram_map[i].size > max_size) {
-                       gd->ram_size += max_size;
-                       break;
-               }
-
-               gd->ram_size += dram_map[i].size;
+               gd->ram_size = min(dram_map[i].size, max_size);
 
                if (!valid_bank_found)
                        gd->ram_base = dram_map[i].base;