summaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/dram_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-stm32mp/dram_init.c')
-rw-r--r--arch/arm/mach-stm32mp/dram_init.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c
index 198785353f1..b06105768b3 100644
--- a/arch/arm/mach-stm32mp/dram_init.c
+++ b/arch/arm/mach-stm32mp/dram_init.c
@@ -25,8 +25,11 @@ int optee_get_reserved_memory(u32 *start, u32 *size)
ofnode node;
node = ofnode_path("/reserved-memory/optee");
- if (!ofnode_valid(node))
- return -ENOENT;
+ if (!ofnode_valid(node)) {
+ node = ofnode_path("/reserved-memory/optee_core");
+ if (!ofnode_valid(node))
+ return -ENOENT;
+ }
fdt_start = ofnode_get_addr_size(node, "reg", &fdt_mem_size);
*start = fdt_start;
@@ -62,7 +65,6 @@ int dram_init(void)
phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
{
- int ret;
phys_size_t size;
phys_addr_t reg;
u32 optee_start, optee_size;
@@ -75,10 +77,17 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
* if the effective available memory is bigger
*/
gd->ram_top = clamp_val(gd->ram_top, 0, SZ_4G - 1);
+
+ /* add 8M for U-Boot reserved memory: display, fdt, gd,... */
size = ALIGN(SZ_8M + CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE);
- ret = optee_get_reserved_memory(&optee_start, &optee_size);
- reg = (!ret ? optee_start : gd->ram_top) - size;
+ reg = gd->ram_top - size;
+
+ /* Reserved memory for OP-TEE at END of DDR for STM32MP1 SoC */
+ if (IS_ENABLED(CONFIG_STM32MP13X) || IS_ENABLED(CONFIG_STM32MP15X)) {
+ if (!optee_get_reserved_memory(&optee_start, &optee_size))
+ reg = ALIGN(optee_start - size, MMU_SECTION_SIZE);
+ }
/* before relocation, mark the U-Boot memory as cacheable by default */
if (!(gd->flags & GD_FLG_RELOC))
@@ -86,14 +95,3 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
return reg + size;
}
-
-void efi_add_known_memory(void)
-{
- if (IS_ENABLED(CONFIG_EFI_LOADER))
- /*
- * Memory over ram_top is reserved to OPTEE.
- * Declare to EFI only memory area below ram_top
- */
- efi_add_memory_map(gd->ram_base, gd->ram_top - gd->ram_base,
- EFI_CONVENTIONAL_MEMORY);
-}