From 76f1f38816d8763b51e5f1d6ca099a88aa1fd077 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 12 Sep 2016 23:18:25 -0600 Subject: [PATCH] Use separate options for TPL support At present TPL uses the same options as SPL support. In a few cases the board config enables or disables the SPL options depending on whether CONFIG_TPL_BUILD is defined. With the move to Kconfig, options are determined for the whole build and (without a hack like an #undef in a header file) cannot be controlled in this way. Create new TPL options for these and update users. This will allow Kconfig conversion to proceed for these boards. Signed-off-by: Simon Glass --- common/Makefile | 12 +++++++++++- drivers/Makefile | 16 +++++++++++++++- include/common.h | 15 +++++++++------ include/configs/C29XPCIE.h | 16 ++++++++-------- include/configs/P1010RDB.h | 14 +++++++------- include/configs/P1022DS.h | 14 +++++++------- include/configs/p1_p2_rdb_pc.h | 14 +++++++------- lib/Makefile | 9 +++++++-- scripts/Makefile.spl | 10 +++++++++- 9 files changed, 80 insertions(+), 40 deletions(-) diff --git a/common/Makefile b/common/Makefile index 21619b304d..9a9a065ad2 100644 --- a/common/Makefile +++ b/common/Makefile @@ -99,10 +99,16 @@ obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o obj-$(CONFIG_USB_STORAGE) += usb_storage.o endif # environment -ifdef CONFIG_SPL_ENV_SUPPORT +ifdef CONFIG_TPL_BUILD +obj-$(CONFIG_TPL_ENV_SUPPORT) += env_attr.o +obj-$(CONFIG_TPL_ENV_SUPPORT) += env_flags.o +obj-$(CONFIG_TPL_ENV_SUPPORT) += env_callback.o +else obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o +endif +ifneq ($(CONFIG_TPL_ENV_SUPPORT)$(CONFIG_SPL_ENV_SUPPORT),) obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o @@ -123,7 +129,11 @@ obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o obj-$(CONFIG_HWCONFIG) += hwconfig.o obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o ifdef CONFIG_SPL_BUILD +ifdef CONFIG_TPL_BUILD +obj-$(CONFIG_TPL_SERIAL_SUPPORT) += console.o +else obj-$(CONFIG_SPL_SERIAL_SUPPORT) += console.o +endif else obj-y += console.o endif diff --git a/drivers/Makefile b/drivers/Makefile index 7861d34603..ca98273134 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -40,8 +40,22 @@ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/ obj-$(CONFIG_SPL_MMC_SUPPORT) += block/ +endif + +ifdef CONFIG_TPL_BUILD + +obj-$(CONFIG_TPL_I2C_SUPPORT) += i2c/ +obj-$(CONFIG_TPL_DRIVERS_MISC_SUPPORT) += misc/ sysreset/ +obj-$(CONFIG_TPL_MMC_SUPPORT) += mmc/ +obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/ +obj-$(CONFIG_TPL_NAND_SUPPORT) += mtd/nand/ +obj-$(CONFIG_TPL_SERIAL_SUPPORT) += serial/ +obj-$(CONFIG_TPL_SPI_FLASH_SUPPORT) += mtd/spi/ +obj-$(CONFIG_TPL_SPI_SUPPORT) += spi/ + +endif -else +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += adc/ obj-$(CONFIG_DM_DEMO) += demo/ diff --git a/include/common.h b/include/common.h index e9f0dea308..a8d833b989 100644 --- a/include/common.h +++ b/include/common.h @@ -866,17 +866,20 @@ int getc(void); int tstc(void); /* stdout */ -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT) -#define putc(...) do { } while (0) -#define puts(...) do { } while (0) -#define printf(...) do { } while (0) -#define vprintf(...) do { } while (0) -#else +#if !defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \ + (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \ + defined(CONFIG_SPL_SERIAL_SUPPORT)) void putc(const char c); void puts(const char *s); int printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); int vprintf(const char *fmt, va_list args); +#else +#define putc(...) do { } while (0) +#define puts(...) do { } while (0) +#define printf(...) do { } while (0) +#define vprintf(...) do { } while (0) #endif /* stderr */ diff --git a/include/configs/C29XPCIE.h b/include/configs/C29XPCIE.h index f75919dc89..8ec1a90595 100644 --- a/include/configs/C29XPCIE.h +++ b/include/configs/C29XPCIE.h @@ -27,15 +27,15 @@ #ifdef CONFIG_TPL_BUILD #define CONFIG_SPL_NAND_BOOT #define CONFIG_SPL_FLUSH_IMAGE -#define CONFIG_SPL_ENV_SUPPORT +#define CONFIG_TPL_ENV_SUPPORT #define CONFIG_SPL_NAND_INIT -#define CONFIG_SPL_SERIAL_SUPPORT -#define CONFIG_SPL_LIBGENERIC_SUPPORT -#define CONFIG_SPL_LIBCOMMON_SUPPORT -#define CONFIG_SPL_I2C_SUPPORT -#define CONFIG_SPL_DRIVERS_MISC_SUPPORT -#define CONFIG_SPL_NAND_SUPPORT -#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT +#define CONFIG_TPL_SERIAL_SUPPORT +#define CONFIG_TPL_LIBGENERIC_SUPPORT +#define CONFIG_TPL_LIBCOMMON_SUPPORT +#define CONFIG_TPL_I2C_SUPPORT +#define CONFIG_TPL_DRIVERS_MISC_SUPPORT +#define CONFIG_TPL_NAND_SUPPORT +#define CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT #define CONFIG_SPL_COMMON_INIT_DDR #define CONFIG_SPL_MAX_SIZE (128 << 10) #define CONFIG_SPL_TEXT_BASE 0xf8f81000 diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index 0c84622b4d..04ff3caf05 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -106,15 +106,15 @@ #ifdef CONFIG_TPL_BUILD #define CONFIG_SPL_NAND_BOOT #define CONFIG_SPL_FLUSH_IMAGE -#define CONFIG_SPL_ENV_SUPPORT +#define CONFIG_TPL_ENV_SUPPORT #define CONFIG_SPL_NAND_INIT -#define CONFIG_SPL_SERIAL_SUPPORT -#define CONFIG_SPL_LIBGENERIC_SUPPORT -#define CONFIG_SPL_LIBCOMMON_SUPPORT -#define CONFIG_SPL_I2C_SUPPORT -#define CONFIG_SPL_NAND_SUPPORT +#define CONFIG_TPL_SERIAL_SUPPORT +#define CONFIG_TPL_LIBGENERIC_SUPPORT +#define CONFIG_TPL_LIBCOMMON_SUPPORT +#define CONFIG_TPL_I2C_SUPPORT +#define CONFIG_TPL_NAND_SUPPORT #define CONFIG_SPL_DRIVERS_MISC_SUPPORT -#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT +#define CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT #define CONFIG_SPL_COMMON_INIT_DDR #define CONFIG_SPL_MAX_SIZE (128 << 10) #define CONFIG_SPL_TEXT_BASE 0xD0001000 diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h index 9fbc128384..7e4cd12dda 100644 --- a/include/configs/P1022DS.h +++ b/include/configs/P1022DS.h @@ -78,14 +78,14 @@ #ifdef CONFIG_TPL_BUILD #define CONFIG_SPL_NAND_BOOT #define CONFIG_SPL_FLUSH_IMAGE -#define CONFIG_SPL_ENV_SUPPORT +#define CONFIG_TPL_ENV_SUPPORT #define CONFIG_SPL_NAND_INIT -#define CONFIG_SPL_SERIAL_SUPPORT -#define CONFIG_SPL_LIBGENERIC_SUPPORT -#define CONFIG_SPL_LIBCOMMON_SUPPORT -#define CONFIG_SPL_I2C_SUPPORT -#define CONFIG_SPL_NAND_SUPPORT -#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT +#define CONFIG_TPL_SERIAL_SUPPORT +#define CONFIG_TPL_LIBGENERIC_SUPPORT +#define CONFIG_TPL_LIBCOMMON_SUPPORT +#define CONFIG_TPL_I2C_SUPPORT +#define CONFIG_TPL_NAND_SUPPORT +#define CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT #define CONFIG_SPL_COMMON_INIT_DDR #define CONFIG_SPL_MAX_SIZE (128 << 10) #define CONFIG_SPL_TEXT_BASE 0xf8f81000 diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index ae0f6a5638..3daba7011a 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -241,14 +241,14 @@ #ifdef CONFIG_TPL_BUILD #define CONFIG_SPL_NAND_BOOT #define CONFIG_SPL_FLUSH_IMAGE -#define CONFIG_SPL_ENV_SUPPORT +#define CONFIG_TPL_ENV_SUPPORT #define CONFIG_SPL_NAND_INIT -#define CONFIG_SPL_SERIAL_SUPPORT -#define CONFIG_SPL_LIBGENERIC_SUPPORT -#define CONFIG_SPL_LIBCOMMON_SUPPORT -#define CONFIG_SPL_I2C_SUPPORT -#define CONFIG_SPL_NAND_SUPPORT -#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT +#define CONFIG_TPL_SERIAL_SUPPORT +#define CONFIG_TPL_LIBGENERIC_SUPPORT +#define CONFIG_TPL_LIBCOMMON_SUPPORT +#define CONFIG_TPL_I2C_SUPPORT +#define CONFIG_TPL_NAND_SUPPORT +#define CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT #define CONFIG_SPL_COMMON_INIT_DDR #define CONFIG_SPL_MAX_SIZE (128 << 10) #define CONFIG_SPL_TEXT_BASE 0xf8f81000 diff --git a/lib/Makefile b/lib/Makefile index f6a8ba1227..c81bfeb2db 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -78,11 +78,16 @@ obj-$(CONFIG_LIB_UUID) += uuid.o obj-$(CONFIG_LIB_RAND) += rand.o ifdef CONFIG_SPL_BUILD +ifdef CONFIG_TPL_BUILD +SERIAL_SUPPORT := $(CONFIG_TPL_SERIAL_SUPPORT) +else +SERIAL_SUPPORT := $(CONFIG_SPL_SERIAL_SUPPORT) +endif # SPL U-Boot may use full-printf, tiny-printf or none at all ifdef CONFIG_USE_TINY_PRINTF -obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o panic.o strto.o +obj-$(SERIAL_SUPPORT) += tiny-printf.o panic.o strto.o else -obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o strmhz.o +obj-$(SERIAL_SUPPORT) += vsprintf.o panic.o strto.o strmhz.o endif else # Main U-Boot always uses the full printf support diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 3ba974226b..4994fa887b 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -54,12 +54,20 @@ libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ libs-y += common/init/ + +# Special handling for a few options which support SPL/TPL +ifeq ($(CONFIG_TPL_BUILD),y) +libs-$(CONFIG_TPL_LIBCOMMON_SUPPORT) += common/ cmd/ +libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/ +else libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ +libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ +endif + libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ libs-y += drivers/ libs-y += dts/ libs-y += fs/ -libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ libs-$(CONFIG_SPL_NET_SUPPORT) += net/ -- 2.39.5