MA-14501[Android] change BOOTAUX_RESERVED_MEM macro to defconfig

As the M4 use different DDR memory size in normal android/car2 and car
image, use different defconfig for car2 to decrease DDR memory
reservation. So memory reserved for each M4 core is 8MB in car2 and
normal android image. it's 32MB for car image.

Change-Id: Idf608f539cd614a154c78e3a1af28eff1da5c1f2
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig
index aa03d38..268a54d 100644
--- a/arch/arm/mach-imx/imx8/Kconfig
+++ b/arch/arm/mach-imx/imx8/Kconfig
@@ -15,6 +15,18 @@
 	help
 	  This option enables the support for AHAB secure boot.
 
+config BOOTAUX_RESERVED_MEM_BASE
+	hex "Define the reserved memory base address"
+	default 0x0
+	help
+	  reserve DDR memory for bootaux
+
+config BOOTAUX_RESERVED_MEM_SIZE
+	hex "Define the reserved memory size"
+	default 0x0
+	help
+	  This memory will be reserved by system and linux cannot access.
+
 config IMX8
 	bool
 
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 6fdedf6..7666546 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -1135,10 +1135,10 @@
 
 int ft_system_setup(void *blob, bd_t *bd)
 {
-#ifdef BOOTAUX_RESERVED_MEM_BASE
+#if (CONFIG_BOOTAUX_RESERVED_MEM_SIZE != 0x00)
 	int off;
-	off = fdt_add_mem_rsv(blob, BOOTAUX_RESERVED_MEM_BASE,
-				      BOOTAUX_RESERVED_MEM_SIZE);
+	off = fdt_add_mem_rsv(blob, CONFIG_BOOTAUX_RESERVED_MEM_BASE,
+				      CONFIG_BOOTAUX_RESERVED_MEM_SIZE);
 		if (off < 0)
 			printf("Failed  to reserve memory for bootaux: %s\n",
 			       fdt_strerror(off));
diff --git a/configs/imx8qm_mek_defconfig b/configs/imx8qm_mek_defconfig
index 3db5286..61baa74 100644
--- a/configs/imx8qm_mek_defconfig
+++ b/configs/imx8qm_mek_defconfig
@@ -136,3 +136,6 @@
 CONFIG_FASTBOOT_BUF_SIZE=0x40000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_USB_DEV=1
+
+CONFIG_BOOTAUX_RESERVED_MEM_BASE=0x88000000
+CONFIG_BOOTAUX_RESERVED_MEM_SIZE=0x08000000
diff --git a/configs/imx8qm_mek_fspi_defconfig b/configs/imx8qm_mek_fspi_defconfig
index 5a3c1bb..894c2d7 100644
--- a/configs/imx8qm_mek_fspi_defconfig
+++ b/configs/imx8qm_mek_fspi_defconfig
@@ -137,3 +137,6 @@
 CONFIG_FASTBOOT_BUF_SIZE=0x40000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_USB_DEV=1
+
+CONFIG_BOOTAUX_RESERVED_MEM_BASE=0x88000000
+CONFIG_BOOTAUX_RESERVED_MEM_SIZE=0x08000000
diff --git a/configs/imx8qxp_mek_defconfig b/configs/imx8qxp_mek_defconfig
index 653abd1..c8bcbd8 100644
--- a/configs/imx8qxp_mek_defconfig
+++ b/configs/imx8qxp_mek_defconfig
@@ -139,3 +139,6 @@
 CONFIG_SYS_I2C_IMX_VIRT_I2C=y
 CONFIG_I2C_MUX_IMX_VIRT=y
 CONFIG_IMX_VSERVICE_SHARED_BUFFER=0x90000000
+
+CONFIG_BOOTAUX_RESERVED_MEM_BASE=0x88000000
+CONFIG_BOOTAUX_RESERVED_MEM_SIZE=0x08000000
diff --git a/configs/imx8qxp_mek_fspi_defconfig b/configs/imx8qxp_mek_fspi_defconfig
index b29c937..032f57a 100644
--- a/configs/imx8qxp_mek_fspi_defconfig
+++ b/configs/imx8qxp_mek_fspi_defconfig
@@ -140,3 +140,6 @@
 CONFIG_SYS_I2C_IMX_VIRT_I2C=y
 CONFIG_I2C_MUX_IMX_VIRT=y
 CONFIG_IMX_VSERVICE_SHARED_BUFFER=0x90000000
+
+CONFIG_BOOTAUX_RESERVED_MEM_BASE=0x88000000
+CONFIG_BOOTAUX_RESERVED_MEM_SIZE=0x08000000
diff --git a/include/configs/imx8qm_mek.h b/include/configs/imx8qm_mek.h
index 9735343..7f2c431 100644
--- a/include/configs/imx8qm_mek.h
+++ b/include/configs/imx8qm_mek.h
@@ -401,6 +401,4 @@
 #endif
 
 #define CONFIG_OF_SYSTEM_SETUP
-#define BOOTAUX_RESERVED_MEM_BASE 0x88000000
-#define BOOTAUX_RESERVED_MEM_SIZE 0x08000000 /* Reserve from second 128MB */
 #endif /* __IMX8QM_MEK_H */
diff --git a/include/configs/imx8qxp_mek.h b/include/configs/imx8qxp_mek.h
index c0e1fa8..eb57a61 100644
--- a/include/configs/imx8qxp_mek.h
+++ b/include/configs/imx8qxp_mek.h
@@ -372,6 +372,4 @@
 #endif
 
 #define CONFIG_OF_SYSTEM_SETUP
-#define BOOTAUX_RESERVED_MEM_BASE 0x88000000
-#define BOOTAUX_RESERVED_MEM_SIZE 0x08000000 /* Reserve from second 128MB */
 #endif /* __IMX8QXP_MEK_H */