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;
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");