MLK-16049 imx8qm/qxp: Add support for reserving DDR memory for M4
authorYe Li <ye.li@nxp.com>
Fri, 8 Mar 2019 04:06:04 +0000 (20:06 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 08:48:14 +0000 (01:48 -0700)
We assign the DDR memory from 0x88000000 to 0x8FFFFFFF to M4 on QM and QXP.
The M4 can allocate this memory by two ways, in SCD or u-boot.

In this patch, u-boot addes the memory reserve node to DTB to pass the info to kernel,
no matter the M4 memory is reserved in SCD or u-boot. So kernel won't access M4 reserved memory.

Signed-off-by: Ye Li <ye.li@nxp.com>
arch/arm/mach-imx/imx8/cpu.c

index 18bd33e..7361dbc 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/armv8/cpu.h>
 #include <asm/armv8/mmu.h>
 #include <asm/mach-imx/boot_mode.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -455,6 +456,22 @@ int mmc_get_env_dev(void)
 }
 #endif
 
+#ifdef CONFIG_OF_SYSTEM_SETUP
+int ft_system_setup(void *blob, bd_t *bd)
+{
+#ifdef BOOTAUX_RESERVED_MEM_BASE
+       int off;
+       off = fdt_add_mem_rsv(blob, BOOTAUX_RESERVED_MEM_BASE,
+                                     BOOTAUX_RESERVED_MEM_SIZE);
+               if (off < 0)
+                       printf("Failed  to reserve memory for bootaux: %s\n",
+                              fdt_strerror(off));
+#endif
+
+       return 0;
+}
+#endif
+
 #define MEMSTART_ALIGNMENT  SZ_2M /* Align the memory start with 2MB */
 
 static int get_owned_memreg(sc_rm_mr_t mr, sc_faddr_t *addr_start,