diff options
| author | Masahisa Kojima <[email protected]> | 2024-03-06 15:11:10 +0900 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-03-13 18:47:11 -0400 |
| commit | f56d9a385cbf76d0ef7723faf65ec183c629a7ff (patch) | |
| tree | f1410b59e4aa432f2b1af2ecf47ac032c0a9adff | |
| parent | 5b05266928cd18e6bc94583dd41809e0b66ed87a (diff) | |
board: developerbox: fix mem_map setup timing
The setup of global variable mem_map was moved into enable_caches()
by commit a70c75cabae1 ("board: developerbox: move mem_map setup later")
since U-Boot was directly booted from NOR flash in XIP
and bss is not yet available in dram_init() at that time.
This has a problem, mem_map variable is used by
the get_page_table_size() to calculate the page table size,
but get_page_table_size() is called earlier than enable_caches()
which fills mem_map variable. With that, U-Boot fails to boot when
64GB DIMM is installed.
Currently U-Boot on the Developerbox board is not booted in XIP
and bss is available in dram_init(), let's move mem_map setup
in dram_init().
Signed-off-by: Masahisa Kojima <[email protected]>
| -rw-r--r-- | board/socionext/developerbox/developerbox.c | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c index ac4415ff3bb..062e4a7b79f 100644 --- a/board/socionext/developerbox/developerbox.c +++ b/board/socionext/developerbox/developerbox.c @@ -125,10 +125,29 @@ int dram_init(void) struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; struct draminfo_entry *ent = synquacer_draminfo->entry; unsigned long size = 0; - int i; + struct mm_region *mr; + int i, ri; + + if (synquacer_draminfo->nr_regions < 1) { + log_err("Failed to get correct DRAM information\n"); + return -EINVAL; + } - for (i = 0; i < synquacer_draminfo->nr_regions; i++) + for (i = 0; i < synquacer_draminfo->nr_regions; i++) { + if (i >= MAX_DDR_REGIONS) + break; + + ri = DDR_REGION_INDEX(i); + mem_map[ri].phys = ent[i].base; + mem_map[ri].size = ent[i].size; + mem_map[ri].virt = mem_map[ri].phys; size += ent[i].size; + if (i == 0) + continue; + + mr = &mem_map[DDR_REGION_INDEX(0)]; + mem_map[ri].attrs = mr->attrs; + } gd->ram_size = size; gd->ram_base = ent[0].base; @@ -162,43 +181,6 @@ int dram_init_banksize(void) return 0; } -void build_mem_map(void) -{ - struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; - struct draminfo_entry *ent = synquacer_draminfo->entry; - struct mm_region *mr; - int i, ri; - - if (synquacer_draminfo->nr_regions < 1) { - log_err("Failed to get correct DRAM information\n"); - return; - } - - /* Update memory region maps */ - for (i = 0; i < synquacer_draminfo->nr_regions; i++) { - if (i >= MAX_DDR_REGIONS) - break; - - ri = DDR_REGION_INDEX(i); - mem_map[ri].phys = ent[i].base; - mem_map[ri].size = ent[i].size; - mem_map[ri].virt = mem_map[ri].phys; - if (i == 0) - continue; - - mr = &mem_map[DDR_REGION_INDEX(0)]; - mem_map[ri].attrs = mr->attrs; - } -} - -void enable_caches(void) -{ - build_mem_map(); - - icache_enable(); - dcache_enable(); -} - int print_cpuinfo(void) { printf("CPU: SC2A11:Cortex-A53 MPCore 24cores\n"); |
