drivers/i2c: stm32: Configure driver by compatible

Use compatible information to configure i2c stm32.
With this, driver version selection is done thanks to compatible
and it is not needed anymore to do this via Kconfig symbol
selection under soc/

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2020-04-12 15:53:44 +02:00 committed by Kumar Gala
commit 9580992b3e
16 changed files with 7 additions and 63 deletions

View file

@ -1,9 +1,12 @@
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ST_STM32_I2C_V1 := st,stm32-i2c-v1
DT_COMPAT_ST_STM32_I2C_V2 := st,stm32-i2c-v2
menuconfig I2C_STM32
bool "STM32 I2C driver"
depends on SOC_FAMILY_STM32
default $(dt_compat_enabled,$(DT_COMPAT_ST_STM32_I2C_V1)) || $(dt_compat_enabled,$(DT_COMPAT_ST_STM32_I2C_V2))
help
Enable I2C support on the STM32 SoCs
@ -11,7 +14,7 @@ if I2C_STM32
config I2C_STM32_V1
bool
depends on SOC_SERIES_STM32F1X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32L1X
default $(dt_compat_enabled,$(DT_COMPAT_ST_STM32_I2C_V1))
select USE_STM32_LL_I2C
select I2C_STM32_INTERRUPT if I2C_SLAVE
help
@ -20,10 +23,7 @@ config I2C_STM32_V1
config I2C_STM32_V2
bool
depends on (SOC_SERIES_STM32F0X || SOC_SERIES_STM32F3X || \
SOC_SERIES_STM32F7X || SOC_SERIES_STM32L0X || SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32WBX || SOC_SERIES_STM32MP1X || SOC_SERIES_STM32G0X || \
SOC_SERIES_STM32G4X || SOC_SERIES_STM32H7X)
default $(dt_compat_enabled,$(DT_COMPAT_ST_STM32_I2C_V2))
select USE_STM32_LL_I2C
select USE_STM32_LL_RCC if SOC_SERIES_STM32F0X || SOC_SERIES_STM32F3X
select I2C_STM32_INTERRUPT if I2C_SLAVE

View file

@ -49,10 +49,6 @@ config SPI_STM32
default y
depends on SPI
config I2C_STM32
default y
depends on I2C
config USB_DC_STM32
default y
depends on USB

View file

@ -12,10 +12,6 @@ source "soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f0*"
config SOC_SERIES
default "stm32f0"
config I2C_STM32_V2
default y
depends on I2C_STM32
config DMA_STM32_V2
default y
depends on DMA_STM32

View file

@ -12,10 +12,6 @@ source "soc/arm/st_stm32/stm32f1/Kconfig.defconfig.stm32f1*"
config SOC_SERIES
default "stm32f1"
config I2C_STM32_V1
default y
depends on I2C_STM32
config DMA_STM32_V2
default y
depends on DMA_STM32

View file

@ -12,10 +12,6 @@ source "soc/arm/st_stm32/stm32f3/Kconfig.defconfig.stm32f3*"
config SOC_SERIES
default "stm32f3"
config I2C_STM32_V2
default y
depends on I2C_STM32
config DMA_STM32_V2
default y
depends on DMA_STM32

View file

@ -12,10 +12,6 @@ source "soc/arm/st_stm32/stm32f4/Kconfig.defconfig.stm32f4*"
config SOC_SERIES
default "stm32f4"
config I2C_STM32_V1
default y
depends on I2C_STM32
config DMA_STM32_V1
default y
depends on DMA_STM32

View file

@ -12,10 +12,6 @@ source "soc/arm/st_stm32/stm32f7/Kconfig.defconfig.stm32f7*"
config SOC_SERIES
default "stm32f7"
config I2C_STM32_V2
default y
depends on I2C_STM32
config DMA_STM32_V1
default y
depends on DMA_STM32

View file

@ -11,8 +11,4 @@ source "soc/arm/st_stm32/stm32g0/Kconfig.defconfig.stm32g0*"
config SOC_SERIES
default "stm32g0"
config I2C_STM32_V2
default y
depends on I2C_STM32
endif # SOC_SERIES_STM32G0X

View file

@ -10,8 +10,4 @@ source "soc/arm/st_stm32/stm32g4/Kconfig.defconfig.stm32g4*"
config SOC_SERIES
default "stm32g4"
config I2C_STM32_V2
default y
depends on I2C_STM32
endif # SOC_SERIES_STM32G4X

View file

@ -12,8 +12,4 @@ source "soc/arm/st_stm32/stm32h7/Kconfig.defconfig.stm32h7*"
config SOC_SERIES
default "stm32h7"
config I2C_STM32_V2
default y
depends on I2C_STM32
endif # SOC_SERIES_STM32H7X

View file

@ -12,10 +12,6 @@ source "soc/arm/st_stm32/stm32l0/Kconfig.defconfig.stm32l0*"
config SOC_SERIES
default "stm32l0"
config I2C_STM32_V2
default y
depends on I2C_STM32
config DMA_STM32_V2
default y
depends on DMA_STM32

View file

@ -44,7 +44,7 @@
#include <stm32l0xx_ll_rcc.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
#ifdef CONFIG_I2C_STM32_V2
#ifdef CONFIG_I2C_STM32
#include <stm32l0xx_ll_i2c.h>
#endif

View file

@ -10,8 +10,4 @@ source "soc/arm/st_stm32/stm32l1/Kconfig.defconfig.stm32l1*"
config SOC_SERIES
default "stm32l1"
config I2C_STM32_V1
default y
depends on I2C_STM32
endif # SOC_SERIES_STM32L1X

View file

@ -13,10 +13,6 @@ source "soc/arm/st_stm32/stm32l4/Kconfig.defconfig.stm32l4*"
config SOC_SERIES
default "stm32l4"
config I2C_STM32_V2
default y
depends on I2C_STM32
config DMA_STM32_V2
default y
depends on DMA_STM32

View file

@ -14,8 +14,4 @@ config IPM_STM32_IPCC
default y
depends on IPM
config I2C_STM32_V2
default y
depends on I2C_STM32
endif # SOC_SERIES_STM32MP1X

View file

@ -10,8 +10,4 @@ source "soc/arm/st_stm32/stm32wb/Kconfig.defconfig.stm32wb*"
config SOC_SERIES
default "stm32wb"
config I2C_STM32_V2
default y
depends on I2C_STM32
endif # SOC_SERIES_STM32WBX