ARM: uniphier: make SPL optional for ARVv8 SoCs

We may want to run different firmware before running U-Boot.  For
example, ARM Trusted Firmware runs before U-Boot, making U-Boot
a non-secure world boot loader.  In this case, the SoC might be
initialized there, which enables us to skip SPL entirely.

This commit removes "select SPL" to make it configurable.  This
also enables the Multi SoC support for the UniPhier ARMv8 SoCs.
(CONFIG_ARCH_UNIPHIER_V8_MULTI)  Thanks to the driver model and
Device Tree, the U-Boot proper part is now written in a generic way.
The board/SoC parameters reside in DT.  The Multi SoC support
increases the memory footprint a bit, but the U-Boot proper does
not have strict memory constraint.  This will mitigate the per-SoC
(sometimes per-board) defconfig burden.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 855871c..2554a2c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -894,12 +894,11 @@
 	select OF_CONTROL
 	select OF_LIBFDT
 	select PINCTRL
-	select SPL
-	select SPL_DM
-	select SPL_LIBCOMMON_SUPPORT
-	select SPL_LIBGENERIC_SUPPORT
-	select SPL_OF_CONTROL
-	select SPL_PINCTRL
+	select SPL_DM if SPL
+	select SPL_LIBCOMMON_SUPPORT if SPL
+	select SPL_LIBGENERIC_SUPPORT if SPL
+	select SPL_OF_CONTROL if SPL
+	select SPL_PINCTRL if SPL
 	select SUPPORT_SPL
 	help
 	  Support for UniPhier SoC family developed by Socionext Inc.
diff --git a/arch/arm/mach-uniphier/Kconfig b/arch/arm/mach-uniphier/Kconfig
index aa3909a..e732ac1 100644
--- a/arch/arm/mach-uniphier/Kconfig
+++ b/arch/arm/mach-uniphier/Kconfig
@@ -13,66 +13,81 @@
 config ARCH_UNIPHIER_64BIT
 	bool
 	select ARM64
-	select SPL_SEPARATE_BSS
-	select ARMV8_MULTIENTRY
-	select ARMV8_SPIN_TABLE
+	select SPL_SEPARATE_BSS if SPL
+	select ARMV8_MULTIENTRY if SPL
+	select ARMV8_SPIN_TABLE if SPL
 
 choice
         prompt "UniPhier SoC select"
         default ARCH_UNIPHIER_PRO4
 
 config ARCH_UNIPHIER_SLD3
-	bool "UniPhier PH1-sLD3 SoC"
+	bool "UniPhier sLD3 SoC"
 	select ARCH_UNIPHIER_32BIT
 
 config ARCH_UNIPHIER_LD4_SLD8
-	bool "UniPhier PH1-LD4/PH1-sLD8 SoC"
+	bool "UniPhier LD4/sLD8 SoCs"
 	select ARCH_UNIPHIER_32BIT
 
 config ARCH_UNIPHIER_PRO4
-	bool "UniPhier PH1-Pro4 SoC"
+	bool "UniPhier Pro4 SoC"
 	select ARCH_UNIPHIER_32BIT
 
 config ARCH_UNIPHIER_PRO5_PXS2_LD6B
-	bool "UniPhier PH1-Pro5/ProXstream2/PH1-LD6b SoC"
+	bool "UniPhier Pro5/PXs2/LD6b SoCs"
 	select ARCH_UNIPHIER_32BIT
 
-config ARCH_UNIPHIER_LD11
-	bool "UniPhier PH1-LD11 SoC"
+config ARCH_UNIPHIER_LD11_SINGLE
+	bool "UniPhier LD11 SoC"
 	select ARCH_UNIPHIER_64BIT
 
-config ARCH_UNIPHIER_LD20
-	bool "UniPhier PH1-LD20 SoC"
+config ARCH_UNIPHIER_LD20_SINGLE
+	bool "UniPhier LD20 SoC"
 	select ARCH_UNIPHIER_64BIT
-	select OF_BOARD_SETUP
+
+config ARCH_UNIPHIER_V8_MULTI
+	bool "UniPhier V8 SoCs"
+	depends on !SPL
+	select ARCH_UNIPHIER_64BIT
 
 endchoice
 
 config ARCH_UNIPHIER_LD4
-	bool "Enable UniPhier PH1-LD4 SoC support"
+	bool "Enable UniPhier LD4 SoC support"
 	depends on ARCH_UNIPHIER_LD4_SLD8
 	default y
 
 config ARCH_UNIPHIER_SLD8
-	bool "Enable UniPhier PH1-sLD8 SoC support"
+	bool "Enable UniPhier sLD8 SoC support"
 	depends on ARCH_UNIPHIER_LD4_SLD8
 	default y
 
 config ARCH_UNIPHIER_PRO5
-	bool "Enable UniPhier PH1-Pro5 SoC support"
+	bool "Enable UniPhier Pro5 SoC support"
 	depends on ARCH_UNIPHIER_PRO5_PXS2_LD6B
 	default y
 
 config ARCH_UNIPHIER_PXS2
-	bool "Enable UniPhier ProXstream2 SoC support"
+	bool "Enable UniPhier Pxs2 SoC support"
 	depends on ARCH_UNIPHIER_PRO5_PXS2_LD6B
 	default y
 
 config ARCH_UNIPHIER_LD6B
-	bool "Enable UniPhier PH1-LD6b SoC support"
+	bool "Enable UniPhier LD6b SoC support"
 	depends on ARCH_UNIPHIER_PRO5_PXS2_LD6B
 	default y
 
+config ARCH_UNIPHIER_LD11
+	bool "Enable UniPhier LD11 SoC support" if ARCH_UNIPHIER_V8_MULTI
+	depends on ARCH_UNIPHIER_LD11_SINGLE || ARCH_UNIPHIER_V8_MULTI
+	default y
+
+config ARCH_UNIPHIER_LD20
+	bool "Enable UniPhier LD20 SoC support" if ARCH_UNIPHIER_V8_MULTI
+	depends on ARCH_UNIPHIER_LD20_SINGLE || ARCH_UNIPHIER_V8_MULTI
+	select OF_BOARD_SETUP
+	default y
+
 config CACHE_UNIPHIER
 	bool "Enable the UniPhier L2 cache controller"
 	depends on ARCH_UNIPHIER_32BIT
diff --git a/arch/arm/mach-uniphier/arm64/Makefile b/arch/arm/mach-uniphier/arm64/Makefile
index 5ed030a..eb34c20 100644
--- a/arch/arm/mach-uniphier/arm64/Makefile
+++ b/arch/arm/mach-uniphier/arm64/Makefile
@@ -5,6 +5,9 @@
 ifdef CONFIG_SPL_BUILD
 obj-y += timer.o
 else
-obj-y += mem_map.o smp.o smp_kick_cpus.o
+obj-y += mem_map.o
+ifdef CONFIG_ARMV8_MULTIENTRY
+obj-y += smp.o smp_kick_cpus.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD20) += arm-cci500.o
 endif
+endif
diff --git a/arch/arm/mach-uniphier/board_init.c b/arch/arm/mach-uniphier/board_init.c
index 8233a52..2269291 100644
--- a/arch/arm/mach-uniphier/board_init.c
+++ b/arch/arm/mach-uniphier/board_init.c
@@ -73,8 +73,9 @@
 		writel(0x0000b500, 0x6184e024);
 		writel(0x00000001, 0x6184e000);
 	}
-
+#ifdef CONFIG_ARMV8_MULTIENTRY
 	cci500_init(2);
+#endif
 }
 #endif
 
@@ -235,7 +236,7 @@
 
 	led_puts("U6");
 
-#ifdef CONFIG_ARM64
+#ifdef CONFIG_ARMV8_MULTIENTRY
 	uniphier_smp_kick_all_cpus();
 #endif