summaryrefslogtreecommitdiff
path: root/board/xilinx/common/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/xilinx/common/board.c')
-rw-r--r--board/xilinx/common/board.c55
1 files changed, 44 insertions, 11 deletions
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 38dd80533fa..deea6c71103 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -19,6 +19,7 @@
#include <i2c.h>
#include <linux/sizes.h>
#include <malloc.h>
+#include <memtop.h>
#include <mtd_node.h>
#include "board.h"
#include <dm.h>
@@ -357,17 +358,17 @@ __maybe_unused int xilinx_read_eeprom(void)
}
#if defined(CONFIG_OF_BOARD)
-void *board_fdt_blob_setup(int *err)
+int board_fdt_blob_setup(void **fdtp)
{
void *fdt_blob;
- *err = 0;
-
if (IS_ENABLED(CONFIG_TARGET_XILINX_MBV)) {
fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
- if (fdt_magic(fdt_blob) == FDT_MAGIC)
- return fdt_blob;
+ if (fdt_magic(fdt_blob) == FDT_MAGIC) {
+ *fdtp = fdt_blob;
+ return 0;
+ }
}
if (!IS_ENABLED(CONFIG_XPL_BUILD) &&
@@ -375,8 +376,10 @@ void *board_fdt_blob_setup(int *err)
!IS_ENABLED(CONFIG_ZYNQMP_NO_DDR)) {
fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
- if (fdt_magic(fdt_blob) == FDT_MAGIC)
- return fdt_blob;
+ if (fdt_magic(fdt_blob) == FDT_MAGIC) {
+ *fdtp = fdt_blob;
+ return 0;
+ }
debug("DTB is not passed via %p\n", fdt_blob);
}
@@ -395,13 +398,15 @@ void *board_fdt_blob_setup(int *err)
fdt_blob = (ulong *)_end;
}
- if (fdt_magic(fdt_blob) == FDT_MAGIC)
- return fdt_blob;
+ if (fdt_magic(fdt_blob) == FDT_MAGIC) {
+ *fdtp = fdt_blob;
+
+ return 0;
+ }
debug("DTB is also not passed via %p\n", fdt_blob);
- *err = -EINVAL;
- return NULL;
+ return -EINVAL;
}
#endif
@@ -676,3 +681,31 @@ int ft_board_setup(void *blob, struct bd_info *bd)
return 0;
}
#endif
+
+#ifndef CONFIG_XILINX_MINI
+
+#ifndef MMU_SECTION_SIZE
+#define MMU_SECTION_SIZE (1 * 1024 * 1024)
+#endif
+
+phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
+{
+ phys_size_t size;
+ phys_addr_t reg;
+
+ if (!total_size)
+ return gd->ram_top;
+
+ if (!IS_ALIGNED((ulong)gd->fdt_blob, 0x8))
+ panic("Not 64bit aligned DT location: %p\n", gd->fdt_blob);
+
+ size = ALIGN(CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE);
+ reg = get_mem_top(gd->ram_base, gd->ram_size, size,
+ (void *)gd->fdt_blob);
+ if (!reg)
+ reg = gd->ram_top - size;
+
+ return reg + size;
+}
+
+#endif