[U-Boot] [RFC PATCH 0/1] SPI flash dependency rework

Currently TARGET_* and ARCH_* selects multiple spi related CONFIG options. If dependency order of spi related CONFIG options is reverse, they are selected as dependencies when needed.
Oskari Lemmela (1): spi: Kconfig: change dependency order
drivers/mtd/spi/Kconfig | 28 ++++++++++++------ drivers/spi/Kconfig | 63 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 16 deletions(-)

SPI Kconfig logic is changed to reverse dependencies. Dependencies are not needed to be defined in the defconfig.
Signed-off-by: Oskari Lemmela oskari@lemmela.net --- drivers/mtd/spi/Kconfig | 28 ++++++++++++------ drivers/spi/Kconfig | 63 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 16 deletions(-)
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 76d5a1d115..19ec3a9c9b 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -17,7 +17,8 @@ config DM_SPI_FLASH
config SPI_FLASH_SANDBOX bool "Support sandbox SPI flash device" - depends on SANDBOX && DM_SPI_FLASH + depends on SANDBOX + select DM_SPI_FLASH help Since sandbox cannot access real devices, an emulation mechanism is provided instead. Drivers can be connected up to the sandbox SPI @@ -27,6 +28,8 @@ config SPI_FLASH_SANDBOX
config SPI_FLASH bool "Legacy SPI Flash Interface support" + imply CMD_SF + select SPI help Enable the legacy SPI flash support. This will include basic standard support for things like probing, read / write, and @@ -36,7 +39,7 @@ config SPI_FLASH
config SPI_FLASH_BAR bool "SPI flash Bank/Extended address register support" - depends on SPI_FLASH + select SPI_FLASH help Enable the SPI flash Bank/Extended address register support. Bank/Extended address registers are used to access the flash @@ -44,66 +47,72 @@ config SPI_FLASH_BAR
config SF_DUAL_FLASH bool "SPI DUAL flash memory support" - depends on SPI_FLASH + select SPI_FLASH help Enable this option to support two flash memories connected to a single controller. Currently Xilinx Zynq qspi supports this.
-if SPI_FLASH - config SPI_FLASH_ATMEL bool "Atmel SPI flash support" + select SPI_FLASH help Add support for various Atmel SPI flash chips (AT45xxx and AT25xxx)
config SPI_FLASH_EON bool "EON SPI flash support" + select SPI_FLASH help Add support for various EON SPI flash chips (EN25xxx)
config SPI_FLASH_GIGADEVICE bool "GigaDevice SPI flash support" + select SPI_FLASH help Add support for various GigaDevice SPI flash chips (GD25xxx)
config SPI_FLASH_ISSI bool "ISSI SPI flash support" + select SPI_FLASH help Add support for various ISSI SPI flash chips (ISxxx)
config SPI_FLASH_MACRONIX bool "Macronix SPI flash support" + select SPI_FLASH help Add support for various Macronix SPI flash chips (MX25Lxxx)
config SPI_FLASH_SPANSION bool "Spansion SPI flash support" + select SPI_FLASH help Add support for various Spansion SPI flash chips (S25FLxxx)
config SPI_FLASH_STMICRO bool "STMicro SPI flash support" + select SPI_FLASH help Add support for various STMicro SPI flash chips (M25Pxxx and N25Qxxx)
config SPI_FLASH_SST bool "SST SPI flash support" + select SPI_FLASH help Add support for various SST SPI flash chips (SST25xxx)
config SPI_FLASH_WINBOND bool "Winbond SPI flash support" + select SPI_FLASH help Add support for various Winbond SPI flash chips (W25xxx)
config SPI_FLASH_XMC bool "XMC SPI flash support" + select SPI_FLASH help Add support for various XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) SPI flash chips (XM25xxx)
-endif - config SPI_FLASH_USE_4K_SECTORS bool "Use small 4096 B erase sectors" depends on SPI_FLASH @@ -121,7 +130,8 @@ config SPI_FLASH_USE_4K_SECTORS
config SPI_FLASH_DATAFLASH bool "AT45xxx DataFlash support" - depends on SPI_FLASH && DM_SPI_FLASH + select SPI_FLASH + select DM_SPI_FLASH help Enable the access for SPI-flash-based AT45xxx DataFlash chips. DataFlash is a kind of SPI flash. Most AT45 chips have two buffers @@ -136,7 +146,7 @@ config SPI_FLASH_DATAFLASH
config SPI_FLASH_MTD bool "SPI Flash MTD support" - depends on SPI_FLASH + select SPI_FLASH help Enable the MTD support for spi flash layer, this adapter is for translating mtd_read/mtd_write commands into spi_flash_read/write diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index fa76d8c3c0..c825384edf 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -1,7 +1,7 @@ -menuconfig SPI - bool "SPI Support" +menu "SPI Support"
-if SPI +config SPI + bool "SPI Support"
config DM_SPI bool "Enable Driver Model for SPI drivers" @@ -16,10 +16,12 @@ config DM_SPI typically use driver-private data instead of extending the spi_slave structure.
-if DM_SPI +menu "DM SPI Drivers" + visible if DM
config SPI_MEM bool "SPI memory extension" + imply DM_SPI help Enable this option if you want to enable the SPI memory extension. This extension is meant to simplify interaction with SPI memories @@ -27,6 +29,7 @@ config SPI_MEM
config ALTERA_SPI bool "Altera SPI driver" + select DM_SPI help Enable the Altera SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Altera @@ -35,6 +38,7 @@ config ALTERA_SPI
config ATCSPI200_SPI bool "Andestech ATCSPI200 SPI driver" + select DM_SPI help Enable the Andestech ATCSPI200 SPI driver. This driver can be used to access the SPI flash on AE3XX and AE250 platforms embedding @@ -42,6 +46,7 @@ config ATCSPI200_SPI
config ATH79_SPI bool "Atheros SPI driver" + select DM_SPI depends on ARCH_ATH79 help Enable the Atheros ar7xxx/ar9xxx SoC SPI driver, it was used @@ -51,6 +56,7 @@ config ATH79_SPI
config ATMEL_SPI bool "Atmel SPI driver" + select DM_SPI default y if ARCH_AT91 help This enables driver for the Atmel SPI Controller, present on @@ -59,6 +65,7 @@ config ATMEL_SPI
config BCM63XX_HSSPI bool "BCM63XX HSSPI driver" + select DM_SPI depends on ARCH_BMIPS help Enable the BCM6328 HSSPI driver. This driver can be used to @@ -67,6 +74,7 @@ config BCM63XX_HSSPI
config BCM63XX_SPI bool "BCM6348 SPI driver" + select DM_SPI depends on ARCH_BMIPS help Enable the BCM6348/BCM6358 SPI driver. This driver can be used to @@ -75,6 +83,7 @@ config BCM63XX_SPI
config BCMSTB_SPI bool "BCMSTB SPI driver" + select DM_SPI help Enable the Broadcom set-top box SPI driver. This driver can be used to access the SPI flash on platforms embedding this @@ -82,6 +91,7 @@ config BCMSTB_SPI
config CADENCE_QSPI bool "Cadence QSPI driver" + select DM_SPI help Enable the Cadence Quad-SPI (QSPI) driver. This driver can be used to access the SPI NOR flash on platforms embedding this @@ -89,6 +99,7 @@ config CADENCE_QSPI
config DESIGNWARE_SPI bool "Designware SPI driver" + select DM_SPI help Enable the Designware SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Designware @@ -96,6 +107,7 @@ config DESIGNWARE_SPI
config EXYNOS_SPI bool "Samsung Exynos SPI driver" + select DM_SPI help Enable the Samsung Exynos SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Samsung @@ -103,6 +115,7 @@ config EXYNOS_SPI
config FSL_DSPI bool "Freescale DSPI driver" + select DM_SPI help Enable the Freescale DSPI driver. This driver can be used to access the SPI NOR flash and SPI Data flash on platforms embedding @@ -111,6 +124,7 @@ config FSL_DSPI
config ICH_SPI bool "Intel ICH SPI driver" + select DM_SPI help Enable the Intel ICH SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Intel @@ -118,6 +132,7 @@ config ICH_SPI
config MESON_SPIFC bool "Amlogic Meson SPI Flash Controller driver" + select DM_SPI depends on ARCH_MESON help Enable the Amlogic Meson SPI Flash Controller SPIFC) driver. @@ -126,12 +141,14 @@ config MESON_SPIFC
config MPC8XX_SPI bool "MPC8XX SPI Driver" + select DM_SPI depends on MPC8xx help Enable support for SPI on MPC8XX
config MT7621_SPI bool "MediaTek MT7621 SPI driver" + select DM_SPI depends on ARCH_MT7620 help Enable the MT7621 SPI driver. This driver can be used to access @@ -140,6 +157,7 @@ config MT7621_SPI
config MTK_QSPI bool "Mediatek QSPI driver" + select DM_SPI help Enable the Mediatek QSPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this @@ -147,6 +165,7 @@ config MTK_QSPI
config MVEBU_A3700_SPI bool "Marvell Armada 3700 SPI driver" + select DM_SPI select CLK_ARMADA_3720 help Enable the Marvell Armada 3700 SPI driver. This driver can be @@ -155,6 +174,7 @@ config MVEBU_A3700_SPI
config PIC32_SPI bool "Microchip PIC32 SPI driver" + select DM_SPI depends on MACH_PIC32 help Enable the Microchip PIC32 SPI driver. This driver can be used @@ -163,6 +183,7 @@ config PIC32_SPI
config PL022_SPI bool "ARM AMBA PL022 SSP controller driver" + select DM_SPI depends on ARM help This selects the ARM(R) AMBA(R) PrimeCell PL022 SSP @@ -171,6 +192,7 @@ config PL022_SPI
config RENESAS_RPC_SPI bool "Renesas RPC SPI driver" + select DM_SPI depends on RCAR_GEN3 help Enable the Renesas RPC SPI driver, used to access SPI NOR flash @@ -179,6 +201,7 @@ config RENESAS_RPC_SPI
config ROCKCHIP_SPI bool "Rockchip SPI driver" + select DM_SPI help Enable the Rockchip SPI driver, used to access SPI NOR flash and other SPI peripherals (such as the Chrome OS EC) on Rockchip SoCs. @@ -187,7 +210,8 @@ config ROCKCHIP_SPI
config SANDBOX_SPI bool "Sandbox SPI driver" - depends on SANDBOX && DM + select DM_SPI + depends on SANDBOX help Enable SPI support for sandbox. This is an emulation of a real SPI bus. Devices can be attached to the bus using the device tree @@ -212,6 +236,7 @@ config SANDBOX_SPI
config STM32_QSPI bool "STM32F7 QSPI driver" + select DM_SPI depends on STM32F7 help Enable the STM32F7 Quad-SPI (QSPI) driver. This driver can be @@ -220,11 +245,13 @@ config STM32_QSPI
config SUN4I_SPI bool "Allwinner SoCs SPI driver" + select DM_SPI help SPI driver for Allwinner SoCs
config TEGRA114_SPI bool "nVidia Tegra114 SPI driver" + select DM_SPI help Enable the nVidia Tegra114 SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this nVidia Tegra114 @@ -235,6 +262,7 @@ config TEGRA114_SPI
config TEGRA20_SFLASH bool "nVidia Tegra20 Serial Flash controller driver" + select DM_SPI help Enable the nVidia Tegra20 Serial Flash controller driver. This driver can be used to access the SPI NOR flash on platforms embedding this @@ -242,6 +270,7 @@ config TEGRA20_SFLASH
config TEGRA20_SLINK bool "nVidia Tegra20/Tegra30 SLINK driver" + select DM_SPI help Enable the nVidia Tegra20/Tegra30 SLINK driver. This driver can be used to access the SPI NOR flash on platforms embedding this @@ -249,6 +278,7 @@ config TEGRA20_SLINK
config TEGRA210_QSPI bool "nVidia Tegra210 QSPI driver" + select DM_SPI help Enable the Tegra Quad-SPI (QSPI) driver for T210. This driver be used to access SPI chips on platforms embedding this @@ -256,6 +286,7 @@ config TEGRA210_QSPI
config XILINX_SPI bool "Xilinx SPI driver" + select DM_SPI help Enable the Xilinx SPI driver from the Xilinx EDK. This SPI controller support 8 bit SPI transfers only, with or w/o FIFO. @@ -264,6 +295,7 @@ config XILINX_SPI
config ZYNQ_SPI bool "Zynq SPI driver" + select DM_SPI depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL help Enable the Zynq SPI driver. This driver can be used to @@ -272,6 +304,7 @@ config ZYNQ_SPI
config ZYNQ_QSPI bool "Zynq QSPI driver" + select DM_SPI depends on ARCH_ZYNQ help Enable the Zynq Quad-SPI (QSPI) driver. This driver can be @@ -281,21 +314,24 @@ config ZYNQ_QSPI
config ZYNQMP_GQSPI bool "Configure ZynqMP Generic QSPI" + select DM_SPI depends on ARCH_ZYNQMP || ARCH_VERSAL help This option is used to enable ZynqMP QSPI controller driver which is used to communicate with qspi flash devices.
-endif # if DM_SPI +endmenu
config SOFT_SPI bool "Soft SPI driver" + select SPI help Enable Soft SPI driver. This driver is to use GPIO simulate the SPI protocol.
config MSCC_BB_SPI bool "MSCC bitbang SPI driver" + select SPI depends on SOC_VCOREIII help Enable MSCC bitbang SPI driver. This driver can be used on @@ -303,12 +339,14 @@ config MSCC_BB_SPI
config CF_SPI bool "ColdFire SPI driver" + select SPI help Enable the ColdFire SPI driver. This driver can be used on some m68k SoCs.
config FSL_ESPI bool "Freescale eSPI driver" + select SPI help Enable the Freescale eSPI driver. This driver can be used to access the SPI interface and SPI NOR flash on platforms embedding @@ -316,6 +354,7 @@ config FSL_ESPI
config FSL_QSPI bool "Freescale QSPI driver" + select SPI help Enable the Freescale Quad-SPI (QSPI) driver. This driver can be used to access the SPI NOR flash on platforms embedding this @@ -323,61 +362,71 @@ config FSL_QSPI
config DAVINCI_SPI bool "Davinci & Keystone SPI driver" + select SPI depends on ARCH_DAVINCI || ARCH_KEYSTONE help Enable the Davinci SPI driver
config SH_SPI bool "SuperH SPI driver" + select SPI help Enable the SuperH SPI controller driver. This driver can be used on various SuperH SoCs, such as SH7757.
config SH_QSPI bool "Renesas Quad SPI driver" + select SPI help Enable the Renesas Quad SPI controller driver. This driver can be used on Renesas SoCs.
config TI_QSPI bool "TI QSPI driver" + select SPI help Enable the TI Quad-SPI (QSPI) driver for DRA7xx and AM43xx evms. This driver support spi flash single, quad and memory reads.
config KIRKWOOD_SPI bool "Marvell Kirkwood SPI Driver" + select SPI help Enable support for SPI on various Marvell SoCs, such as Kirkwood and Armada 375.
config LPC32XX_SSP bool "LPC32XX SPI Driver" + select SPI help Enable support for SPI on LPC32xx
config MPC8XXX_SPI bool "MPC8XXX SPI Driver" + select SPI help Enable support for SPI on the MPC8XXX PowerPC SoCs.
config MXC_SPI bool "MXC SPI Driver" + select SPI help Enable the MXC SPI controller driver. This driver can be used on various i.MX SoCs such as i.MX31/35/51/6/7.
config MXS_SPI bool "MXS SPI Driver" + select SPI help Enable the MXS SPI controller driver. This driver can be used on the i.MX23 and i.MX28 SoCs.
config OMAP3_SPI bool "McSPI driver for OMAP" + select SPI help SPI master controller for OMAP24XX and later Multichannel SPI (McSPI). This driver be used to access SPI chips on platforms embedding this OMAP3 McSPI IP core.
-endif # menu "SPI Support" +endmenu

On Wed, Jan 30, 2019 at 08:17:03PM +0200, Oskari Lemmela wrote:
SPI Kconfig logic is changed to reverse dependencies. Dependencies are not needed to be defined in the defconfig.
Signed-off-by: Oskari Lemmela oskari@lemmela.net
drivers/mtd/spi/Kconfig | 28 ++++++++++++------ drivers/spi/Kconfig | 63 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 16 deletions(-)
I think, conceptually, this takes things in the wrong direction. The general order is "Enable DM for $subsystem, convert a driver", "Enable DM on all drivers in $subsystem". I think SPI is at, or nearly now at, the point where DM_SPI/DM_SPI_xxx go away / become SPI / are selected by SPI/etc.
participants (2)
-
Oskari Lemmela
-
Tom Rini