configs: j721e_evm_a72_defconfig: Add HBMC related configs
[oweals/u-boot.git] / common / board_f.c
index 6867abc8e67936455760de0d0af652e28fdec7bf..591f18f391e22e7ae515c265de050e63f5d7e156 100644 (file)
@@ -470,9 +470,18 @@ static int reserve_uboot(void)
 #ifdef CONFIG_SYS_NONCACHED_MEMORY
 static int reserve_noncached(void)
 {
-       /* round down to SECTION SIZE (typicaly 1MB) limit */
-       gd->start_addr_sp &= ~(MMU_SECTION_SIZE - 1);
-       gd->start_addr_sp -= CONFIG_SYS_NONCACHED_MEMORY;
+       /*
+        * The value of gd->start_addr_sp must match the value of malloc_start
+        * calculated in boatrd_f.c:initr_malloc(), which is passed to
+        * board_r.c:mem_malloc_init() and then used by
+        * cache.c:noncached_init()
+        *
+        * These calculations must match the code in cache.c:noncached_init()
+        */
+       gd->start_addr_sp = ALIGN(gd->start_addr_sp, MMU_SECTION_SIZE) -
+               MMU_SECTION_SIZE;
+       gd->start_addr_sp -= ALIGN(CONFIG_SYS_NONCACHED_MEMORY,
+                                  MMU_SECTION_SIZE);
        debug("Reserving %dM for noncached_alloc() at: %08lx\n",
              CONFIG_SYS_NONCACHED_MEMORY >> 20, gd->start_addr_sp);