ARM: uniphier: refactor spl_init_board()
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>
This commit is contained in:
		
							parent
							
								
									b61664e230
								
							
						
					
					
						commit
						a8e6300d48
					
				|  | @ -4,8 +4,9 @@ | ||||||
| 
 | 
 | ||||||
| ifdef CONFIG_SPL_BUILD | ifdef CONFIG_SPL_BUILD | ||||||
| 
 | 
 | ||||||
|  | obj-y += spl_board_init.o | ||||||
| obj-y += memconf.o | obj-y += memconf.o | ||||||
| obj-y += init/ bcu/ | obj-y += bcu/ | ||||||
| obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc/ | obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc/ | ||||||
| 
 | 
 | ||||||
| else | else | ||||||
|  |  | ||||||
|  | @ -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_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_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_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_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 | 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 | 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_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 | obj-$(CONFIG_ARCH_UNIPHIER_LD20)	+= clk-early-ld11.o clk-dram-ld20.o dpll-ld20.o | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | #include "../init.h" | ||||||
|  | 
 | ||||||
|  | int uniphier_pro5_dpll_init(const struct uniphier_board_data *bd) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | #include "../init.h" | ||||||
|  | 
 | ||||||
|  | int uniphier_pxs2_dpll_init(const struct uniphier_board_data *bd) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | @ -4,12 +4,14 @@ | ||||||
| 
 | 
 | ||||||
| ifdef CONFIG_SPL_BUILD | ifdef CONFIG_SPL_BUILD | ||||||
| 
 | 
 | ||||||
|  | obj-$(CONFIG_ARCH_UNIPHIER_SLD3)	+= umc-sld3.o | ||||||
| obj-$(CONFIG_ARCH_UNIPHIER_LD4)		+= umc-ld4.o \
 | obj-$(CONFIG_ARCH_UNIPHIER_LD4)		+= umc-ld4.o \
 | ||||||
| 					   ddrphy-training.o ddrphy-ld4.o | 					   ddrphy-training.o ddrphy-ld4.o | ||||||
| obj-$(CONFIG_ARCH_UNIPHIER_PRO4)	+= umc-pro4.o \
 | obj-$(CONFIG_ARCH_UNIPHIER_PRO4)	+= umc-pro4.o \
 | ||||||
| 					   ddrphy-training.o ddrphy-ld4.o | 					   ddrphy-training.o ddrphy-ld4.o | ||||||
| obj-$(CONFIG_ARCH_UNIPHIER_SLD8)	+= umc-sld8.o \
 | obj-$(CONFIG_ARCH_UNIPHIER_SLD8)	+= umc-sld8.o \
 | ||||||
| 					   ddrphy-training.o ddrphy-ld4.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_PXS2)	+= umc-pxs2.o | ||||||
| obj-$(CONFIG_ARCH_UNIPHIER_LD6B)	+= umc-pxs2.o | obj-$(CONFIG_ARCH_UNIPHIER_LD6B)	+= umc-pxs2.o | ||||||
| obj-$(CONFIG_ARCH_UNIPHIER_LD11)	+= umc-ld11.o | obj-$(CONFIG_ARCH_UNIPHIER_LD11)	+= umc-ld11.o | ||||||
|  |  | ||||||
|  | @ -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; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | #include "../init.h" | ||||||
|  | 
 | ||||||
|  | int uniphier_sld3_umc_init(const struct uniphier_board_data *bd) | ||||||
|  | { | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | @ -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_ld4_dpll_init(const struct uniphier_board_data *bd); | ||||||
| int uniphier_pro4_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_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_ld11_dpll_init(const struct uniphier_board_data *bd); | ||||||
| int uniphier_ld20_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_ld11_dram_clk_init(void); | ||||||
| void uniphier_ld20_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_ld4_umc_init(const struct uniphier_board_data *bd); | ||||||
| int uniphier_pro4_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_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_pxs2_umc_init(const struct uniphier_board_data *bd); | ||||||
| int uniphier_ld20_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); | int uniphier_ld11_umc_init(const struct uniphier_board_data *bd); | ||||||
|  |  | ||||||
|  | @ -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 |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| } |  | ||||||
|  | @ -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; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  | @ -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"); | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue