From 9b6a63a95168753ab7335626c53e09f62f96b966 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Wed, 13 Oct 2021 09:46:21 +0200 Subject: [PATCH] drivers/kconfig: simplify shared rtt/rtc hardware in kconfig --- cpu/efm32/Kconfig | 5 +---- cpu/sam0_common/Kconfig | 4 +--- cpu/stm32/kconfigs/f1/Kconfig | 4 +--- drivers/periph_common/Kconfig | 6 ++++++ kconfigs/Kconfig.errors | 1 + sys/ztimer/Kconfig | 3 +-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cpu/efm32/Kconfig b/cpu/efm32/Kconfig index 44a5f2a59b..61ab6abc39 100644 --- a/cpu/efm32/Kconfig +++ b/cpu/efm32/Kconfig @@ -16,6 +16,7 @@ config CPU_COMMON_EFM32 select HAS_PERIPH_RTT_SET_COUNTER select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_WDT + select HAVE_SHARED_PERIPH_RTT_PERIPH_RTC config CPU_EFM32_SERIES0 bool @@ -45,9 +46,5 @@ config HAS_EFM32_CORETEMP config CPU default "efm32" if CPU_COMMON_EFM32 -config ERROR_MODULES_CONFLICT - default "On the EFM32, the RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT - depends on CPU_COMMON_EFM32 - orsource "families/*/Kconfig" source "$(RIOTCPU)/cortexm_common/Kconfig" diff --git a/cpu/sam0_common/Kconfig b/cpu/sam0_common/Kconfig index 1d7d50c358..02a6150e6d 100644 --- a/cpu/sam0_common/Kconfig +++ b/cpu/sam0_common/Kconfig @@ -25,14 +25,12 @@ config CPU_COMMON_SAM0 select HAS_PERIPH_WDT select HAS_PERIPH_WDT_CB select HAS_PERIPH_WDT_WARNING_PERIOD + select HAVE_SHARED_PERIPH_RTT_PERIPH_RTC if CPU_COMMON_SAM0 rsource "periph/Kconfig" -config ERROR_MODULES_CONFLICT - default "On SAM0, the RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT - endif # CPU_COMMON_SAM0 source "$(RIOTCPU)/cortexm_common/Kconfig" diff --git a/cpu/stm32/kconfigs/f1/Kconfig b/cpu/stm32/kconfigs/f1/Kconfig index bbbc8c6fb5..5692629af7 100644 --- a/cpu/stm32/kconfigs/f1/Kconfig +++ b/cpu/stm32/kconfigs/f1/Kconfig @@ -17,15 +17,13 @@ config CPU_FAM_F1 select HAS_PERIPH_FLASHPAGE_RAW select HAS_PERIPH_RTT_SET_COUNTER select HAS_PERIPH_WDT + select HAVE_SHARED_PERIPH_RTT_PERIPH_RTC if CPU_FAM_F1 config CPU_FAM default "f1" -config ERROR_MODULES_CONFLICT - default "On STM32F1, the RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT - endif # CPU_FAM_F1 config HAS_CPU_STM32F1 diff --git a/drivers/periph_common/Kconfig b/drivers/periph_common/Kconfig index d594757d79..903b93440e 100644 --- a/drivers/periph_common/Kconfig +++ b/drivers/periph_common/Kconfig @@ -162,5 +162,11 @@ config MODULE_PERIPH_INIT_USBDEV endif # TEST_KCONFIG +config HAVE_SHARED_PERIPH_RTT_PERIPH_RTC + bool + help + The periph_rtc module or the periph_rtt module share hardware, thus, + only one can be selected. + rsource "Kconfig.timer" rsource "Kconfig.wdt" diff --git a/kconfigs/Kconfig.errors b/kconfigs/Kconfig.errors index 46ef792405..4f89afd88f 100644 --- a/kconfigs/Kconfig.errors +++ b/kconfigs/Kconfig.errors @@ -15,6 +15,7 @@ config ERROR_MODULES_CONFLICT string + default "The RTC and RTT map to the same hardware peripheral." if MODULE_PERIPH_RTC && MODULE_PERIPH_RTT && HAVE_SHARED_PERIPH_RTT_PERIPH_RTC help Used to indicate that conflicting modules (i.e. modules that can't be active at the same time) are being used together. diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index 5ef3b42afa..5078457b0c 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -75,8 +75,7 @@ choice bool "Backend" depends on MODULE_ZTIMER_SEC default ZTIMER_SEC_BACKEND_RTC if !BOARD_NATIVE && \ - !CPU_COMMON_SAM0 && \ - !CPU_COMMON_EFM32 + !HAVE_SHARED_PERIPH_RTT_PERIPH_RTC default ZTIMER_SEC_BACKEND_RTT config ZTIMER_SEC_BACKEND_TIMER