Skip to content

Commit

Permalink
drivers: spi: Update drivers to use devicetree Kconfig symbol
Browse files Browse the repository at this point in the history
Update spi drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak authored and carlescufi committed Jul 25, 2022
1 parent dea8118 commit 0be3a76
Show file tree
Hide file tree
Showing 25 changed files with 50 additions and 32 deletions.
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.b91
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

config SPI_TELINK_B91
bool "Telink Semiconductor B91 SPI driver"
depends on SOC_RISCV_TELINK_B91
default y
depends on DT_HAS_TELINK_B91_SPI_ENABLED
help
Enables Telink B91 SPI driver.
2 changes: 2 additions & 0 deletions drivers/spi/Kconfig.bitbang
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

config SPI_BITBANG
bool "Bitbang SPI controller driver"
default y
depends on DT_HAS_ZEPHYR_SPI_BITBANG_ENABLED
help
Enable the Bitbang SPI controller
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.cc13xx_cc26xx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

config SPI_CC13XX_CC26XX
bool "TI SimpleLink CC13xx / CC26xx SPI driver"
depends on SOC_SERIES_CC13X2_CC26X2
default y
depends on DT_HAS_TI_CC13XX_CC26XX_SPI_ENABLED
help
Enable support for the TI SimpleLink CC13xx / CC26xx SPI peripheral
2 changes: 2 additions & 0 deletions drivers/spi/Kconfig.dw
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ config HAS_SPI_DW

menuconfig SPI_DW
bool "Designware SPI controller driver"
default y
depends on DT_HAS_SNPS_DESIGNWARE_SPI_ENABLED
depends on HAS_SPI_DW
help
Enable support for Designware's SPI controllers.
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.esp32
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

menuconfig ESP32_SPIM
bool "ESP32 SPI Master driver"
depends on SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3
default y
depends on DT_HAS_ESPRESSIF_ESP32_SPI_ENABLED
help
Enables support for ESP32 SPI Master driver.

Expand Down
7 changes: 2 additions & 5 deletions drivers/spi/Kconfig.gd32
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Copyright (c) 2021 BrainCo Inc.
# SPDX-License-Identifier: Apache-2.0

# Workaround for not being able to have commas in macro arguments
DT_COMPAT_GD_GD32_SPI := gd,gd32-spi

config SPI_GD32
bool "Gigadevice GD32 SPI driver"
depends on (SOC_FAMILY_GD32 || SOC_SERIES_GD32VF103)
default $(dt_compat_enabled,$(DT_COMPAT_GD_GD32_SPI))
default y
depends on DT_HAS_GD_GD32_SPI_ENABLED
help
Enables Gigadevice GD32 SPI driver.
5 changes: 3 additions & 2 deletions drivers/spi/Kconfig.gecko
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

config SPI_GECKO
bool "Gecko SPI controller driver"
depends on HAS_SILABS_GECKO
depends on GPIO_GECKO
default y
depends on DT_HAS_SILABS_GECKO_SPI_USART_ENABLED
depends on GPIO
select SOC_GECKO_USART
help
Enable the SPI peripherals on Gecko
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.litex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

config SPI_LITESPI
bool "LiteX SPI controller driver"
depends on SOC_RISCV32_LITEX_VEXRISCV
default y
depends on DT_HAS_LITEX_SPI_ENABLED
help
Enable the SPI peripherals on LiteX
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.mchp_mss_qspi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
config SPI_MCHP_QSPI
bool "Microchip Polarfire SOC QSPI driver"
default y
depends on SOC_MPFS
depends on DT_HAS_MICROCHIP_MPFS_QSPI_ENABLED
help
Enable support for the Polarfire SOC QSPI driver.
4 changes: 3 additions & 1 deletion drivers/spi/Kconfig.mcux_dspi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

config SPI_MCUX_DSPI
bool "MCUX SPI driver"
depends on HAS_MCUX && CLOCK_CONTROL
default y
depends on DT_HAS_NXP_KINETIS_DSPI_ENABLED
depends on CLOCK_CONTROL
select PINCTRL
help
Enable support for mcux spi driver.
Expand Down
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.mcux_flexcomm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

config SPI_MCUX_FLEXCOMM
bool "MCUX FLEXCOMM SPI driver"
depends on HAS_MCUX_FLEXCOMM
default y
depends on DT_HAS_NXP_LPC_SPI_ENABLED
help
Enable support for mcux flexcomm spi driver.

Expand Down
4 changes: 3 additions & 1 deletion drivers/spi/Kconfig.mcux_lpspi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

config SPI_MCUX_LPSPI
bool "MCUX SPI driver"
depends on HAS_MCUX_LPSPI && CLOCK_CONTROL
default y
depends on DT_HAS_NXP_IMX_LPSPI_ENABLED
depends on CLOCK_CONTROL
help
Enable support for mcux spi driver.

Expand Down
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.npcx_fiu
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

config SPI_NPCX_FIU
bool "Nuvoton NPCX embedded controller (EC) SPI driver for NOR flash"
depends on SOC_FAMILY_NPCX
default y
depends on DT_HAS_NUVOTON_NPCX_SPI_FIU_ENABLED
help
Enable the SPI driver for NPCX family of processors. This driver is
for the dedicated SPI controller (FIU) to access the NOR flash.
2 changes: 2 additions & 0 deletions drivers/spi/Kconfig.oc_simple
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

menuconfig SPI_OC_SIMPLE
bool "OpenCores Simple SPI controller driver"
default y
depends on DT_HAS_OPENCORES_SPI_SIMPLE_ENABLED
help
Enable the Simple SPI controller

Expand Down
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.psoc6
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

config SPI_PSOC6
bool "PSoC-6 MCU SCB spi driver"
depends on SOC_FAMILY_PSOC6
default y
depends on DT_HAS_CYPRESS_PSOC6_SPI_ENABLED
select USE_INFINEON_SPI
help
This option enables the SCB[SPI] driver for PSoC-6 SoC family.
4 changes: 3 additions & 1 deletion drivers/spi/Kconfig.rv32m1_lpspi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

config SPI_RV32M1_LPSPI
bool "RV32M1 LPSPI driver"
depends on HAS_RV32M1_LPSPI && CLOCK_CONTROL
default y
depends on DT_HAS_OPENISA_RV32M1_LPSPI_ENABLED
depends on CLOCK_CONTROL
help
Enable the RV32M1 LPSPI driver.
8 changes: 2 additions & 6 deletions drivers/spi/Kconfig.sam
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
# Copyright (c) 2018 qianfan Zhao
# SPDX-License-Identifier: Apache-2.0

# Workaround for not being able to have commas in macro arguments
DT_COMPAT_ATMEL_SAM_SPI := atmel,sam-spi

config SPI_SAM
bool "Atmel SAM series SPI driver"
default $(dt_compat_enabled,$(DT_COMPAT_ATMEL_SAM_SPI))
depends on SOC_FAMILY_SAM
depends on SPI
default y
depends on DT_HAS_ATMEL_SAM_SPI_ENABLED
select GPIO
help
Enable support for the SAM SPI driver.
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.sam0
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config SPI_SAM0
bool "Atmel SAM0 series SERCOM SPI driver"
default y
depends on SOC_FAMILY_SAM0
depends on DT_HAS_ATMEL_SAM0_SPI_ENABLED
select DMA if SPI_ASYNC
help
Enable support for the SAM0 SERCOM SPI driver.
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.sifive
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

config SPI_SIFIVE
bool "SiFive SPI controller driver"
depends on SOC_SERIES_RISCV_SIFIVE_FREEDOM
default y
depends on DT_HAS_SIFIVE_SPI0_ENABLED
help
Enable the SPI peripherals on SiFive Freedom processors
3 changes: 3 additions & 0 deletions drivers/spi/Kconfig.spi_emul
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

config SPI_EMUL
bool "SPI emulator"
default y
depends on DT_HAS_ZEPHYR_SPI_EMUL_CONTROLLER_ENABLED
depends on EMUL
help
Enable the SPI emulator driver. This is a fake driver in that it
does not talk to real hardware. Instead it talks to emulation
Expand Down
3 changes: 2 additions & 1 deletion drivers/spi/Kconfig.stm32
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

menuconfig SPI_STM32
bool "STM32 MCU SPI controller driver"
depends on SOC_FAMILY_STM32
default y
depends on DT_HAS_ST_STM32_SPI_ENABLED
select USE_STM32_LL_SPI
help
Enable SPI support on the STM32 family of processors.
Expand Down
5 changes: 2 additions & 3 deletions drivers/spi/Kconfig.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Copyright (c) 2021, Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_VND_SPI := vnd,spi

# Hidden option for turning on the dummy driver for vnd,spi devices
# used in testing.
config SPI_TEST
def_bool $(dt_compat_enabled,$(DT_COMPAT_VND_SPI))
def_bool DT_HAS_VND_SPI_ENABLED
depends on DT_HAS_VND_SPI_ENABLED
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.xec_qmspi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config SPI_XEC_QMSPI
bool "Microchip XEC QMSPI driver"
default y
depends on SOC_SERIES_MEC1501X
depends on DT_HAS_MICROCHIP_XEC_QMSPI_ENABLED
select DMA if SPI_ASYNC
help
Enable support for the Microchip XEC QMSPI driver.
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.xec_qmspi_ldma
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
config SPI_XEC_QMSPI_LDMA
bool "Microchip XEC QMSPI LDMA driver"
default y
depends on SOC_SERIES_MEC172X
depends on DT_HAS_MICROCHIP_XEC_QMSPI_LDMA_ENABLED
help
Enable support for the Microchip XEC QMSPI with local DMA driver.
2 changes: 2 additions & 0 deletions drivers/spi/Kconfig.xlnx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@

config SPI_XLNX_AXI_QUADSPI
bool "Xilinx AXI Quad SPI driver"
default y
depends on DT_HAS_XLNX_XPS_SPI_2_00_A_ENABLED
help
Enable Xilinx AXI Quad SPI v3.2 driver.

0 comments on commit 0be3a76

Please sign in to comment.