Re: [U-Boot] [PATCH v2 07/44] Use separate options for TPL support

2016-09-06 Thread Simon Glass
Hi Tom,

On 6 September 2016 at 12:06, Tom Rini  wrote:
> On Mon, Aug 29, 2016 at 06:21:15PM -0600, Simon Glass wrote:
>
>> 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 
>
> For the record, I think this shows that we need to think about how we
> setup and build SPL/TPL/... but I also think we can't fix it until we've
> unwound what we have now so it's clear what is and isn't used, what is
> and isn't a pain about it and how at the end of the day users also need
> to build something, something that works and ideally not spend more time
> doing all of that than it takes to actually just build what they want.

Agreed. There must be a better way.

IMO we need to move things in stages. Getting to Kconfig is step
forward. I took a bit of a look at generalising the build a bit but it
seems like something better down later. Masahiro has done a lot of
improvements here.

My tentative conclusion was that if we could run the build for U-Boot
proper and then for SPL using a common Makefile (i.e. without a
special Makefile.spl) then we might get somewhere. One day...

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 07/44] Use separate options for TPL support

2016-09-06 Thread Tom Rini
On Mon, Aug 29, 2016 at 06:21:15PM -0600, Simon Glass wrote:

> 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 

For the record, I think this shows that we need to think about how we
setup and build SPL/TPL/... but I also think we can't fix it until we've
unwound what we have now so it's clear what is and isn't used, what is
and isn't a pain about it and how at the end of the day users also need
to build something, something that works and ideally not spend more time
doing all of that than it takes to actually just build what they want.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/44] Use separate options for TPL support

2016-08-29 Thread Simon Glass
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 
---

Changes in v2: None

 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 21619b3..9a9a065 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 7861d34..ca98273 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 e9f0dea..a8d833b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -866,17 +866,20 @@ int   getc(void);
 inttstc(void);
 
 /* stdout */
-#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT)
-#defineputc(...) 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);
 intprintf(const char *fmt, ...)
__attribute__ ((format (__printf__, 1, 2)));
 intvprintf(const char *fmt, va_list args);
+#else
+#defineputc(...) 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 f75919d..8ec1a90 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