ARM: uniphier: support eMMC boot for PH1-LD11 and PH1-LD20

The Boot ROM on PH1-LD11/LD20 exports built-in APIs to load images
from an eMMC device.  They are useful to reduce the memory footprint
of SPL, rather than compiling the whole MMC framework.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode.c b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
index 4b744da..d34b9af 100644
--- a/arch/arm/mach-uniphier/boot-mode/boot-mode.c
+++ b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
@@ -51,11 +51,30 @@
 
 u32 spl_boot_device(void)
 {
-	u32 ret;
+	u32 mode;
 
-	ret = spl_boot_device_raw();
+	mode = spl_boot_device_raw();
+
+	switch (uniphier_get_soc_type()) {
+#if defined(CONFIG_ARCH_UNIPHIER_PXS2) || defined(CONFIG_ARCH_UNIPHIER_LD6B)
+	case SOC_UNIPHIER_PXS2:
+	case SOC_UNIPHIER_LD6B:
+		if (mode == BOOT_DEVICE_USB)
+			mode = BOOT_DEVICE_NOR;
+		break;
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_LD11) || defined(CONFIG_ARCH_UNIPHIER_LD20)
+	case SOC_UNIPHIER_LD11:
+	case SOC_UNIPHIER_LD20:
+		if (mode == BOOT_DEVICE_MMC1 || mode == BOOT_DEVICE_USB)
+			mode = BOOT_DEVICE_BOARD;
+		break;
+#endif
+	default:
+		break;
+	}
 
-	return ret == BOOT_DEVICE_USB ? BOOT_DEVICE_NOR : ret;
+	return mode;
 }
 
 u32 spl_boot_mode(void)