]> git.sur5r.net Git - u-boot/commitdiff
ARM: uniphier: refactor spl_init_board()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 15 Jan 2017 05:59:09 +0000 (14:59 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 17 Jan 2017 16:22:30 +0000 (01:22 +0900)
Merge init-*.c into a single file using a table of callbacks because
the initialization flow is almost common among SoCs.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
19 files changed:
arch/arm/mach-uniphier/Makefile
arch/arm/mach-uniphier/clk/Makefile
arch/arm/mach-uniphier/clk/dpll-pro5.c [new file with mode: 0644]
arch/arm/mach-uniphier/clk/dpll-pxs2.c [new file with mode: 0644]
arch/arm/mach-uniphier/dram/Makefile
arch/arm/mach-uniphier/dram/umc-pro5.c [new file with mode: 0644]
arch/arm/mach-uniphier/dram/umc-sld3.c [new file with mode: 0644]
arch/arm/mach-uniphier/init.h
arch/arm/mach-uniphier/init/Makefile [deleted file]
arch/arm/mach-uniphier/init/init-ld11.c [deleted file]
arch/arm/mach-uniphier/init/init-ld20.c [deleted file]
arch/arm/mach-uniphier/init/init-ld4.c [deleted file]
arch/arm/mach-uniphier/init/init-pro4.c [deleted file]
arch/arm/mach-uniphier/init/init-pro5.c [deleted file]
arch/arm/mach-uniphier/init/init-pxs2.c [deleted file]
arch/arm/mach-uniphier/init/init-sld3.c [deleted file]
arch/arm/mach-uniphier/init/init-sld8.c [deleted file]
arch/arm/mach-uniphier/init/init.c [deleted file]
arch/arm/mach-uniphier/spl_board_init.c [new file with mode: 0644]

index 98b42a06ce589a3172ec56d7283d4600dc75d2f3..7f1abd03dc981eb99ef8655237dd3126f2d30341 100644 (file)
@@ -4,8 +4,9 @@
 
 ifdef CONFIG_SPL_BUILD
 
+obj-y += spl_board_init.o
 obj-y += memconf.o
-obj-y += init/ bcu/
+obj-y += bcu/
 obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc/
 
 else
index bf77fca5a975669d0d5b351c111bbdd2688f588c..37df04b12edbda4924a89cb12e74a65c2bac8646 100644 (file)
@@ -8,9 +8,9 @@ obj-$(CONFIG_ARCH_UNIPHIER_SLD3)        += clk-early-sld3.o clk-dram-sld3.o dpll-sld3.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD4)                += clk-early-sld3.o clk-dram-sld3.o dpll-ld4.o
 obj-$(CONFIG_ARCH_UNIPHIER_PRO4)       += clk-early-sld3.o clk-dram-sld3.o dpll-pro4.o
 obj-$(CONFIG_ARCH_UNIPHIER_SLD8)       += clk-early-sld3.o clk-dram-sld3.o dpll-sld8.o
-obj-$(CONFIG_ARCH_UNIPHIER_PRO5)       += clk-early-sld3.o clk-dram-pro5.o
-obj-$(CONFIG_ARCH_UNIPHIER_PXS2)       += clk-early-sld3.o clk-dram-pxs2.o
-obj-$(CONFIG_ARCH_UNIPHIER_LD6B)       += clk-early-sld3.o clk-dram-pxs2.o
+obj-$(CONFIG_ARCH_UNIPHIER_PRO5)       += clk-early-sld3.o clk-dram-pro5.o dpll-pro5.o
+obj-$(CONFIG_ARCH_UNIPHIER_PXS2)       += clk-early-sld3.o clk-dram-pxs2.o dpll-pxs2.o
+obj-$(CONFIG_ARCH_UNIPHIER_LD6B)       += clk-early-sld3.o clk-dram-pxs2.o dpll-pxs2.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD11)       += clk-early-ld11.o clk-dram-ld11.o dpll-ld11.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD20)       += clk-early-ld11.o clk-dram-ld20.o dpll-ld20.o
 
diff --git a/arch/arm/mach-uniphier/clk/dpll-pro5.c b/arch/arm/mach-uniphier/clk/dpll-pro5.c
new file mode 100644 (file)
index 0000000..d3a42c7
--- /dev/null
@@ -0,0 +1,6 @@
+#include "../init.h"
+
+int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd)
+{
+       return 0;
+}
diff --git a/arch/arm/mach-uniphier/clk/dpll-pxs2.c b/arch/arm/mach-uniphier/clk/dpll-pxs2.c
new file mode 100644 (file)
index 0000000..328ebf6
--- /dev/null
@@ -0,0 +1,6 @@
+#include "../init.h"
+
+int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd)
+{
+       return 0;
+}
index 5b9d8925114ff363a459d620cc90ede02c1821e7..2ce6199988a4cc9201678ca647903518390257b6 100644 (file)
@@ -4,12 +4,14 @@
 
 ifdef CONFIG_SPL_BUILD
 
+obj-$(CONFIG_ARCH_UNIPHIER_SLD3)       += umc-sld3.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD4)                += umc-ld4.o \
                                           ddrphy-training.o ddrphy-ld4.o
 obj-$(CONFIG_ARCH_UNIPHIER_PRO4)       += umc-pro4.o \
                                           ddrphy-training.o ddrphy-ld4.o
 obj-$(CONFIG_ARCH_UNIPHIER_SLD8)       += umc-sld8.o \
                                           ddrphy-training.o ddrphy-ld4.o
+obj-$(CONFIG_ARCH_UNIPHIER_PRO5)       += umc-pro5.o
 obj-$(CONFIG_ARCH_UNIPHIER_PXS2)       += umc-pxs2.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD6B)       += umc-pxs2.o
 obj-$(CONFIG_ARCH_UNIPHIER_LD11)       += umc-ld11.o
diff --git a/arch/arm/mach-uniphier/dram/umc-pro5.c b/arch/arm/mach-uniphier/dram/umc-pro5.c
new file mode 100644 (file)
index 0000000..4f34d1f
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2016 Socionext Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include "../init.h"
+
+int uniphier_pro5_umc_init(const struct uniphier_board_data *bd)
+{
+       return 0;
+}
diff --git a/arch/arm/mach-uniphier/dram/umc-sld3.c b/arch/arm/mach-uniphier/dram/umc-sld3.c
new file mode 100644 (file)
index 0000000..99249eb
--- /dev/null
@@ -0,0 +1,6 @@
+#include "../init.h"
+
+int uniphier_sld3_umc_init(const struct uniphier_board_data *bd)
+{
+       return 0;
+}
index 6a1816f6d503caf6970a924d70ca95832b3391dc..d2078064013eb9efdd845a93c09332c12e1b6d81 100644 (file)
@@ -84,6 +84,8 @@ int uniphier_sld3_dpll_init(const struct uniphier_board_data *bd);
 int uniphier_ld4_dpll_init(const struct uniphier_board_data *bd);
 int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd);
 int uniphier_sld8_dpll_init(const struct uniphier_board_data *bd);
+int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd);
+int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd);
 int uniphier_ld11_dpll_init(const struct uniphier_board_data *bd);
 int uniphier_ld20_dpll_init(const struct uniphier_board_data *bd);
 
@@ -96,9 +98,11 @@ void uniphier_pxs2_dram_clk_init(void);
 void uniphier_ld11_dram_clk_init(void);
 void uniphier_ld20_dram_clk_init(void);
 
+int uniphier_sld3_umc_init(const struct uniphier_board_data *bd);
 int uniphier_ld4_umc_init(const struct uniphier_board_data *bd);
 int uniphier_pro4_umc_init(const struct uniphier_board_data *bd);
 int uniphier_sld8_umc_init(const struct uniphier_board_data *bd);
+int uniphier_pro5_umc_init(const struct uniphier_board_data *bd);
 int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
 int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
 int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
diff --git a/arch/arm/mach-uniphier/init/Makefile b/arch/arm/mach-uniphier/init/Makefile
deleted file mode 100644 (file)
index dcaa445..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y                                  += init.o
-
-obj-$(CONFIG_ARCH_UNIPHIER_SLD3)       += init-sld3.o
-obj-$(CONFIG_ARCH_UNIPHIER_LD4)                += init-ld4.o
-obj-$(CONFIG_ARCH_UNIPHIER_PRO4)       += init-pro4.o
-obj-$(CONFIG_ARCH_UNIPHIER_SLD8)       += init-sld8.o
-obj-$(CONFIG_ARCH_UNIPHIER_PRO5)       += init-pro5.o
-obj-$(CONFIG_ARCH_UNIPHIER_PXS2)       += init-pxs2.o
-obj-$(CONFIG_ARCH_UNIPHIER_LD6B)       += init-pxs2.o
-obj-$(CONFIG_ARCH_UNIPHIER_LD11)       += init-ld11.o
-obj-$(CONFIG_ARCH_UNIPHIER_LD20)       += init-ld20.o
diff --git a/arch/arm/mach-uniphier/init/init-ld11.c b/arch/arm/mach-uniphier/init/init-ld11.c
deleted file mode 100644 (file)
index e19dc5b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2016 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_ld11_init(const struct uniphier_board_data *bd)
-{
-       uniphier_ld11_sbc_init();
-
-       support_card_init();
-
-       led_puts("L0");
-
-       uniphier_memconf_2ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_ld11_early_clk_init();
-       uniphier_ld11_dram_clk_init();
-
-       led_puts("L2");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L3");
-
-       uniphier_ld11_dpll_init(bd);
-
-       led_puts("L4");
-
-       {
-               int res;
-
-               res = uniphier_ld11_umc_init(bd);
-               if (res < 0) {
-                       while (1)
-                               ;
-               }
-       }
-
-       led_puts("L5");
-
-       dcache_disable();
-
-       led_puts("L6");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-ld20.c b/arch/arm/mach-uniphier/init/init-ld20.c
deleted file mode 100644 (file)
index e056d5d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2016 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_ld20_init(const struct uniphier_board_data *bd)
-{
-       uniphier_ld11_sbc_init();
-
-       support_card_init();
-
-       led_puts("L0");
-
-       uniphier_memconf_3ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_ld11_early_clk_init();
-       uniphier_ld20_dram_clk_init();
-
-       led_puts("L2");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L3");
-
-       uniphier_ld20_dpll_init(bd);
-
-       led_puts("L4");
-
-       {
-               int res;
-
-               res = uniphier_ld20_umc_init(bd);
-               if (res < 0) {
-                       while (1)
-                               ;
-               }
-       }
-
-       led_puts("L5");
-
-       dcache_disable();
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-ld4.c b/arch/arm/mach-uniphier/init/init-ld4.c
deleted file mode 100644 (file)
index a5b9493..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013-2015 Panasonic Corporation
- * Copyright (C) 2015-2016 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_ld4_init(const struct uniphier_board_data *bd)
-{
-       uniphier_ld4_bcu_init(bd);
-
-       uniphier_ld4_sbc_init();
-
-       support_card_init();
-
-       uniphier_ld4_dpll_init(bd);
-
-       led_puts("L0");
-
-       uniphier_memconf_2ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_sld3_early_clk_init();
-       uniphier_sld3_dram_clk_init();
-
-       led_puts("L2");
-
-       led_puts("L3");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L4");
-
-       {
-               int res;
-
-               res = uniphier_ld4_umc_init(bd);
-               if (res < 0) {
-                       while (1)
-                               ;
-               }
-       }
-
-       led_puts("L5");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-pro4.c b/arch/arm/mach-uniphier/init/init-pro4.c
deleted file mode 100644 (file)
index c277071..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013-2015 Panasonic Corporation
- * Copyright (C) 2015-2016 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_pro4_init(const struct uniphier_board_data *bd)
-{
-       uniphier_sbc_init_savepin();
-
-       support_card_init();
-
-       uniphier_pro4_dpll_init(bd);
-
-       led_puts("L0");
-
-       uniphier_memconf_2ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_sld3_early_clk_init();
-       uniphier_sld3_dram_clk_init();
-
-       led_puts("L2");
-
-       led_puts("L3");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L4");
-
-       {
-               int res;
-
-               res = uniphier_pro4_umc_init(bd);
-               if (res < 0) {
-                       while (1)
-                               ;
-               }
-       }
-
-       led_puts("L5");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-pro5.c b/arch/arm/mach-uniphier/init/init-pro5.c
deleted file mode 100644 (file)
index 4e7041b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_pro5_init(const struct uniphier_board_data *bd)
-{
-       uniphier_sbc_init_savepin();
-
-       support_card_init();
-
-       led_puts("L0");
-
-       uniphier_memconf_2ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_sld3_early_clk_init();
-       uniphier_pro5_dram_clk_init();
-
-       led_puts("L2");
-
-       led_puts("L3");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L4");
-
-       led_puts("L5");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-pxs2.c b/arch/arm/mach-uniphier/init/init-pxs2.c
deleted file mode 100644 (file)
index f7d5b48..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_pxs2_init(const struct uniphier_board_data *bd)
-{
-       int ret;
-
-       uniphier_pxs2_sbc_init();
-
-       support_card_init();
-
-       led_puts("L0");
-
-       uniphier_memconf_3ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_sld3_early_clk_init();
-       uniphier_pxs2_dram_clk_init();
-
-       led_puts("L2");
-
-       led_puts("L3");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L4");
-
-       ret = uniphier_pxs2_umc_init(bd);
-       if (ret)
-               return ret;
-
-       led_puts("L5");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-sld3.c b/arch/arm/mach-uniphier/init/init-sld3.c
deleted file mode 100644 (file)
index 50d9eaf..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2013-2015 Panasonic Corporation
- * Copyright (C) 2015-2016 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_sld3_init(const struct uniphier_board_data *bd)
-{
-       uniphier_sld3_bcu_init(bd);
-
-       uniphier_sbc_init_admulti();
-
-       support_card_init();
-
-       uniphier_sld3_dpll_init(bd);
-
-       led_puts("L0");
-
-       uniphier_memconf_3ch_no_disbit_init(bd);
-
-       led_puts("L1");
-
-       uniphier_sld3_early_clk_init();
-       uniphier_sld3_dram_clk_init();
-
-       led_puts("L2");
-
-       led_puts("L3");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L4");
-
-       led_puts("L5");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init-sld8.c b/arch/arm/mach-uniphier/init/init-sld8.c
deleted file mode 100644 (file)
index 8da2843..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013-2015 Panasonic Corporation
- * Copyright (C) 2015-2016 Socionext Inc.
- *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../micro-support-card.h"
-
-int uniphier_sld8_init(const struct uniphier_board_data *bd)
-{
-       uniphier_ld4_bcu_init(bd);
-
-       uniphier_ld4_sbc_init();
-
-       support_card_init();
-
-       uniphier_sld8_dpll_init(bd);
-
-       led_puts("L0");
-
-       uniphier_memconf_2ch_init(bd);
-
-       led_puts("L1");
-
-       uniphier_sld3_early_clk_init();
-       uniphier_sld3_dram_clk_init();
-
-       led_puts("L2");
-
-       led_puts("L3");
-
-#ifdef CONFIG_SPL_SERIAL_SUPPORT
-       preloader_console_init();
-#endif
-
-       led_puts("L4");
-
-       {
-               int res;
-
-               res = uniphier_sld8_umc_init(bd);
-               if (res < 0) {
-                       while (1)
-                               ;
-               }
-       }
-
-       led_puts("L5");
-
-       return 0;
-}
diff --git a/arch/arm/mach-uniphier/init/init.c b/arch/arm/mach-uniphier/init/init.c
deleted file mode 100644 (file)
index 77e5b99..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <debug_uart.h>
-#include <spl.h>
-
-#include "../init.h"
-#include "../soc-info.h"
-
-void spl_board_init(void)
-{
-       const struct uniphier_board_data *param;
-
-#ifdef CONFIG_DEBUG_UART
-       debug_uart_init();
-#endif
-
-       param = uniphier_get_board_param();
-       if (!param)
-               hang();
-
-       switch (uniphier_get_soc_type()) {
-#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
-       case SOC_UNIPHIER_SLD3:
-               uniphier_sld3_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD4)
-       case SOC_UNIPHIER_LD4:
-               uniphier_ld4_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
-       case SOC_UNIPHIER_PRO4:
-               uniphier_pro4_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
-       case SOC_UNIPHIER_SLD8:
-               uniphier_sld8_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
-       case SOC_UNIPHIER_PRO5:
-               uniphier_pro5_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_PXS2) || defined(CONFIG_ARCH_UNIPHIER_LD6B)
-       case SOC_UNIPHIER_PXS2:
-       case SOC_UNIPHIER_LD6B:
-               uniphier_pxs2_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD11)
-       case SOC_UNIPHIER_LD11:
-               uniphier_ld11_init(param);
-               break;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD20)
-       case SOC_UNIPHIER_LD20:
-               uniphier_ld20_init(param);
-               break;
-#endif
-       default:
-               break;
-       }
-}
diff --git a/arch/arm/mach-uniphier/spl_board_init.c b/arch/arm/mach-uniphier/spl_board_init.c
new file mode 100644 (file)
index 0000000..d1e1ea7
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2015-2016 Socionext Inc.
+ *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <debug_uart.h>
+#include <spl.h>
+
+#include "init.h"
+#include "micro-support-card.h"
+#include "soc-info.h"
+
+struct uniphier_spl_initdata {
+       enum uniphier_soc_id soc_id;
+       void (*bcu_init)(const struct uniphier_board_data *bd);
+       void (*early_clk_init)(void);
+       void (*sbc_init)(void);
+       int (*dpll_init)(const struct uniphier_board_data *bd);
+       int (*memconf_init)(const struct uniphier_board_data *bd);
+       void (*dram_clk_init)(void);
+       int (*umc_init)(const struct uniphier_board_data *bd);
+};
+
+static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
+#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
+       {
+               .soc_id = SOC_UNIPHIER_SLD3,
+               .bcu_init = uniphier_sld3_bcu_init,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_sbc_init_admulti,
+               .dpll_init = uniphier_sld3_dpll_init,
+               .memconf_init = uniphier_memconf_3ch_no_disbit_init,
+               .dram_clk_init = uniphier_sld3_dram_clk_init,
+               .umc_init = uniphier_sld3_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_LD4)
+       {
+               .soc_id = SOC_UNIPHIER_LD4,
+               .bcu_init = uniphier_ld4_bcu_init,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_ld4_sbc_init,
+               .dpll_init = uniphier_ld4_dpll_init,
+               .memconf_init = uniphier_memconf_2ch_init,
+               .dram_clk_init = uniphier_sld3_dram_clk_init,
+               .umc_init = uniphier_ld4_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
+       {
+               .soc_id = SOC_UNIPHIER_PRO4,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_sbc_init_savepin,
+               .dpll_init = uniphier_pro4_dpll_init,
+               .memconf_init = uniphier_memconf_2ch_init,
+               .dram_clk_init = uniphier_sld3_dram_clk_init,
+               .umc_init = uniphier_pro4_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
+       {
+               .soc_id = SOC_UNIPHIER_SLD8,
+               .bcu_init = uniphier_ld4_bcu_init,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_ld4_sbc_init,
+               .dpll_init = uniphier_sld8_dpll_init,
+               .memconf_init = uniphier_memconf_2ch_init,
+               .dram_clk_init = uniphier_sld3_dram_clk_init,
+               .umc_init = uniphier_sld8_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
+       {
+               .soc_id = SOC_UNIPHIER_PRO5,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_sbc_init_savepin,
+               .dpll_init = uniphier_pro5_dpll_init,
+               .memconf_init = uniphier_memconf_2ch_init,
+               .dram_clk_init = uniphier_pro5_dram_clk_init,
+               .umc_init = uniphier_pro5_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
+       {
+               .soc_id = SOC_UNIPHIER_PXS2,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_pxs2_sbc_init,
+               .dpll_init = uniphier_pxs2_dpll_init,
+               .memconf_init = uniphier_memconf_3ch_init,
+               .dram_clk_init = uniphier_pxs2_dram_clk_init,
+               .umc_init = uniphier_pxs2_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
+       {
+               .soc_id = SOC_UNIPHIER_LD6B,
+               .early_clk_init = uniphier_sld3_early_clk_init,
+               .sbc_init = uniphier_pxs2_sbc_init,
+               .dpll_init = uniphier_pxs2_dpll_init,
+               .memconf_init = uniphier_memconf_3ch_init,
+               .dram_clk_init = uniphier_pxs2_dram_clk_init,
+               .umc_init = uniphier_pxs2_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_LD11)
+       {
+               .soc_id = SOC_UNIPHIER_LD11,
+               .early_clk_init = uniphier_ld11_early_clk_init,
+               .sbc_init = uniphier_ld11_sbc_init,
+               .dpll_init = uniphier_ld11_dpll_init,
+               .memconf_init = uniphier_memconf_2ch_init,
+               .dram_clk_init = uniphier_ld11_dram_clk_init,
+               .umc_init = uniphier_ld11_umc_init,
+       },
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_LD20)
+       {
+               .soc_id = SOC_UNIPHIER_LD20,
+               .early_clk_init = uniphier_ld11_early_clk_init,
+               .sbc_init = uniphier_ld11_sbc_init,
+               .dpll_init = uniphier_ld20_dpll_init,
+               .memconf_init = uniphier_memconf_3ch_init,
+               .dram_clk_init = uniphier_ld20_dram_clk_init,
+               .umc_init = uniphier_ld20_umc_init,
+       },
+#endif
+};
+
+static const struct uniphier_spl_initdata *uniphier_get_spl_initdata(
+                                               enum uniphier_soc_id soc_id)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(uniphier_spl_initdata); i++) {
+               if (uniphier_spl_initdata[i].soc_id == soc_id)
+                       return &uniphier_spl_initdata[i];
+       }
+
+       return NULL;
+}
+
+void spl_board_init(void)
+{
+       const struct uniphier_board_data *bd;
+       const struct uniphier_spl_initdata *initdata;
+       enum uniphier_soc_id soc_id;
+       int ret;
+
+#ifdef CONFIG_DEBUG_UART
+       debug_uart_init();
+#endif
+
+       bd = uniphier_get_board_param();
+       if (!bd)
+               hang();
+
+       soc_id = uniphier_get_soc_type();
+       initdata = uniphier_get_spl_initdata(soc_id);
+       if (!initdata)
+               hang();
+
+       if (initdata->bcu_init)
+               initdata->bcu_init(bd);
+
+       initdata->sbc_init();
+
+       initdata->early_clk_init();
+
+       support_card_init();
+
+       led_puts("L0");
+
+#ifdef CONFIG_SPL_SERIAL_SUPPORT
+       preloader_console_init();
+#endif
+
+       led_puts("L1");
+
+       ret = initdata->dpll_init(bd);
+       if (ret) {
+               pr_err("failed to init DPLL\n");
+               hang();
+       }
+
+       led_puts("L2");
+
+       ret = initdata->memconf_init(bd);
+       if (ret) {
+               pr_err("failed to init MEMCONF\n");
+               hang();
+       }
+
+       led_puts("L3");
+
+       initdata->dram_clk_init();
+
+       led_puts("L4");
+
+       ret = initdata->umc_init(bd);
+       if (ret) {
+               pr_err("failed to init DRAM\n");
+               hang();
+       }
+
+       led_puts("L5");
+}