From patchwork Sun Jan 15 05:59:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 91519 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp888730qgi; Sat, 14 Jan 2017 22:00:51 -0800 (PST) X-Received: by 10.28.103.3 with SMTP id b3mr7356628wmc.24.1484460051755; Sat, 14 Jan 2017 22:00:51 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id p198si8016498wme.14.2017.01.14.22.00.51; Sat, 14 Jan 2017 22:00:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D3D37B3877; Sun, 15 Jan 2017 07:00:37 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id npzB1OLy9X6k; Sun, 15 Jan 2017 07:00:37 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 25D22B38BF; Sun, 15 Jan 2017 07:00:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10A7BA75D2 for ; Sun, 15 Jan 2017 06:59:41 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r7K7O729mvDe for ; Sun, 15 Jan 2017 06:59:40 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by theia.denx.de (Postfix) with ESMTPS id 38E9CA75F9 for ; Sun, 15 Jan 2017 06:59:36 +0100 (CET) Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-10.nifty.com with ESMTP id v0F5xD3m016694; Sun, 15 Jan 2017 14:59:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v0F5xD3m016694 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1484459961; bh=LUxkRhD/VjukrwkkcVCBdPjN9YOQe3UAjxE2V0L84tE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y0KmLA3jdrit8h0RsSiKNGMxV4qsK6TdqzxVWax00JT9oIzY0btSDPOQWpXvd5k4k ++cXYrHI0j0sVTWaoMRPUjbz03hVIywUXUNTRubYU1jigaONclQC2Y0dTdyh7WaQ/+ fr8yKzD45vLiyXeprLNJS50RzNIZhzN1gtcoquLePoevec3ZRsqU8fh5otzspk8Jit /t7mAOKYqiXN7dmd78ld0PsLbQKmNFguRWIOSFYEEjO885pA+gNMVoCM5MRkshwiSO TjP4r4D2b+OSQQ9qdfQSu/LrA7VCr0DgmQ73Q+mMi0iEI7Npsp1TRhoBSjGh5mPQIP 6jHB+Gi03SFrQ== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sun, 15 Jan 2017 14:59:09 +0900 Message-Id: <1484459950-8644-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484459950-8644-1-git-send-email-yamada.masahiro@socionext.com> References: <1484459950-8644-1-git-send-email-yamada.masahiro@socionext.com> Cc: Albert Aribaud Subject: [U-Boot] [PATCH 8/9] ARM: uniphier: refactor spl_init_board() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- arch/arm/mach-uniphier/Makefile | 3 +- arch/arm/mach-uniphier/clk/Makefile | 6 +- arch/arm/mach-uniphier/clk/dpll-pro5.c | 6 + arch/arm/mach-uniphier/clk/dpll-pxs2.c | 6 + arch/arm/mach-uniphier/dram/Makefile | 2 + arch/arm/mach-uniphier/dram/umc-pro5.c | 12 ++ arch/arm/mach-uniphier/dram/umc-sld3.c | 6 + arch/arm/mach-uniphier/init.h | 4 + arch/arm/mach-uniphier/init/Makefile | 15 --- arch/arm/mach-uniphier/init/init-ld11.c | 58 --------- arch/arm/mach-uniphier/init/init-ld20.c | 56 --------- arch/arm/mach-uniphier/init/init-ld4.c | 57 --------- arch/arm/mach-uniphier/init/init-pro4.c | 55 --------- arch/arm/mach-uniphier/init/init-pro5.c | 41 ------- arch/arm/mach-uniphier/init/init-pxs2.c | 47 ------- arch/arm/mach-uniphier/init/init-sld3.c | 47 ------- arch/arm/mach-uniphier/init/init-sld8.c | 57 --------- arch/arm/mach-uniphier/init/init.c | 71 ----------- arch/arm/mach-uniphier/spl_board_init.c | 209 ++++++++++++++++++++++++++++++++ 19 files changed, 250 insertions(+), 508 deletions(-) create mode 100644 arch/arm/mach-uniphier/clk/dpll-pro5.c create mode 100644 arch/arm/mach-uniphier/clk/dpll-pxs2.c create mode 100644 arch/arm/mach-uniphier/dram/umc-pro5.c create mode 100644 arch/arm/mach-uniphier/dram/umc-sld3.c delete mode 100644 arch/arm/mach-uniphier/init/Makefile delete mode 100644 arch/arm/mach-uniphier/init/init-ld11.c delete mode 100644 arch/arm/mach-uniphier/init/init-ld20.c delete mode 100644 arch/arm/mach-uniphier/init/init-ld4.c delete mode 100644 arch/arm/mach-uniphier/init/init-pro4.c delete mode 100644 arch/arm/mach-uniphier/init/init-pro5.c delete mode 100644 arch/arm/mach-uniphier/init/init-pxs2.c delete mode 100644 arch/arm/mach-uniphier/init/init-sld3.c delete mode 100644 arch/arm/mach-uniphier/init/init-sld8.c delete mode 100644 arch/arm/mach-uniphier/init/init.c create mode 100644 arch/arm/mach-uniphier/spl_board_init.c -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile index 98b42a0..7f1abd0 100644 --- a/arch/arm/mach-uniphier/Makefile +++ b/arch/arm/mach-uniphier/Makefile @@ -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 diff --git a/arch/arm/mach-uniphier/clk/Makefile b/arch/arm/mach-uniphier/clk/Makefile index 765660f..eff8383 100644 --- a/arch/arm/mach-uniphier/clk/Makefile +++ b/arch/arm/mach-uniphier/clk/Makefile @@ -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 index 0000000..d3a42c7 --- /dev/null +++ b/arch/arm/mach-uniphier/clk/dpll-pro5.c @@ -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 index 0000000..328ebf6 --- /dev/null +++ b/arch/arm/mach-uniphier/clk/dpll-pxs2.c @@ -0,0 +1,6 @@ +#include "../init.h" + +int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd) +{ + return 0; +} diff --git a/arch/arm/mach-uniphier/dram/Makefile b/arch/arm/mach-uniphier/dram/Makefile index 5b9d892..2ce6199 100644 --- a/arch/arm/mach-uniphier/dram/Makefile +++ b/arch/arm/mach-uniphier/dram/Makefile @@ -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 index 0000000..4f34d1f --- /dev/null +++ b/arch/arm/mach-uniphier/dram/umc-pro5.c @@ -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 index 0000000..99249eb --- /dev/null +++ b/arch/arm/mach-uniphier/dram/umc-sld3.c @@ -0,0 +1,6 @@ +#include "../init.h" + +int uniphier_sld3_umc_init(const struct uniphier_board_data *bd) +{ + return 0; +} diff --git a/arch/arm/mach-uniphier/init.h b/arch/arm/mach-uniphier/init.h index 18393e5..2f9dc39 100644 --- a/arch/arm/mach-uniphier/init.h +++ b/arch/arm/mach-uniphier/init.h @@ -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 index dcaa445..0000000 --- a/arch/arm/mach-uniphier/init/Makefile +++ /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 index e19dc5b..0000000 --- a/arch/arm/mach-uniphier/init/init-ld11.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2016 Socionext Inc. - * Author: Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index e056d5d..0000000 --- a/arch/arm/mach-uniphier/init/init-ld20.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2016 Socionext Inc. - * Author: Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index a5b9493..0000000 --- a/arch/arm/mach-uniphier/init/init-ld4.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2013-2015 Panasonic Corporation - * Copyright (C) 2015-2016 Socionext Inc. - * Author: Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index c277071..0000000 --- a/arch/arm/mach-uniphier/init/init-pro4.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2013-2015 Panasonic Corporation - * Copyright (C) 2015-2016 Socionext Inc. - * Author: Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index 4e7041b..0000000 --- a/arch/arm/mach-uniphier/init/init-pro5.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2015 Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index f7d5b48..0000000 --- a/arch/arm/mach-uniphier/init/init-pxs2.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2015 Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index 50d9eaf..0000000 --- a/arch/arm/mach-uniphier/init/init-sld3.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2013-2015 Panasonic Corporation - * Copyright (C) 2015-2016 Socionext Inc. - * Author: Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index 8da2843..0000000 --- a/arch/arm/mach-uniphier/init/init-sld8.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2013-2015 Panasonic Corporation - * Copyright (C) 2015-2016 Socionext Inc. - * Author: Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#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 index 77e5b99..0000000 --- a/arch/arm/mach-uniphier/init/init.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2015 Masahiro Yamada - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include -#include - -#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 index 0000000..d1e1ea7 --- /dev/null +++ b/arch/arm/mach-uniphier/spl_board_init.c @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2015-2016 Socionext Inc. + * Author: Masahiro Yamada + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +#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"); +}