Skip to content

Commit dc3e86e

Browse files
committed
drivers: i2c: Update drivers to use devicetree Kconfig symbol
Update i2c 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 <galak@kernel.org>
1 parent dd38c20 commit dc3e86e

20 files changed

+70
-58
lines changed

drivers/i2c/Kconfig

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,45 +65,53 @@ source "subsys/logging/Kconfig.template.log_config"
6565

6666
config I2C_GECKO
6767
bool "Gecko I2C driver"
68-
depends on HAS_SILABS_GECKO
68+
default y
69+
depends on DT_HAS_SILABS_GECKO_I2C_ENABLED
6970
select SOC_GECKO_I2C
7071
help
7172
Enable the SiLabs Gecko I2C bus driver.
7273

7374
config I2C_SAM_TWIHS
7475
bool "Atmel SAM (TWIHS) I2C driver"
75-
depends on SOC_FAMILY_SAM
76+
default y
77+
depends on DT_HAS_ATMEL_SAM_I2C_TWIHS_ENABLED
7678
help
7779
Enable Atmel SAM MCU Family (TWIHS) I2C bus driver.
7880

7981
config I2C_SAM_TWIM
8082
bool "Atmel SAM (TWIM) I2C driver"
81-
depends on SOC_SERIES_SAM4L
83+
default y
84+
depends on DT_HAS_ATMEL_SAM_I2C_TWIM_ENABLED
8285
help
8386
Enable Atmel SAM MCU Family (TWIM) I2C bus driver.
8487

8588
config I2C_SAM_TWI
8689
bool "Atmel SAM (TWI) I2C driver"
87-
depends on SOC_FAMILY_SAM
90+
default y
91+
depends on DT_HAS_ATMEL_SAM_I2C_TWI_ENABLED
8892
help
8993
Enable Atmel SAM MCU Family (TWI) I2C bus driver.
9094

9195
config I2C_MCUX
9296
bool "MCUX I2C driver"
93-
depends on HAS_MCUX
97+
default y
98+
depends on DT_HAS_NXP_KINETIS_I2C_ENABLED
9499
select PINCTRL
95100
help
96101
Enable the mcux I2C driver.
97102

98103
config I2C_MCUX_FLEXCOMM
99104
bool "MCUX FLEXCOMM I2C driver"
100-
depends on HAS_MCUX_FLEXCOMM
105+
default y
106+
depends on DT_HAS_NXP_LPC_I2C_ENABLED
101107
help
102108
Enable the mcux flexcomm i2c driver.
103109

104110
config I2C_MCUX_LPI2C
105111
bool "MCUX LPI2C driver"
106-
depends on HAS_MCUX_LPI2C && CLOCK_CONTROL
112+
default y
113+
depends on DT_HAS_NXP_IMX_LPI2C_ENABLED
114+
depends on CLOCK_CONTROL
107115
help
108116
Enable the mcux LPI2C driver.
109117

@@ -116,13 +124,15 @@ config I2C_MCUX_LPI2C_BUS_RECOVERY
116124

117125
config I2C_IMX
118126
bool "i.MX I2C driver"
119-
depends on HAS_IMX_I2C
127+
default y
128+
depends on DT_HAS_FSL_IMX21_I2C_ENABLED
120129
help
121130
Enable the i.MX I2C driver.
122131

123132
config I2C_CC32XX
124133
bool "CC32XX I2C driver"
125-
depends on SOC_SERIES_CC32XX
134+
default y
135+
depends on DT_HAS_TI_CC32XX_I2C_ENABLED
126136
help
127137
Enable the CC32XX I2C driver.
128138

@@ -133,13 +143,16 @@ config I2C_BITBANG
133143

134144
config I2C_NIOS2
135145
bool "Nios-II I2C driver"
136-
depends on HAS_ALTERA_HAL
146+
default y
147+
depends on DT_HAS_ALTR_NIOS2_I2C_ENABLED
137148
help
138149
Enable the Nios-II I2C driver.
139150

140151
config I2C_RV32M1_LPI2C
141152
bool "RV32M1 LPI2C driver"
142-
depends on HAS_RV32M1_LPI2C && CLOCK_CONTROL
153+
default y
154+
depends on DT_HAS_OPENISA_RV32M1_LPI2C_ENABLED
155+
depends on CLOCK_CONTROL
143156
help
144157
Enable the RV32M1 LPI2C driver.
145158

drivers/i2c/Kconfig.b91

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
config I2C_TELINK_B91
55
bool "Telink Semiconductor B91 I2C driver"
6-
depends on SOC_RISCV_TELINK_B91
6+
default y
7+
depends on DT_HAS_TELINK_B91_I2C_ENABLED
78
help
89
Enables Telink B91 I2C driver.

drivers/i2c/Kconfig.cc13xx_cc26xx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
config I2C_CC13XX_CC26XX
55
bool "TI SimpleLink CC13xx / CC26xx I2C driver"
6-
depends on SOC_SERIES_CC13X2_CC26X2
6+
default y
7+
depends on DT_HAS_TI_CC13XX_CC26XX_I2C_ENABLED
78
help
89
Enable support for I2C on the TI SimpleLink CC13xx / CC26xx series.

drivers/i2c/Kconfig.dw

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ config HAS_I2C_DW
88

99
menuconfig I2C_DW
1010
bool "Design Ware I2C support"
11+
default y
12+
depends on DT_HAS_SNPS_DESIGNWARE_I2C_ENABLED
1113
depends on HAS_I2C_DW
1214
help
1315
Enable the Design Ware I2C driver

drivers/i2c/Kconfig.esp32

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
55
# SPDX-License-Identifier: Apache-2.0
66

7-
DT_COMPAT_ESP32_I2C := espressif,esp32-i2c
8-
97
config I2C_ESP32
108
bool "ESP32 I2C driver"
11-
depends on SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3
12-
default $(dt_compat_enabled,$(DT_COMPAT_ESP32_I2C))
9+
default y
10+
depends on DT_HAS_ESPRESSIF_ESP32_I2C_ENABLED
1311
select GPIO_ESP32
1412
help
1513
Enables the ESP32 I2C driver

drivers/i2c/Kconfig.gd32

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Copyright (c) 2021 BrainCo Inc.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
DT_COMPAT_GD32_I2C := gd,gd32-i2c
5-
64
config I2C_GD32
75
bool "GigaDevice GD32 I2C driver"
8-
depends on (SOC_FAMILY_GD32 || SOC_SERIES_GD32VF103)
9-
default $(dt_compat_enabled,$(DT_COMPAT_GD32_I2C))
6+
default y
7+
depends on DT_HAS_GD_GD32_I2C_ENABLED
108
help
119
Enables GigaDevice GD32 I2C driver

drivers/i2c/Kconfig.gpio

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
config I2C_GPIO
55
bool "GPIO bit banging I2C support"
6+
default y
7+
depends on DT_HAS_GPIO_I2C_ENABLED
68
select I2C_BITBANG
79
help
810
Enable software driven (bit banging) I2C support using GPIO pins

drivers/i2c/Kconfig.i2c_emul

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
config I2C_EMUL
55
bool "I2C emulator"
6+
default y
7+
depends on DT_HAS_ZEPHYR_I2C_EMUL_CONTROLLER_ENABLED
68
help
79
Enable the I2C emulator driver. This is a fake driver in that it
810
does not talk to real hardware. Instead it talks to emulation

drivers/i2c/Kconfig.it8xxx2

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# Copyright (c) 2020 ITE Corporation. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
DT_COMPAT_ITE_IT8XXX2_I2C := ite,it8xxx2-i2c
5-
DT_COMPAT_ITE_ENHANCE_I2C := ite,enhance-i2c
6-
74
config I2C_ITE_IT8XXX2
85
bool "ITE IT8XXX2 I2C driver"
9-
depends on SOC_IT8XXX2
10-
default $(dt_compat_enabled,$(DT_COMPAT_ITE_IT8XXX2_I2C))
6+
default y
7+
depends on DT_HAS_ITE_IT8XXX2_I2C_ENABLED
118
help
129
Enable I2C support on it8xxx2_evb.
1310
Supported Speeds: 100kHz, 400kHz and 1MHz.
1411
This driver supports repeated start.
1512

1613
config I2C_ITE_ENHANCE
1714
bool "ITE IT8XXX2 I2C enhance driver"
18-
depends on SOC_IT8XXX2
19-
default $(dt_compat_enabled,$(DT_COMPAT_ITE_ENHANCE_I2C))
15+
default y
16+
depends on DT_HAS_ITE_ENHANCE_I2C_ENABLED
2017
help
2118
This option can enable the enhance I2C
2219
of IT8XXX2 and support three channels.

drivers/i2c/Kconfig.litex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
config I2C_LITEX
55
bool "LiteX I2C driver"
6-
depends on SOC_RISCV32_LITEX_VEXRISCV
6+
default y
7+
depends on DT_HAS_LITEX_I2C_ENABLED
78
select I2C_BITBANG
89
help
910
Enable support for Litex I2C driver

0 commit comments

Comments
 (0)