[U-Boot] [PATCH 06/10] board: altera: Stratix10: Add ft_board_setup()

Ley Foon Tan ley.foon.tan at intel.com
Tue Mar 12 08:31:10 UTC 2019


Add ft_board_setup() function to setup memory banks before
boot to Linux.

Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
---
 board/altera/stratix10-socdk/socfpga.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/board/altera/stratix10-socdk/socfpga.c b/board/altera/stratix10-socdk/socfpga.c
index 99c10d313c..ca6e0e9085 100644
--- a/board/altera/stratix10-socdk/socfpga.c
+++ b/board/altera/stratix10-socdk/socfpga.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <fdt_support.h>
 #include <asm/arch/sdram.h>
 #include <linux/sizes.h>
 
@@ -17,3 +18,27 @@ ulong board_get_usable_ram_top(ulong total_size)
 		return sdram_calculate_size();
 }
 #endif
+
+#ifdef CONFIG_OF_BOARD_SETUP
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	int ret = 0;
+#ifdef CONFIG_OF_LIBFDT
+	int bank;
+	int actual_bank = 0;
+	u64 start[CONFIG_NR_DRAM_BANKS];
+	u64 size[CONFIG_NR_DRAM_BANKS];
+
+	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+		if (bd->bi_dram[bank].size) {
+			start[actual_bank] = bd->bi_dram[bank].start;
+			size[actual_bank++] = bd->bi_dram[bank].size;
+		}
+	}
+
+	ret = fdt_fixup_memory_banks(blob, start, size, actual_bank);
+#endif /* CONFIG_OF_LIBFDT */
+
+	return ret;
+}
+#endif
-- 
2.19.0



More information about the U-Boot mailing list