drivers: clock_control: nrf2: split configs per driver

Currently the config CLOCK_CONTROL_NRF2 is used as a GLOB
style config which includes all "NRF2" drivers and related
configs.

With NRF2, clocks are treated as individidual devices
with individual device drivers. This commit split the
CLOCK_CONTROL_NRF2 config into device specific configs
and ifdefs. With this, drivers are selected individually
based on devicetree state as is common for most devices
drivers, and dependencies like NRFS and specific NRFS
services are selected by the specific driver which nees it.

Checks for CLOCK_CONTROL_NRF2 are updated to check for
existance of the clocks instead.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
This commit is contained in:
Bjarki Arge Andreasen 2025-06-06 12:43:00 +02:00 committed by Benjamin Cabé
commit 8a27773247
5 changed files with 65 additions and 41 deletions

View file

@ -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)

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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)
{