From c995217fd5d840c824fa35bbd585e2a8be808623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 27 Sep 2024 15:14:16 +0200 Subject: [PATCH 1/2] [nrf fromtree] soc: nordic: Fix the way of enabling clock control for nRF54H Series MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to commit 7a2ce2882a66f44dae9d462bb9ad965958369a28. Do not enable clock control by default on nRF54H Series SoCs when the system timer is present, because clock control is not needed for this purpose there. Add missing `default y` in the CLOCK_CONTROL_NRF2 Kconfig option that enables compilation of clock control drivers for nRF54H Series. This way modules that actually require clock control (like drivers that use radio) will be able to enable it using the generic option (CLOCK_CONTROL), not the above one that is specific for nRF54H. Update accordingly applications that referenced the CLOCK_CONTROL_NRF2 option. Signed-off-by: Andrzej Głąbek (cherry picked from commit edc4f75b6174b358566dad32e56d5ed667c5c52d) (cherry picked from commit e9fcbfe49dfc527d856a5562a34a15a4f2f153d0) --- drivers/clock_control/Kconfig.nrf | 1 + .../nordic/clock_control/configs/cpuapp_hsfll.conf | 2 +- .../boards/nordic/clock_control/configs/fll16m.conf | 2 +- samples/boards/nordic/clock_control/configs/lfclk.conf | 2 +- .../boards/nordic/clock_control/configs/uart135.conf | 2 +- soc/nordic/Kconfig.defconfig | 10 ++++------ tests/drivers/clock_control/nrf_clock_control/prj.conf | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 8c806119fd6..f7b0de3db09 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -175,6 +175,7 @@ endif # CLOCK_CONTROL_NRF config CLOCK_CONTROL_NRF2 bool "nRF clock control support" + default y depends on SOC_SERIES_NRF54HX && !RISCV_CORE_NORDIC_VPR select ONOFF select NRFS if HAS_NRFS diff --git a/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.conf b/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.conf index 5c1bad08a80..53eebac30be 100644 --- a/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.conf +++ b/samples/boards/nordic/clock_control/configs/cpuapp_hsfll.conf @@ -1,6 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -CONFIG_CLOCK_CONTROL_NRF2=y +CONFIG_CLOCK_CONTROL=y CONFIG_SAMPLE_CLOCK_FREQUENCY_HZ=320000000 diff --git a/samples/boards/nordic/clock_control/configs/fll16m.conf b/samples/boards/nordic/clock_control/configs/fll16m.conf index de9942857b9..c5d3a84f661 100644 --- a/samples/boards/nordic/clock_control/configs/fll16m.conf +++ b/samples/boards/nordic/clock_control/configs/fll16m.conf @@ -1,6 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -CONFIG_CLOCK_CONTROL_NRF2=y +CONFIG_CLOCK_CONTROL=y CONFIG_SAMPLE_CLOCK_ACCURACY_PPM=30 diff --git a/samples/boards/nordic/clock_control/configs/lfclk.conf b/samples/boards/nordic/clock_control/configs/lfclk.conf index 6cf09f0e4c7..b866d3d81d1 100644 --- a/samples/boards/nordic/clock_control/configs/lfclk.conf +++ b/samples/boards/nordic/clock_control/configs/lfclk.conf @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -CONFIG_CLOCK_CONTROL_NRF2=y +CONFIG_CLOCK_CONTROL=y CONFIG_SAMPLE_CLOCK_ACCURACY_PPM=20 CONFIG_SAMPLE_CLOCK_PRECISION=1 diff --git a/samples/boards/nordic/clock_control/configs/uart135.conf b/samples/boards/nordic/clock_control/configs/uart135.conf index de9942857b9..c5d3a84f661 100644 --- a/samples/boards/nordic/clock_control/configs/uart135.conf +++ b/samples/boards/nordic/clock_control/configs/uart135.conf @@ -1,6 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -CONFIG_CLOCK_CONTROL_NRF2=y +CONFIG_CLOCK_CONTROL=y CONFIG_SAMPLE_CLOCK_ACCURACY_PPM=30 diff --git a/soc/nordic/Kconfig.defconfig b/soc/nordic/Kconfig.defconfig index c912861cc4b..efa122aa5b5 100644 --- a/soc/nordic/Kconfig.defconfig +++ b/soc/nordic/Kconfig.defconfig @@ -7,13 +7,11 @@ if SOC_FAMILY_NORDIC_NRF rsource "*/Kconfig.defconfig" -# If the kernel has timer support, enable clock control -if SYS_CLOCK_EXISTS - +# If the kernel has timer support, enable clock control, except for SoCs +# based on the Haltium platform SoCs where clock control is not needed +# for the system timer config CLOCK_CONTROL - default y if !SOC_SERIES_NRF92X - -endif # SYS_CLOCK_EXISTS + default y if SYS_CLOCK_EXISTS && !NRF_PLATFORM_HALTIUM config SYS_CLOCK_HW_CYCLES_PER_SEC default 1000000 if NRF_GRTC_TIMER diff --git a/tests/drivers/clock_control/nrf_clock_control/prj.conf b/tests/drivers/clock_control/nrf_clock_control/prj.conf index 84145cf96a4..d11c2f125a0 100644 --- a/tests/drivers/clock_control/nrf_clock_control/prj.conf +++ b/tests/drivers/clock_control/nrf_clock_control/prj.conf @@ -1,6 +1,6 @@ CONFIG_ZTEST=y -CONFIG_CLOCK_CONTROL_NRF2=y +CONFIG_CLOCK_CONTROL=y CONFIG_LOG=y CONFIG_CLOCK_CONTROL_LOG_LEVEL_DBG=y CONFIG_LOCAL_DOMAIN_DVFS_LIB_LOG_LEVEL_DBG=y From 69d1df1d2510ed9610c1b2beea2e3e721649d29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 17 Oct 2024 15:55:14 +0200 Subject: [PATCH 2/2] [nrf fromtree] drivers: clock_control_nrf2_hsfll: Fix checking if DVFS is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To check if DVFS can be used, the CONFIG_NRFS_DVFS_LOCAL_DOMAIN symbol needs to be used, not CONFIG_NRFS_HAS_DVFS_SERVICE which only indicates that DVFS is technically possible, not that its local domain part is actually included in the build. Signed-off-by: Andrzej Głąbek (cherry picked from commit f629f1e287bc5e0d514e025e8a964c0b42a2e46f) (cherry picked from commit 5a8a8e39e34ef24a57ac93a410448b904d2a2bfd) --- drivers/clock_control/clock_control_nrf2_hsfll.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clock_control/clock_control_nrf2_hsfll.c b/drivers/clock_control/clock_control_nrf2_hsfll.c index 90cd56318dd..026edf9abbd 100644 --- a/drivers/clock_control/clock_control_nrf2_hsfll.c +++ b/drivers/clock_control/clock_control_nrf2_hsfll.c @@ -17,7 +17,7 @@ LOG_MODULE_DECLARE(clock_control_nrf2, CONFIG_CLOCK_CONTROL_LOG_LEVEL); BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "multiple instances not supported"); -#ifdef CONFIG_NRFS_HAS_DVFS_SERVICE +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN #include #define FLAG_FREQ_CHANGE_CB_EXPECTED BIT(FLAGS_COMMON_BITS) @@ -131,13 +131,13 @@ static struct onoff_manager *hsfll_find_mgr(const struct device *dev, LOG_ERR("invalid frequency"); return NULL; } -#endif /* CONFIG_NRFS_HAS_DVFS_SERVICE */ +#endif /* CONFIG_NRFS_DVFS_LOCAL_DOMAIN */ static int api_request_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { -#ifdef CONFIG_NRFS_HAS_DVFS_SERVICE +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); if (mgr) { @@ -153,7 +153,7 @@ static int api_request_hsfll(const struct device *dev, static int api_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec) { -#ifdef CONFIG_NRFS_HAS_DVFS_SERVICE +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); if (mgr) { @@ -170,7 +170,7 @@ static int api_cancel_or_release_hsfll(const struct device *dev, const struct nrf_clock_spec *spec, struct onoff_client *cli) { -#ifdef CONFIG_NRFS_HAS_DVFS_SERVICE +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN struct onoff_manager *mgr = hsfll_find_mgr(dev, spec); if (mgr) { @@ -197,7 +197,7 @@ static int api_get_rate_hsfll(const struct device *dev, static int hsfll_init(const struct device *dev) { -#ifdef CONFIG_NRFS_HAS_DVFS_SERVICE +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN struct hsfll_dev_data *dev_data = dev->data; int rc; @@ -228,12 +228,12 @@ static struct nrf_clock_control_driver_api hsfll_drv_api = { .cancel_or_release = api_cancel_or_release_hsfll, }; -#ifdef CONFIG_NRFS_HAS_DVFS_SERVICE +#ifdef CONFIG_NRFS_DVFS_LOCAL_DOMAIN static struct hsfll_dev_data hsfll_data; #endif DEVICE_DT_INST_DEFINE(0, hsfll_init, NULL, - COND_CODE_1(CONFIG_NRFS_HAS_DVFS_SERVICE, + COND_CODE_1(CONFIG_NRFS_DVFS_LOCAL_DOMAIN, (&hsfll_data), (NULL)), NULL,