Skip to contentSkip to conversation

SPL: move CONFIG_SPL_*_LOAD to Kconfig

PATCH New Fabien Parent 3 participants 7 messages Dec 6, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover SPL: move CONFIG_SPL_*_LOAD to Kconfig

Moving to CONFIG_SPL_*_LOAD options to Kconfig offers several advantage:
* simpler config headers
* on some boards we can easily switch to another boot media without needing to modify the config headers.

This series fixes an issue in davinci where a wrong option was used in place of a CONFIG_SPL_*_LOAD option, then move the options to Kconfig options, and finally start using these Kconfig options for the OMAPL138-LCDK board.

Fabien Parent (3):
davinci: spl: use correct macro to select boot device
SPL: create Kconfig options for CONFIG_SPL_*_LOAD
davinci: omapl138_lcdk: use new CONFIG_SPL_*_LOAD Kconfig options

 arch/arm/mach-davinci/spl.c     |  2 +-
 common/spl/Kconfig              | 25 +++++++++++++++++++++++++
 configs/omapl138_lcdk_defconfig |  1 +
 include/configs/omapl138_lcdk.h |  2 --
 scripts/config_whitelist.txt    |  3 ---
 5 files changed, 27 insertions(+), 6 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 davinci: spl: use correct macro to select boot device

The macro used to select the boot device is not the intended one. It should be CONFIG_SPL_NAND_LOAD and not CONFIG_SPL_NAND_SIMPLE.

Using the correct config option will help move them to Kconfig option.

Every davinci board that use the SPL are defining both CONFIG_SPL_NAND_LOAD and CONFIG_SPL_NAND_SIMPLE at the same place, so there should be no issue created by this change.

---
 arch/arm/mach-davinci/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-davinci/spl.c +1 -1
index 0aeaa7d8b7..9d5a173701 100644
@@ -52,7 +52,7 @@ u32 spl_boot_mode(const u32 boot_device)
 
 u32 spl_boot_device(void)
 {
-#ifdef CONFIG_SPL_NAND_SIMPLE
+#ifdef CONFIG_SPL_NAND_LOAD
 	return BOOT_DEVICE_NAND;
 #elif defined(CONFIG_SPL_SPI_LOAD)
 	return BOOT_DEVICE_SPI;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 SPL: create Kconfig options for CONFIG_SPL_*_LOAD

In reply to Fabien Parent

In order to clean up the config headers and also to allow to easily switch the boot device for some boards without having to modify the config headers, it is better to move the options to Kconfig. This commit move the CONFIG_SPL_*_LOAD options to Kconfig files.

---
 common/spl/Kconfig           | 25 +++++++++++++++++++++++++
 scripts/config_whitelist.txt |  3 ---
 2 files changed, 25 insertions(+), 3 deletions(-)
common/spl/Kconfig +25 -0
index cba51f5df6..9313870566 100644
@@ -97,6 +97,31 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	  Address on the MMC to load U-Boot from, when the MMC is being used
 	  in raw mode. Units: MMC sectors (1 sector = 512 bytes).
 
+config SPL_SELECT_BOOT_MEDIA
+	bool "Select the media to boot from"
+	depends on SPL
+	help
+	  Enable selection of the media that will be used to load u-boot or
+	  the OS. This is not a must, some SoCs need this, some not.
+
+choice
+	prompt "Boot media"
+	depends on SPL_SELECT_BOOT_MEDIA
+
+config SPL_NAND_LOAD
+	bool "Load u-boot or OS from NAND"
+	depends on SPL_NAND_SUPPORT
+
+config SPL_SPI_LOAD
+	bool "Load u-boot or OS from SPI"
+	depends on SPL_SPI_FLASH_SUPPORT
+
+config SPL_MMC_LOAD
+	bool "Load u-boot or OS from MMC"
+	depends on SPL_MMC_SUPPORT
+
+endchoice
+
 config TPL
 	bool
 	depends on SPL && SUPPORT_TPL
scripts/config_whitelist.txt +0 -3
index 8814841e1f..f9fb4b59f8 100644
@@ -4163,7 +4163,6 @@ CONFIG_SPL_MAX_FOOTPRINT
 CONFIG_SPL_MAX_PEB_SIZE
 CONFIG_SPL_MAX_SIZE
 CONFIG_SPL_MMC_BOOT
-CONFIG_SPL_MMC_LOAD
 CONFIG_SPL_MMC_MINIMAL
 CONFIG_SPL_MPC83XX_WAIT_FOR_NAND
 CONFIG_SPL_MXS_PSWITCH_WAIT
@@ -4173,7 +4172,6 @@ CONFIG_SPL_NAND_BOOT
 CONFIG_SPL_NAND_DRIVERS
 CONFIG_SPL_NAND_ECC
 CONFIG_SPL_NAND_INIT
-CONFIG_SPL_NAND_LOAD
 CONFIG_SPL_NAND_MINIMAL
 CONFIG_SPL_NAND_MXS
 CONFIG_SPL_NAND_RAW_ONLY
@@ -4199,7 +4197,6 @@ CONFIG_SPL_SKIP_RELOCATE
 CONFIG_SPL_SPAACT_ADDR
 CONFIG_SPL_SPI_BOOT
 CONFIG_SPL_SPI_FLASH_MINIMAL
-CONFIG_SPL_SPI_LOAD
 CONFIG_SPL_STACK
 CONFIG_SPL_STACK_ADDR
 CONFIG_SPL_STACK_SIZE
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/3 davinci: omapl138_lcdk: use new CONFIG_SPL_*_LOAD Kconfig options

In reply to Fabien Parent

Instead of defining ourself the config options in the config header, let's use the new Kconfig options for it.

---
 configs/omapl138_lcdk_defconfig | 1 +
 include/configs/omapl138_lcdk.h | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
configs/omapl138_lcdk_defconfig +1 -0
index 52681c92d0..7199d90ae9 100644
@@ -11,6 +11,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SPL=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
+CONFIG_SPL_SELECT_BOOT_MEDIA=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot > "
 # CONFIG_CMD_IMLS is not set
include/configs/omapl138_lcdk.h +0 -2
index 7c2f4141c9..f0b786f394 100644
@@ -138,7 +138,6 @@
 #define CONFIG_ENV_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
 
 #ifdef CONFIG_USE_SPIFLASH
-#define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8000
 #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x30000
 #endif
@@ -198,7 +197,6 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_SIMPLE
-#define CONFIG_SPL_NAND_LOAD
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
Signature · 1 line
2.11.0
#4 lore raw

cover SPL: move CONFIG_SPL_*_LOAD to Kconfig

In reply to Fabien Parent
Quoted 14 lines · Fabien Parent

Moving to CONFIG_SPL_*_LOAD options to Kconfig offers several advantage:
* simpler config headers
* on some boards we can easily switch to another boot media without needing to modify the config headers.

This series fixes an issue in davinci where a wrong option was used in place of a CONFIG_SPL_*_LOAD option, then move the options to Kconfig options, and finally start using these Kconfig options for the OMAPL138-LCDK board.

Fabien Parent (3):
davinci: spl: use correct macro to select boot device
SPL: create Kconfig options for CONFIG_SPL_*_LOAD
davinci: omapl138_lcdk: use new CONFIG_SPL_*_LOAD Kconfig options

Quoted 6 lines
 arch/arm/mach-davinci/spl.c     |  2 +-
 common/spl/Kconfig              | 25 +++++++++++++++++++++++++
 configs/omapl138_lcdk_defconfig |  1 +
 include/configs/omapl138_lcdk.h |  2 --
 scripts/config_whitelist.txt    |  3 ---
 5 files changed, 27 insertions(+), 6 deletions(-)

So, I think this shows that some of the SPL framework needs to be revisited for davinci. First, lets make it clear what CONFIG_SPL_{SPI,NAND,MMC}_LOAD is doing.

CONFIG_SPL_MMC_LOAD is used to flag that on davinci we're loading U-Boot from MMC. It's not set / used today but I assume it was working when I introduced all of this.

CONFIG_SPL_NAND_LOAD is used for two things. First, it is used to flag that on davinci we're loading U-Boot from NAND. Second, it is used to enable the non-SPL_FRAMEWORK NAND driver (drivers/mtd/nand/nand_spl_load.c). This driver is not used on davinci.

CONFIG_SPL_SPI_LOAD is used for two things. First, it is used to flag that on davinci we're loading U-Boot from SPI flash. Second, it used globally to enable common/spl/spl_spi.c.

NAND boot is done here via CONFIG_SPL_NAND_SIMPLE which is the regular SPL framework based NAND driver (drivers/mtd/nand/nand_spl_simple.c). This also means that the patch to update CONFIG_SYS_NAND_U_BOOT_SIZE was not needed since we don't use that driver.

Now, I think that in retrospect arch/arm/mach-davinci/spl.c::spl_boot_device could be re-worked to key off of CONFIG_SPL_NAND_SIMPLE / CONFIG_SPL_SPI_SUPPORT / SPL_MMC_SUPPORT.

And a good but possibly complex series would be to consolidate the usage of SPL_SPI_SUPPORT, SPL_SPI_FLASH_SUPPORT and SPL_SPI_LOAD just in to SPL_SPI_SUPPORT. I'll probably try and do this myself as there's a ton of build testing and size checking to make sure nothing odd breaks here to do.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161206/50ed017b/attachment.sig>
#5 lore raw

cover SPL: move CONFIG_SPL_*_LOAD to Kconfig

Hi Tom,

Quoted 49 lines · Tom Rini
Quoted 14 lines · Fabien Parent

Moving to CONFIG_SPL_*_LOAD options to Kconfig offers several advantage:
* simpler config headers
* on some boards we can easily switch to another boot media without needing to modify the config headers.

This series fixes an issue in davinci where a wrong option was used in place of a CONFIG_SPL_*_LOAD option, then move the options to Kconfig options, and finally start using these Kconfig options for the OMAPL138-LCDK board.

Fabien Parent (3):
davinci: spl: use correct macro to select boot device
SPL: create Kconfig options for CONFIG_SPL_*_LOAD
davinci: omapl138_lcdk: use new CONFIG_SPL_*_LOAD Kconfig options

Quoted 6 lines
 arch/arm/mach-davinci/spl.c     |  2 +-
 common/spl/Kconfig              | 25 +++++++++++++++++++++++++
 configs/omapl138_lcdk_defconfig |  1 +
 include/configs/omapl138_lcdk.h |  2 --
 scripts/config_whitelist.txt    |  3 ---
 5 files changed, 27 insertions(+), 6 deletions(-)

So, I think this shows that some of the SPL framework needs to be revisited for davinci. First, lets make it clear what CONFIG_SPL_{SPI,NAND,MMC}_LOAD is doing.

CONFIG_SPL_MMC_LOAD is used to flag that on davinci we're loading U-Boot from MMC. It's not set / used today but I assume it was working when I introduced all of this.

CONFIG_SPL_NAND_LOAD is used for two things. First, it is used to flag that on davinci we're loading U-Boot from NAND. Second, it is used to enable the non-SPL_FRAMEWORK NAND driver (drivers/mtd/nand/nand_spl_load.c). This driver is not used on davinci.

CONFIG_SPL_SPI_LOAD is used for two things. First, it is used to flag that on davinci we're loading U-Boot from SPI flash. Second, it used globally to enable common/spl/spl_spi.c.

NAND boot is done here via CONFIG_SPL_NAND_SIMPLE which is the regular SPL framework based NAND driver (drivers/mtd/nand/nand_spl_simple.c). This also means that the patch to update CONFIG_SYS_NAND_U_BOOT_SIZE was not needed since we don't use that driver.

Now, I think that in retrospect arch/arm/mach-davinci/spl.c::spl_boot_device could be re-worked to key off of CONFIG_SPL_NAND_SIMPLE / CONFIG_SPL_SPI_SUPPORT / SPL_MMC_SUPPORT.

Quoted 5 lines

And a good but possibly complex series would be to consolidate the usage of SPL_SPI_SUPPORT, SPL_SPI_FLASH_SUPPORT and SPL_SPI_LOAD just in to SPL_SPI_SUPPORT. I'll probably try and do this myself as there's a ton of build testing and size checking to make sure nothing odd breaks here to do.

Just a thought...
Are you sure you want to combine all three (spi, spi flash, and spi load) under one define?
Won't be there any case for parsing some spi device (say eeprom) in the SPL, but no spi flash to load U-Boot from?
It might be sensible to keep the "spi flash" and the "spi load" together, but I think it might be more beneficial to keep the spi bus support apart.

Signature · 10 lines
Regards,
Igor.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 837 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161206/7c43a706/attachment.sig>
#6 lore raw

cover SPL: move CONFIG_SPL_*_LOAD to Kconfig

Quoted 58 lines · Igor Grinberg

Hi Tom,

Quoted 49 lines · Tom Rini
Quoted 14 lines · Fabien Parent

Moving to CONFIG_SPL_*_LOAD options to Kconfig offers several advantage:
* simpler config headers
* on some boards we can easily switch to another boot media without needing to modify the config headers.

This series fixes an issue in davinci where a wrong option was used in place of a CONFIG_SPL_*_LOAD option, then move the options to Kconfig options, and finally start using these Kconfig options for the OMAPL138-LCDK board.

Fabien Parent (3):
davinci: spl: use correct macro to select boot device
SPL: create Kconfig options for CONFIG_SPL_*_LOAD
davinci: omapl138_lcdk: use new CONFIG_SPL_*_LOAD Kconfig options

Quoted 6 lines
 arch/arm/mach-davinci/spl.c     |  2 +-
 common/spl/Kconfig              | 25 +++++++++++++++++++++++++
 configs/omapl138_lcdk_defconfig |  1 +
 include/configs/omapl138_lcdk.h |  2 --
 scripts/config_whitelist.txt    |  3 ---
 5 files changed, 27 insertions(+), 6 deletions(-)

So, I think this shows that some of the SPL framework needs to be revisited for davinci. First, lets make it clear what CONFIG_SPL_{SPI,NAND,MMC}_LOAD is doing.

CONFIG_SPL_MMC_LOAD is used to flag that on davinci we're loading U-Boot from MMC. It's not set / used today but I assume it was working when I introduced all of this.

CONFIG_SPL_NAND_LOAD is used for two things. First, it is used to flag that on davinci we're loading U-Boot from NAND. Second, it is used to enable the non-SPL_FRAMEWORK NAND driver (drivers/mtd/nand/nand_spl_load.c). This driver is not used on davinci.

CONFIG_SPL_SPI_LOAD is used for two things. First, it is used to flag that on davinci we're loading U-Boot from SPI flash. Second, it used globally to enable common/spl/spl_spi.c.

NAND boot is done here via CONFIG_SPL_NAND_SIMPLE which is the regular SPL framework based NAND driver (drivers/mtd/nand/nand_spl_simple.c). This also means that the patch to update CONFIG_SYS_NAND_U_BOOT_SIZE was not needed since we don't use that driver.

Now, I think that in retrospect arch/arm/mach-davinci/spl.c::spl_boot_device could be re-worked to key off of CONFIG_SPL_NAND_SIMPLE / CONFIG_SPL_SPI_SUPPORT / SPL_MMC_SUPPORT.

Quoted 5 lines

And a good but possibly complex series would be to consolidate the usage of SPL_SPI_SUPPORT, SPL_SPI_FLASH_SUPPORT and SPL_SPI_LOAD just in to SPL_SPI_SUPPORT. I'll probably try and do this myself as there's a ton of build testing and size checking to make sure nothing odd breaks here to do.

Quoted 7 lines

Just a thought...
Are you sure you want to combine all three (spi, spi flash, and spi load) under one define?
Won't be there any case for parsing some spi device (say eeprom) in the SPL, but no spi flash to load U-Boot from?
It might be sensible to keep the "spi flash" and the "spi load" together, but I think it might be more beneficial to keep the spi bus support apart.

Ah, good point. I don't know if we have that case today, but that would be one of the gotchas I'd be size-checking for. And another place where the 'imply' keyword Masahiro pointed out earlier would be helpful for too. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161206/832a8996/attachment.sig>