diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-07-10 20:07:44 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-07-10 22:42:05 +0900 |
commit | df72534121b7e593f2a8043ad1c0c86bae0aa75b (patch) | |
tree | 1576a8e39ca60a9b89e63f8f74f6357882c6947e /arch/arm | |
parent | 6f47c99423c67e4cda251ac43a404e16af616ff9 (diff) |
ARM: uniphier: make dram_init() more generic
Make this function work with any channel being empty.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-uniphier/dram_init.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index 4a75d22db5..ab4aa93f42 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -212,6 +212,8 @@ static int uniphier_dram_map_get(struct uniphier_dram_map *dram_map) int dram_init(void) { struct uniphier_dram_map dram_map[3] = {}; + bool valid_bank_found = false; + unsigned long prev_top; int ret, i; gd->ram_size = 0; @@ -224,15 +226,14 @@ int dram_init(void) unsigned long max_size; if (!dram_map[i].size) - break; + continue; /* * U-Boot relocates itself to the tail of the memory region, * but it does not expect sparse memory. We use the first * contiguous chunk here. */ - if (i > 0 && dram_map[i - 1].base + dram_map[i - 1].size < - dram_map[i].base) + if (valid_bank_found && prev_top < dram_map[i].base) break; /* @@ -252,6 +253,9 @@ int dram_init(void) } gd->ram_size += dram_map[i].size; + + prev_top = dram_map[i].base + dram_map[i].size; + valid_bank_found = true; } /* |