From cc2c05a90cd6b573c8702ae4c117c3e64efa42a9 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 6 Sep 2022 10:28:25 -0500 Subject: [PATCH] drivers: timer: Update drivers to use devicetree Kconfig symbol Update timer drivers to use DT_HAS__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 --- drivers/timer/Kconfig.cc13x2_cc26x2_rtc | 3 ++- drivers/timer/Kconfig.cortex_m_systick | 14 +++++--------- drivers/timer/Kconfig.hpet | 2 ++ drivers/timer/Kconfig.ite_it8xxx2 | 3 ++- drivers/timer/Kconfig.leon_gptimer | 3 ++- drivers/timer/Kconfig.litex | 2 +- drivers/timer/Kconfig.mchp_xec_rtos | 3 ++- drivers/timer/Kconfig.mcux_gpt | 6 ++---- drivers/timer/Kconfig.mcux_lptmr | 4 +++- drivers/timer/Kconfig.mcux_os | 6 ++---- drivers/timer/Kconfig.npcx_itim | 2 +- drivers/timer/Kconfig.rcar_cmt | 2 +- drivers/timer/Kconfig.riscv_machine | 7 ++++++- drivers/timer/Kconfig.rv32m1_lptmr | 2 +- drivers/timer/Kconfig.sam0_rtc | 3 ++- drivers/timer/Kconfig.xlnx_psttc | 2 +- 16 files changed, 35 insertions(+), 29 deletions(-) diff --git a/drivers/timer/Kconfig.cc13x2_cc26x2_rtc b/drivers/timer/Kconfig.cc13x2_cc26x2_rtc index f0cfacb17d..b734b1f1d3 100644 --- a/drivers/timer/Kconfig.cc13x2_cc26x2_rtc +++ b/drivers/timer/Kconfig.cc13x2_cc26x2_rtc @@ -5,7 +5,8 @@ config CC13X2_CC26X2_RTC_TIMER bool "TI SimpleLink CC13x2/CC26x2 RTC timer" - depends on SOC_SERIES_CC13X2_CC26X2 + default y + depends on DT_HAS_TI_CC13XX_CC26XX_RTC_ENABLED select TICKLESS_CAPABLE select TIMER_HAS_64BIT_CYCLE_COUNTER help diff --git a/drivers/timer/Kconfig.cortex_m_systick b/drivers/timer/Kconfig.cortex_m_systick index 0887a2edc2..33c0e1a6e2 100644 --- a/drivers/timer/Kconfig.cortex_m_systick +++ b/drivers/timer/Kconfig.cortex_m_systick @@ -3,18 +3,14 @@ # Copyright (c) 2019 Intel Corp. # SPDX-License-Identifier: Apache-2.0 -DT_COMPAT_ARM_V6M_SYSTICK := arm,armv6m-systick -DT_COMPAT_ARM_V7M_SYSTICK := arm,armv7m-systick -DT_COMPAT_ARM_V8M_SYSTICK := arm,armv8m-systick -DT_COMPAT_ARM_V8_1M_SYSTICK := arm,armv8.1m-systick - config CORTEX_M_SYSTICK bool "Cortex-M SYSTICK timer" depends on CPU_CORTEX_M_HAS_SYSTICK - default $(dt_compat_enabled,$(DT_COMPAT_ARM_V6M_SYSTICK)) || \ - $(dt_compat_enabled,$(DT_COMPAT_ARM_V7M_SYSTICK)) || \ - $(dt_compat_enabled,$(DT_COMPAT_ARM_V8M_SYSTICK)) || \ - $(dt_compat_enabled,$(DT_COMPAT_ARM_V8_1M_SYSTICK)) + default y + depends on DT_HAS_ARM_ARMV6M_SYSTICK_ENABLED || \ + DT_HAS_ARM_ARMV7M_SYSTICK_ENABLED || \ + DT_HAS_ARM_ARMV8M_SYSTICK_ENABLED || \ + DT_HAS_ARM_ARMV8_1M_SYSTICK_ENABLED select TICKLESS_CAPABLE select SYSTEM_TIMER_HAS_DISABLE_SUPPORT select CORTEX_M_SYSTICK_INSTALL_ISR diff --git a/drivers/timer/Kconfig.hpet b/drivers/timer/Kconfig.hpet index 08afcc2dfa..c83af2b461 100644 --- a/drivers/timer/Kconfig.hpet +++ b/drivers/timer/Kconfig.hpet @@ -5,6 +5,8 @@ config HPET_TIMER bool "HPET timer" + default y + depends on DT_HAS_INTEL_HPET_ENABLED select IOAPIC if X86 select LOAPIC if X86 imply TIMER_READS_ITS_FREQUENCY_AT_RUNTIME diff --git a/drivers/timer/Kconfig.ite_it8xxx2 b/drivers/timer/Kconfig.ite_it8xxx2 index fa57602072..ad12bcae6f 100644 --- a/drivers/timer/Kconfig.ite_it8xxx2 +++ b/drivers/timer/Kconfig.ite_it8xxx2 @@ -5,7 +5,8 @@ config ITE_IT8XXX2_TIMER bool "ITE it8xxx2 timer driver" - depends on SOC_IT8XXX2 + default y + depends on DT_HAS_ITE_IT8XXX2_TIMER_ENABLED select TICKLESS_CAPABLE help This module implements a kernel device driver for the ITE it8xxx2 diff --git a/drivers/timer/Kconfig.leon_gptimer b/drivers/timer/Kconfig.leon_gptimer index 96e10b1308..3fffa6f0e6 100644 --- a/drivers/timer/Kconfig.leon_gptimer +++ b/drivers/timer/Kconfig.leon_gptimer @@ -5,7 +5,8 @@ config LEON_GPTIMER bool "LEON timer" - depends on SOC_SPARC_LEON + default y + depends on DT_HAS_GAISLER_GPTIMER_ENABLED select DYNAMIC_INTERRUPTS help This module implements a kernel device driver for the GRLIB diff --git a/drivers/timer/Kconfig.litex b/drivers/timer/Kconfig.litex index 80e2574928..ec526f4c0a 100644 --- a/drivers/timer/Kconfig.litex +++ b/drivers/timer/Kconfig.litex @@ -6,7 +6,7 @@ config LITEX_TIMER bool "LiteX Timer" default y - depends on SOC_RISCV32_LITEX_VEXRISCV + depends on DT_HAS_LITEX_TIMER0_ENABLED select TIMER_HAS_64BIT_CYCLE_COUNTER help This module implements a kernel device driver for LiteX Timer. diff --git a/drivers/timer/Kconfig.mchp_xec_rtos b/drivers/timer/Kconfig.mchp_xec_rtos index fbf7fddc49..54e81a5051 100644 --- a/drivers/timer/Kconfig.mchp_xec_rtos +++ b/drivers/timer/Kconfig.mchp_xec_rtos @@ -5,7 +5,8 @@ config MCHP_XEC_RTOS_TIMER bool "Microchip XEC series RTOS timer" - depends on SOC_FAMILY_MEC + default y + depends on DT_HAS_MICROCHIP_XEC_RTOS_TIMER_ENABLED select TICKLESS_CAPABLE select SYSTEM_TIMER_HAS_DISABLE_SUPPORT help diff --git a/drivers/timer/Kconfig.mcux_gpt b/drivers/timer/Kconfig.mcux_gpt index 1e9aadd2e6..78f485a814 100644 --- a/drivers/timer/Kconfig.mcux_gpt +++ b/drivers/timer/Kconfig.mcux_gpt @@ -1,12 +1,10 @@ # Copyright (c) 2021 NXP # SPDX-License-Identifier: Apache-2.0 -DT_COMPAT_NXP_GPT_TIMER := nxp,gpt-hw-timer - config MCUX_GPT_TIMER bool "MCUX GPT Event timer" - depends on HAS_MCUX_GPT - default $(dt_compat_enabled,$(DT_COMPAT_NXP_GPT_TIMER)) + default y + depends on DT_HAS_NXP_GPT_HW_TIMER_ENABLED select TICKLESS_CAPABLE help This module implements a kernel device driver for the NXP GPT timer, diff --git a/drivers/timer/Kconfig.mcux_lptmr b/drivers/timer/Kconfig.mcux_lptmr index c7b03b3c6e..decbbb99f9 100644 --- a/drivers/timer/Kconfig.mcux_lptmr +++ b/drivers/timer/Kconfig.mcux_lptmr @@ -5,7 +5,9 @@ config MCUX_LPTMR_TIMER bool "MCUX LPTMR timer" - depends on HAS_MCUX_LPTMR && !COUNTER_MCUX_LPTMR + default y + depends on DT_HAS_NXP_KINETIS_LPTMR_ENABLED + depends on !COUNTER_MCUX_LPTMR select SYSTEM_TIMER_HAS_DISABLE_SUPPORT help This module implements a kernel device driver for the NXP MCUX Low diff --git a/drivers/timer/Kconfig.mcux_os b/drivers/timer/Kconfig.mcux_os index d61df48187..972a669c86 100644 --- a/drivers/timer/Kconfig.mcux_os +++ b/drivers/timer/Kconfig.mcux_os @@ -3,12 +3,10 @@ # Copyright (c) 2019 Intel Corp. # SPDX-License-Identifier: Apache-2.0 -DT_COMPAT_NXP_OS_TIMER := nxp,os-timer - config MCUX_OS_TIMER bool "MCUX OS Event timer" - depends on HAS_MCUX_OS_TIMER - default $(dt_compat_enabled,$(DT_COMPAT_NXP_OS_TIMER)) + default y + depends on DT_HAS_NXP_OS_TIMER_ENABLED select TICKLESS_CAPABLE help This module implements a kernel device driver for the NXP OS diff --git a/drivers/timer/Kconfig.npcx_itim b/drivers/timer/Kconfig.npcx_itim index f9dce5923e..cfec5d35b2 100644 --- a/drivers/timer/Kconfig.npcx_itim +++ b/drivers/timer/Kconfig.npcx_itim @@ -6,7 +6,7 @@ config NPCX_ITIM_TIMER bool "Nuvoton NPCX series internal 64/32-bit timers" default y - depends on SOC_FAMILY_NPCX + depends on DT_HAS_NUVOTON_NPCX_ITIM_TIMER_ENABLED select TICKLESS_CAPABLE select TIMER_HAS_64BIT_CYCLE_COUNTER help diff --git a/drivers/timer/Kconfig.rcar_cmt b/drivers/timer/Kconfig.rcar_cmt index 999aa3f7d2..0e3034eaf3 100644 --- a/drivers/timer/Kconfig.rcar_cmt +++ b/drivers/timer/Kconfig.rcar_cmt @@ -6,7 +6,7 @@ config RCAR_CMT_TIMER bool "Renesas RCar cmt timer" default y - depends on SOC_SERIES_RCAR_GEN3 + depends on DT_HAS_RENESAS_RCAR_CMT_ENABLED help This module implements a kernel device driver for the Renesas RCAR platform provides the standard "system clock driver" interfaces. diff --git a/drivers/timer/Kconfig.riscv_machine b/drivers/timer/Kconfig.riscv_machine index 262126d43c..f22ac282af 100644 --- a/drivers/timer/Kconfig.riscv_machine +++ b/drivers/timer/Kconfig.riscv_machine @@ -5,7 +5,12 @@ config RISCV_MACHINE_TIMER bool "RISCV Machine Timer" - depends on SOC_FAMILY_RISCV_PRIVILEGE + default y + depends on DT_HAS_ANDESTECH_MACHINE_TIMER_ENABLED || \ + DT_HAS_NEORV32_MACHINE_TIMER_ENABLED || \ + DT_HAS_NUCLEI_SYSTIMER_ENABLED || \ + DT_HAS_SIFIVE_CLINT0_ENABLED || \ + DT_HAS_TELINK_MACHINE_TIMER_ENABLED select TICKLESS_CAPABLE select TIMER_HAS_64BIT_CYCLE_COUNTER help diff --git a/drivers/timer/Kconfig.rv32m1_lptmr b/drivers/timer/Kconfig.rv32m1_lptmr index d46e73e952..1af9f0b3d6 100644 --- a/drivers/timer/Kconfig.rv32m1_lptmr +++ b/drivers/timer/Kconfig.rv32m1_lptmr @@ -6,7 +6,7 @@ config RV32M1_LPTMR_TIMER bool "RV32M1 LPTMR system timer driver" default y - depends on SOC_OPENISA_RV32M1_RISCV32 + depends on DT_HAS_OPENISA_RV32M1_LPTMR_ENABLED depends on RV32M1_INTMUX help This module implements a kernel device driver for using the LPTMR diff --git a/drivers/timer/Kconfig.sam0_rtc b/drivers/timer/Kconfig.sam0_rtc index 4650ac676a..d39e9ece84 100644 --- a/drivers/timer/Kconfig.sam0_rtc +++ b/drivers/timer/Kconfig.sam0_rtc @@ -5,7 +5,8 @@ config SAM0_RTC_TIMER bool "Atmel SAM0 series RTC timer" - depends on SOC_FAMILY_SAM0 + default y + depends on DT_HAS_ATMEL_SAM0_RTC_ENABLED select TICKLESS_CAPABLE help This module implements a kernel device driver for the Atmel SAM0 diff --git a/drivers/timer/Kconfig.xlnx_psttc b/drivers/timer/Kconfig.xlnx_psttc index 657cee8673..8cd0a2619a 100644 --- a/drivers/timer/Kconfig.xlnx_psttc +++ b/drivers/timer/Kconfig.xlnx_psttc @@ -6,7 +6,7 @@ config XLNX_PSTTC_TIMER bool "Xilinx PS ttc timer support" default y - depends on SOC_XILINX_ZYNQMP + depends on DT_HAS_XLNX_TTCPS_ENABLED select TICKLESS_CAPABLE help This module implements a kernel device driver for the Xilinx ZynqMP