From 30129f2f83f2d63123c91c28e3d0dd9c759233d5 Mon Sep 17 00:00:00 2001 From: David Wu Date: Tue, 30 Jan 2018 13:06:24 +0800 Subject: [PATCH] config: Add CONFIG_TINY_TPL to disable SPL framework at TPL Some devices cann't use SPL framework at TPL stage, but the CONFIG_SPL_FRAMEWORK is still defined at TPL stage, so need to separate them with CONFIG_TINY_TPL. If the SPL framewrok was used both at TPL and SPL stage, CONFIG_TINY_TPL is not defined. If the SPL framewrok was used at SPL stage, but not use at TPL, need to define CONFIG_TINY_TPL. Change-Id: Iabb7e0377ee00311ca468cb8ff7544c96bd999d6 Signed-off-by: David Wu --- arch/arm/include/asm/arch-rockchip/sys_proto.h | 2 +- arch/arm/lib/crt0.S | 2 +- arch/arm/mach-rockchip/tpl.c | 14 ++++++++++++-- common/spl/Kconfig | 5 +++++ common/spl/Makefile | 9 +++++++++ scripts/Makefile.spl | 7 +++++++ scripts/config_whitelist.txt | 1 + 7 files changed, 36 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/sys_proto.h b/arch/arm/include/asm/arch-rockchip/sys_proto.h index 7b7e336bda..f66bccee2f 100644 --- a/arch/arm/include/asm/arch-rockchip/sys_proto.h +++ b/arch/arm/include/asm/arch-rockchip/sys_proto.h @@ -7,7 +7,7 @@ #ifndef _ASM_ARCH_SYS_PROTO_H #define _ASM_ARCH_SYS_PROTO_H -#ifndef CONFIG_SPL_FRAMEWORK +#if !defined(CONFIG_SPL_FRAMEWORK) || defined(CONFIG_TINY_TPL) void sdram_init(void); #endif diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 3c1c603039..f7e1755ea1 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -121,7 +121,7 @@ here: bl c_runtime_cpu_setup /* we still call old routine here */ #endif -#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_FRAMEWORK) +#if !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FRAMEWORK) && !defined(CONFIG_TPL_BUILD)) # ifdef CONFIG_SPL_BUILD /* Use a DRAM stack for the rest of SPL, if requested */ bl spl_relocate_stack_gd diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c index 12b6149420..d712130d55 100644 --- a/arch/arm/mach-rockchip/tpl.c +++ b/arch/arm/mach-rockchip/tpl.c @@ -14,6 +14,7 @@ #include #include #include +#include #ifndef CONFIG_TPL_LIBCOMMON_SUPPORT #define CONFIG_SYS_NS16550_COM1 CONFIG_DEBUG_UART_BASE @@ -70,8 +71,10 @@ __weak int arch_cpu_init(void) void board_init_f(ulong dummy) { +#if defined(CONFIG_SPL_FRAMEWORK) && !defined(CONFIG_TINY_TPL) struct udevice *dev; int ret; +#endif rockchip_stimer_init(); arch_cpu_init(); @@ -88,28 +91,35 @@ void board_init_f(ulong dummy) debug_uart_init(); printascii("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ U_BOOT_TIME ")\n"); - #endif + +#if defined(CONFIG_SPL_FRAMEWORK) && !defined(CONFIG_TINY_TPL) ret = spl_early_init(); if (ret) { debug("spl_early_init() failed: %d\n", ret); hang(); } +#endif /* Init ARM arch timer */ timer_init(); + +#if defined(CONFIG_SPL_FRAMEWORK) && !defined(CONFIG_TINY_TPL) ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) { printf("DRAM init failed: %d\n", ret); return; } +#else + sdram_init(); +#endif #if defined(CONFIG_TPL_ROCKCHIP_BACK_TO_BROM) && !defined(CONFIG_TPL_BOARD_INIT) back_to_bootrom(BROM_BOOT_NEXTSTAGE); #endif } -#ifndef CONFIG_SPL_FRAMEWORK +#if !(defined(CONFIG_SPL_FRAMEWORK) && !defined(CONFIG_TINY_TPL)) /* Place Holders */ void board_init_r(gd_t *id, ulong dest_addr) { diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 3e6f526e37..0be334db2a 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -852,6 +852,11 @@ config TPL_LIBGENERIC_SUPPORT Enable support for generic U-Boot libraries within TPL. See SPL_LIBGENERIC_SUPPORT for details. +config TINY_TPL + bool "Support not to use spl framework in TPL" + help + Enable support for not using spl framework in TPL, to reduce the TPL size. + config TPL_MPC8XXX_INIT_DDR_SUPPORT bool "Support MPC8XXX DDR init" help diff --git a/common/spl/Makefile b/common/spl/Makefile index 9918a2e6f1..2267db8801 100644 --- a/common/spl/Makefile +++ b/common/spl/Makefile @@ -8,8 +8,17 @@ # Based on common/Makefile. # +ifeq ($(CONFIG_TPL_BUILD), y) +ifndef CONFIG_TINY_TPL +obj-$(CONFIG_SPL_FRAMEWORK) += spl.o +endif +else ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FRAMEWORK) += spl.o +endif +endif + +ifdef CONFIG_SPL_BUILD obj-$(CONFIG_$(SPL_TPL_)BOOTROM_SUPPORT) += spl_bootrom.o obj-$(CONFIG_$(SPL_TPL_)LOAD_FIT) += spl_fit.o obj-$(CONFIG_$(SPL_TPL_)NOR_SUPPORT) += spl_nor.o diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 64390e5785..0d0426757d 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -64,7 +64,14 @@ HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makef libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ +ifeq ($(CONFIG_TPL_BUILD),y) +ifndef CONFIG_TINY_TPL libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ +endif +else +libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ +endif + libs-y += common/init/ # Special handling for a few options which support SPL/TPL diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index f22cf55ae3..12430e5d73 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -4870,6 +4870,7 @@ CONFIG_TIZEN CONFIG_TI_KEYSTONE_SERDES CONFIG_TI_KSNAV CONFIG_TI_SPI_MMAP +CONFIG_TINY_TPL CONFIG_TMU_TIMER CONFIG_TPL_PAD_TO CONFIG_TPM_TIS_BASE_ADDRESS