#include <common.h>
#include <dm.h>
+#include <lmb.h>
#include <ram.h>
DECLARE_GLOBAL_DATA_PTR;
return 0;
}
+
+ulong board_get_usable_ram_top(ulong total_size)
+{
+ phys_addr_t reg;
+ struct lmb lmb;
+
+ /* found enough not-reserved memory to relocated U-Boot */
+ lmb_init(&lmb);
+ lmb_add(&lmb, gd->ram_base, gd->ram_size);
+ boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
+ reg = lmb_alloc(&lmb, CONFIG_SYS_MALLOC_LEN + total_size, SZ_4K);
+
+ if (reg)
+ return ALIGN(reg + CONFIG_SYS_MALLOC_LEN + total_size, SZ_4K);
+
+ return gd->ram_top;
+}
string, addr, name);
}
+static void stm32_fdt_disable_optee(void *blob)
+{
+ int off, node;
+
+ off = fdt_node_offset_by_compatible(blob, -1, "linaro,optee-tz");
+ if (off >= 0 && fdtdec_get_is_enabled(blob, off))
+ fdt_status_disabled(blob, off);
+
+ /* Disabled "optee@..." reserved-memory node */
+ off = fdt_path_offset(blob, "/reserved-memory/");
+ if (off < 0)
+ return;
+ for (node = fdt_first_subnode(blob, off);
+ node >= 0;
+ node = fdt_next_subnode(blob, node)) {
+ if (!strncmp(fdt_get_name(blob, node, NULL), "optee@", 6))
+ fdt_status_disabled(blob, node);
+ }
+}
+
/*
* This function is called right before the kernel is booted. "blob" is the
* device tree that will be passed to the kernel.
"st,package", pkg, false);
}
+ if (!CONFIG_IS_ENABLED(STM32MP1_OPTEE))
+ stm32_fdt_disable_optee(blob);
+
return ret;
}
#define CONFIG_SYS_SDRAM_BASE STM32_DDR_BASE
#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
-#ifdef CONFIG_STM32MP1_OPTEE
-#define CONFIG_SYS_MEM_TOP_HIDE SZ_32M
-#endif /* CONFIG_STM32MP1_OPTEE */
-
/*
* Console I/O buffer size
*/