]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: sama5d2_xplained: Get dram size and base from device tree
authorClément Léger <clement.leger@bootlin.com>
Mon, 16 Aug 2021 12:25:42 +0000 (14:25 +0200)
committerEugen Hristev <eugen.hristev@microchip.com>
Tue, 21 Sep 2021 07:05:38 +0000 (10:05 +0300)
In order to make it more flexible and allow modifying the base address
of DRAM without recompiling U-Boot, use memory node from device tree
with fdtdec functions.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
board/atmel/sama5d2_xplained/sama5d2_xplained.c

index 5110ec89697f6eebd88599060ad00a6b609f63fc..8b5cd533d04694122b44aeeb631b6a3eff4ba8b5 100644 (file)
@@ -68,7 +68,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* address of boot parameters */
-       gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+       gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
 
 #ifdef CONFIG_CMD_USB
        board_usb_hw_init();
@@ -77,11 +77,14 @@ int board_init(void)
        return 0;
 }
 
+int dram_init_banksize(void)
+{
+       return fdtdec_setup_memory_banksize();
+}
+
 int dram_init(void)
 {
-       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
-                                   CONFIG_SYS_SDRAM_SIZE);
-       return 0;
+       return fdtdec_setup_mem_size_base();
 }
 
 #define AT24MAC_MAC_OFFSET     0x9a