drivers: counter: Update drivers to use devicetree Kconfig symbol

Update counter 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>
This commit is contained in:
Kumar Gala 2022-07-21 16:33:07 -05:00 committed by Carles Cufí
parent 795d47e49f
commit 0f1ed0f4a0
23 changed files with 44 additions and 29 deletions

View file

@ -5,4 +5,5 @@
config COUNTER_CMOS config COUNTER_CMOS
bool "Counter driver for x86 CMOS/RTC clock" bool "Counter driver for x86 CMOS/RTC clock"
depends on X86 default y
depends on DT_HAS_MOTOROLA_MC146818_ENABLED

View file

@ -5,7 +5,8 @@
config TIMER_DTMR_CMSDK_APB config TIMER_DTMR_CMSDK_APB
bool "ARM CMSDK (Cortex-M System Design Kit) DTMR Timer driver" bool "ARM CMSDK (Cortex-M System Design Kit) DTMR Timer driver"
depends on SOC_FAMILY_ARM default y
depends on DT_HAS_ARM_CMSDK_DTIMER_ENABLED
help help
The dualtimer (DTMR) present in the platform is used as a timer. The dualtimer (DTMR) present in the platform is used as a timer.
This option enables the support for the timer. This option enables the support for the timer.

View file

@ -3,11 +3,9 @@
# Copyright (c) 2020 Espressif Systems (Shanghai) Co., Ltd. # Copyright (c) 2020 Espressif Systems (Shanghai) Co., Ltd.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ESP32_TIMER := espressif,esp32-timer
config COUNTER_ESP32 config COUNTER_ESP32
bool "ESP32 Counter Driver" bool "ESP32 Counter Driver"
depends on SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3 default y
default $(dt_compat_enabled,$(DT_COMPAT_ESP32_TIMER)) depends on DT_HAS_ESPRESSIF_ESP32_TIMER_ENABLED
help help
Enable Counter driver for ESP32 series devices. Enable Counter driver for ESP32 series devices.

View file

@ -5,7 +5,8 @@
config COUNTER_GECKO_RTCC config COUNTER_GECKO_RTCC
bool "Silicon Labs Gecko Counter (RTCC) driver" bool "Silicon Labs Gecko Counter (RTCC) driver"
depends on SOC_FAMILY_EXX32 default y
depends on DT_HAS_SILABS_GECKO_RTCC_ENABLED
select SOC_GECKO_CMU select SOC_GECKO_CMU
select SOC_GECKO_RTCC select SOC_GECKO_RTCC
help help

View file

@ -5,6 +5,7 @@
config COUNTER_IMX_EPIT config COUNTER_IMX_EPIT
bool "IMX EPIT driver" bool "IMX EPIT driver"
depends on HAS_IMX_EPIT default y
depends on DT_HAS_NXP_IMX_EPIT_ENABLED
help help
Enable the IMX EPIT driver. Enable the IMX EPIT driver.

View file

@ -5,6 +5,8 @@
config COUNTER_MAXIM_DS3231 config COUNTER_MAXIM_DS3231
bool "Maxim DS3231 RTC/TCXO" bool "Maxim DS3231 RTC/TCXO"
default y
depends on DT_HAS_MAXIM_DS3231_ENABLED
depends on I2C depends on I2C
select POLL select POLL
help help

View file

@ -5,6 +5,8 @@
config COUNTER_MICROCHIP_MCP7940N config COUNTER_MICROCHIP_MCP7940N
bool "Microchip MCP7940N RTC" bool "Microchip MCP7940N RTC"
default y
depends on DT_HAS_MICROCHIP_MCP7940N_ENABLED
select I2C select I2C
help help
Enable RTC driver based on Microchip MCP7940N I2C device. Enable RTC driver based on Microchip MCP7940N I2C device.

View file

@ -5,7 +5,8 @@
config COUNTER_MCUX_CTIMER config COUNTER_MCUX_CTIMER
bool "MCUX CTIMER driver" bool "MCUX CTIMER driver"
depends on HAS_MCUX_CTIMER default y
depends on DT_HAS_NXP_LPC_CTIMER_ENABLED
help help
Enable support for MCUX CTIMER driver. Enable support for MCUX CTIMER driver.

View file

@ -5,6 +5,7 @@
config COUNTER_MCUX_GPT config COUNTER_MCUX_GPT
bool "MCUX GPT driver" bool "MCUX GPT driver"
depends on HAS_MCUX_GPT default y
depends on DT_HAS_NXP_IMX_GPT_ENABLED
help help
Enable support for mcux General Purpose Timer (GPT) driver. Enable support for mcux General Purpose Timer (GPT) driver.

View file

@ -3,6 +3,7 @@
config COUNTER_MCUX_LPC_RTC config COUNTER_MCUX_LPC_RTC
bool "MCUX LPC RTC driver" bool "MCUX LPC RTC driver"
depends on HAS_MCUX_LPC_RTC default y
depends on DT_HAS_NXP_LPC_RTC_ENABLED
help help
Enable support for LPC rtc driver. Enable support for LPC rtc driver.

View file

@ -5,6 +5,7 @@
config COUNTER_MCUX_LPTMR config COUNTER_MCUX_LPTMR
bool "MCUX LPTMR driver" bool "MCUX LPTMR driver"
depends on HAS_MCUX_LPTMR default y
depends on DT_HAS_NXP_KINETIS_LPTMR_ENABLED
help help
Enable support for the MCUX Low Power Timer (LPTMR). Enable support for the MCUX Low Power Timer (LPTMR).

View file

@ -5,6 +5,7 @@
config COUNTER_MCUX_PIT config COUNTER_MCUX_PIT
bool "MCUX PIT driver" bool "MCUX PIT driver"
depends on HAS_MCUX_PIT default y
depends on DT_HAS_NXP_KINETIS_PIT_ENABLED
help help
Enable support for the MCUX Periodic Interrupt Timer (PIT). Enable support for the MCUX Periodic Interrupt Timer (PIT).

View file

@ -5,6 +5,7 @@
config COUNTER_MCUX_QTMR config COUNTER_MCUX_QTMR
bool "MCUX QTMR driver" bool "MCUX QTMR driver"
depends on HAS_MCUX_QTMR default y
depends on DT_HAS_NXP_IMX_TMR_ENABLED
help help
Enable support for mcux Quad Timer (QTMR) driver. Enable support for mcux Quad Timer (QTMR) driver.

View file

@ -5,6 +5,7 @@
config COUNTER_MCUX_RTC config COUNTER_MCUX_RTC
bool "MCUX RTC driver" bool "MCUX RTC driver"
depends on HAS_MCUX_RTC default y
depends on DT_HAS_NXP_KINETIS_RTC_ENABLED
help help
Enable support for mcux rtc driver. Enable support for mcux rtc driver.

View file

@ -5,7 +5,8 @@
config COUNTER_MCUX_SNVS config COUNTER_MCUX_SNVS
bool "IMX SNVS RTC driver" bool "IMX SNVS RTC driver"
depends on HAS_MCUX_SNVS default y
depends on DT_HAS_NXP_IMX_SNVS_RTC_ENABLED
help help
Enable support for the IMX SNVS High/Low Power clock. Enable support for the IMX SNVS High/Low Power clock.

View file

@ -4,7 +4,7 @@
config COUNTER_NATIVE_POSIX config COUNTER_NATIVE_POSIX
bool "Counter on COUNTER_0" bool "Counter on COUNTER_0"
default y default y
depends on BOARD_NATIVE_POSIX depends on DT_HAS_ZEPHYR_NATIVE_POSIX_COUNTER_ENABLED
config COUNTER_NATIVE_POSIX_FREQUENCY config COUNTER_NATIVE_POSIX_FREQUENCY
int "native_posix counter frequency in Hz" int "native_posix counter frequency in Hz"

View file

@ -1,12 +1,9 @@
# Copyright (c) 2021 Piotr Mienkowski # Copyright (c) 2021 Piotr Mienkowski
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# Workaround for not being able to have commas in macro arguments
DT_COMPAT_ATMEL_SAM_TC := atmel,sam-tc
config COUNTER_SAM_TC config COUNTER_SAM_TC
bool "Atmel SAM MCU family counter (TC) driver" bool "Atmel SAM MCU family counter (TC) driver"
default $(dt_compat_enabled,$(DT_COMPAT_ATMEL_SAM_TC)) default y
depends on SOC_FAMILY_SAM depends on DT_HAS_ATMEL_SAM_TC_ENABLED
help help
Enable the Atmel SAM MCU family counter (TC) driver. Enable the Atmel SAM MCU family counter (TC) driver.

View file

@ -4,7 +4,7 @@
config COUNTER_SAM0_TC32 config COUNTER_SAM0_TC32
bool "SAM0 series 32-bit basic timer driver" bool "SAM0 series 32-bit basic timer driver"
default y default y
depends on SOC_FAMILY_SAM0 depends on DT_HAS_ATMEL_SAM0_TC32_ENABLED
help help
Enable the SAM0 series timer counter (TC) driver in 32-bit wide Enable the SAM0 series timer counter (TC) driver in 32-bit wide
mode. mode.

View file

@ -5,7 +5,8 @@
menuconfig COUNTER_RTC_STM32 menuconfig COUNTER_RTC_STM32
bool "STM32 Counter RTC driver" bool "STM32 Counter RTC driver"
depends on SOC_FAMILY_STM32 default y
depends on DT_HAS_ST_STM32_RTC_ENABLED
select USE_STM32_LL_RTC select USE_STM32_LL_RTC
select USE_STM32_LL_PWR select USE_STM32_LL_PWR
select USE_STM32_LL_RCC select USE_STM32_LL_RCC

View file

@ -1,11 +1,10 @@
# Copyright (c) 2021 Kent Hall # Copyright (c) 2021 Kent Hall
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ST_STM32_COUNTER := st,stm32-counter
config COUNTER_TIMER_STM32 config COUNTER_TIMER_STM32
bool "STM32 counter driver" bool "STM32 counter driver"
default $(dt_compat_enabled,$(DT_COMPAT_ST_STM32_COUNTER)) default y
depends on DT_HAS_ST_STM32_COUNTER_ENABLED
select USE_STM32_LL_TIM select USE_STM32_LL_TIM
help help
Enable the counter driver for STM32 family of processors. Enable the counter driver for STM32 family of processors.

View file

@ -5,7 +5,8 @@
config TIMER_TMR_CMSDK_APB config TIMER_TMR_CMSDK_APB
bool "ARM CMSDK (Cortex-M System Design Kit) Timer driver" bool "ARM CMSDK (Cortex-M System Design Kit) Timer driver"
depends on SOC_FAMILY_ARM default y
depends on DT_HAS_ARM_CMSDK_TIMER_ENABLED
help help
The timers (TMR) present in the platform are used as timers. The timers (TMR) present in the platform are used as timers.
This option enables the support for the timers. This option enables the support for the timers.

View file

@ -5,7 +5,8 @@
config COUNTER_XEC config COUNTER_XEC
bool "Microchip XEC series counter driver" bool "Microchip XEC series counter driver"
depends on SOC_FAMILY_MEC default y
depends on DT_HAS_MICROCHIP_XEC_TIMER_ENABLED
help help
Enable counter driver for Microchip XEC MCU series. Such driver Enable counter driver for Microchip XEC MCU series. Such driver
will expose the basic timer devices present on the MCU. will expose the basic timer devices present on the MCU.

View file

@ -5,5 +5,7 @@
config COUNTER_XLNX_AXI_TIMER config COUNTER_XLNX_AXI_TIMER
bool "Xilinx AXI Timer driver" bool "Xilinx AXI Timer driver"
default y
depends on DT_HAS_XLNX_XPS_TIMER_1_00_A_ENABLED
help help
Enable counter support for the Xilinx AXI Timer v2.0 IP. Enable counter support for the Xilinx AXI Timer v2.0 IP.