From c20b7761dba32bd9b63db706c762a8edd576778e Mon Sep 17 00:00:00 2001
From: Ye Li <ye.li@nxp.com>
Date: Mon, 11 Mar 2019 19:19:54 -0700
Subject: [PATCH] MLK-21103 imx8: Fix build break on ARM2 SPL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Meet the build error below with ARM2 SPL defconfig
arch/arm/mach-imx/imx8/image.c: In function ‘spl_nor_get_uboot_base’:
arch/arm/mach-imx/imx8/image.c:224:13: error: ‘CONFIG_SYS_UBOOT_BASE’
undeclared (first use in this function)
if (end <= CONFIG_SYS_UBOOT_BASE)

The root cause is we did not add SPL NOR support for ARM2 SPL, but
the codes still use the CONFIG_SYS_UBOOT_BASE.

Fix the issue by adding SPL device support config for each device
relevant function.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit a96fd317601db7f21402e5f74fe24653e2af8ae7)
---
 arch/arm/mach-imx/imx8/image.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-imx/imx8/image.c b/arch/arm/mach-imx/imx8/image.c
index 1780658..6bae8de 100644
--- a/arch/arm/mach-imx/imx8/image.c
+++ b/arch/arm/mach-imx/imx8/image.c
@@ -175,6 +175,7 @@ static int get_imageset_end(void *dev, int dev_type)
 	return value_container[1] + offset2;
 }
 
+#ifdef CONFIG_SPL_SPI_LOAD
 unsigned long spl_spi_get_uboot_raw_sector(struct spi_flash *flash)
 {
 	int end;
@@ -186,7 +187,9 @@ unsigned long spl_spi_get_uboot_raw_sector(struct spi_flash *flash)
 
 	return end;
 }
+#endif
 
+#ifdef CONFIG_SPL_MMC_SUPPORT
 unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
 {
 	int end;
@@ -198,7 +201,9 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
 
 	return end/mmc->read_bl_len;
 }
+#endif
 
+#ifdef CONFIG_SPL_NAND_SUPPORT
 uint32_t spl_nand_get_uboot_raw_page(void)
 {
 	int end;
@@ -210,7 +215,9 @@ uint32_t spl_nand_get_uboot_raw_page(void)
 
 	return end;
 }
+#endif
 
+#ifdef CONFIG_SPL_NOR_SUPPORT
 unsigned long  spl_nor_get_uboot_base(void)
 {
 	int end;
@@ -230,3 +237,4 @@ unsigned long  spl_nor_get_uboot_base(void)
 
 	return end;
 }
+#endif
-- 
1.9.1