diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index bc70784ebec..b1dbe191197 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -49,14 +49,11 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RTS5912_SCCON clock_control_rts5912_sccon.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRFS_AUDIOPLL clock_control_nrfs_audiopll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_IT51XXX clock_control_it51xxx.c) - -if(CONFIG_CLOCK_CONTROL_NRF2) - zephyr_library_sources(clock_control_nrf2_common.c) - zephyr_library_sources(clock_control_nrf_fll16m.c) - zephyr_library_sources(clock_control_nrf54h_hfxo.c) - zephyr_library_sources(clock_control_nrf_hsfll_local.c) - zephyr_library_sources(clock_control_nrf_lfclk.c) -endif() +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_COMMON clock_control_nrf2_common.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_FLL16M clock_control_nrf_fll16m.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) if(CONFIG_CLOCK_CONTROL_RENESAS_RZA2M_CPG) zephyr_library_sources(clock_control_renesas_rza2m_cpg.c) diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index f2a6c25a13f..8918ba2cb71 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -205,34 +205,16 @@ config CLOCK_CONTROL_NRF_ACCURACY endif # CLOCK_CONTROL_NRF -config CLOCK_CONTROL_NRF2 - bool "nRF clock control support" - default y - depends on SOC_SERIES_NRF54HX && !RISCV_CORE_NORDIC_VPR +config CLOCK_CONTROL_NRF2_COMMON + bool "NRF2 clock control common framework" select ONOFF - select NRFS if HAS_NRFS - help - Support for nRF clock control devices. - -if CLOCK_CONTROL_NRF2 - -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ - bool "Local domain scale down after init" - default y if NRFS_DVFS_LOCAL_DOMAIN - help - Request the lowest operating point after DVFS initialization. - -config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS - int "Timeout waiting for nrfs dvfs service callback in milliseconds" - default 2000 - -config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS - int "Timeout waiting for nrfs clock service callback in milliseconds" - default 1000 config CLOCK_CONTROL_NRF_HSFLL_GLOBAL bool "Clock control for global HSFLL" - depends on NRFS_GDFS_SERVICE_ENABLED + depends on DT_HAS_NORDIC_NRF_HSFLL_GLOBAL_ENABLED + select NRFS + select NRFS_GDFS_SERVICE_ENABLED + select CLOCK_CONTROL_NRF2_COMMON default y if CLOCK_CONTROL_NRF_HSFLL_GLOBAL @@ -266,7 +248,56 @@ endif # CLOCK_CONTROL_NRF_HSFLL_GLOBAL config CLOCK_CONTROL_NRFS_AUDIOPLL bool "NRFS AudioPLL driver support" depends on DT_HAS_NORDIC_NRFS_AUDIOPLL_ENABLED - depends on NRFS_AUDIOPLL_SERVICE_ENABLED + select NRFS + select NRFS_AUDIOPLL_SERVICE_ENABLED + select CLOCK_CONTROL_NRF2_COMMON default y -endif # CLOCK_CONTROL_NRF2 +config CLOCK_CONTROL_NRF_FLL16M + bool "NRF FLL16M driver support" + depends on DT_HAS_NORDIC_NRF_FLL16M_ENABLED + select CLOCK_CONTROL_NRF2_COMMON + default y + +config CLOCK_CONTROL_NRF54H_HFXO + bool "NRF54H HFXO driver support" + depends on DT_HAS_NORDIC_NRF54H_HFXO_ENABLED + select CLOCK_CONTROL_NRF2_COMMON + default y + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL + bool "NRF HSFLL LOCAL driver support" + depends on DT_HAS_NORDIC_NRF_HSFLL_LOCAL_ENABLED + select NRFS + select NRFS_DVFS_LOCAL_DOMAIN + select CLOCK_CONTROL_NRF2_COMMON + default y + +if CLOCK_CONTROL_NRF_HSFLL_LOCAL + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ + bool "Local domain scale down after init" + help + Request the lowest operating point after DVFS initialization. + +config CLOCK_CONTROL_NRF_HSFLL_LOCAL_NRFS_DVFS_TIMEOUT_MS + int "Timeout waiting for nrfs dvfs service callback in milliseconds" + default 2000 + +endif # CLOCK_CONTROL_NRF_HSFLL_LOCAL + +config CLOCK_CONTROL_NRF_LFCLK + bool "NRF LFCLK driver support" + depends on DT_HAS_NORDIC_NRF_LFCLK_ENABLED + select NRFS + select NRFS_CLOCK_SERVICE_ENABLED + select CLOCK_CONTROL_NRF2_COMMON + default y + +if CLOCK_CONTROL_NRF_LFCLK + +config CLOCK_CONTROL_NRF_LFCLK_CLOCK_TIMEOUT_MS + int "Timeout waiting for nrfs clock service callback in milliseconds" + default 1000 + +endif # CLOCK_CONTROL_NRF_LFCLK diff --git a/drivers/clock_control/clock_control_nrf_hsfll_local.c b/drivers/clock_control/clock_control_nrf_hsfll_local.c index ab2cab3b920..942f16ed444 100644 --- a/drivers/clock_control/clock_control_nrf_hsfll_local.c +++ b/drivers/clock_control/clock_control_nrf_hsfll_local.c @@ -259,7 +259,7 @@ static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { static struct hsfll_dev_data hsfll_data; #endif -#ifdef CONFIG_CLOCK_CONTROL_NRF2_HSFLL_REQ_LOW_FREQ +#ifdef CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL_REQ_LOW_FREQ static int dvfs_low_init(void) { static const k_timeout_t timeout = NRFS_DVFS_TIMEOUT; diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index 13b134c170e..f748acf61ba 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -170,9 +170,6 @@ uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void); #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ - -#if defined(CONFIG_CLOCK_CONTROL_NRF2) - /* Specifies to use the maximum available frequency for a given clock. */ #define NRF_CLOCK_CONTROL_FREQUENCY_MAX UINT32_MAX @@ -401,8 +398,6 @@ void nrf_clock_control_hfxo_request(void); */ void nrf_clock_control_hfxo_release(void); -#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */ - #ifdef __cplusplus } #endif diff --git a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c index 87aa85261e9..ca4f8c11c9c 100644 --- a/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c +++ b/modules/hal_nordic/nrf_802154/sl_opensource/platform/nrf_802154_clock_zephyr.c @@ -84,7 +84,8 @@ void nrf_802154_clock_hfclk_stop(void) hfclk_is_running = false; } -#elif defined(CONFIG_CLOCK_CONTROL_NRF2) +#elif DT_NODE_HAS_STATUS(DT_NODELABEL(hfxo), okay) && \ + DT_NODE_HAS_COMPAT(DT_NODELABEL(hfxo), nordic_nrf54h_hfxo) void nrf_802154_clock_hfclk_start(void) {