diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index e4608edb9d2..b7b15587c58 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -5,11 +5,6 @@ DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition -# The 54L has a HFXO latency which is better than the default. -config MPSL_HFCLK_LATENCY - int - default 854 if MPSL - if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ BOARD_NRF54L15DK_NRF54L15_CPUAPP diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi index 6a40af0ee95..36eb7eb294b 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi @@ -99,5 +99,9 @@ pinctrl-names = "default", "sleep"; }; +&hfxo { + startup-time-us = <854>; +}; + /* Get a node label for wi-fi spi to use in shield files */ wifi_spi: &spi22 {}; diff --git a/drivers/clock_control/Kconfig.nrf b/drivers/clock_control/Kconfig.nrf index 0a3c7f652fb..968d0810065 100644 --- a/drivers/clock_control/Kconfig.nrf +++ b/drivers/clock_control/Kconfig.nrf @@ -130,8 +130,7 @@ endif # CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION config CLOCK_CONTROL_NRF_HFINT_CALIBRATION bool "HFINT clock calibration" - depends on SOC_NRF54L05 || SOC_NRF54L10 || SOC_NRF54L15 - depends on DT_HAS_NORDIC_NRF_HFXO_ENABLED + depends on DT_HAS_NORDIC_NRF54L_HFXO_ENABLED depends on !TRUSTED_EXECUTION_NONSECURE select EXPERIMENTAL help diff --git a/drivers/clock_control/clock_control_nrf.c b/drivers/clock_control/clock_control_nrf.c index 5e3fb6875e3..d148cd49e4e 100644 --- a/drivers/clock_control/clock_control_nrf.c +++ b/drivers/clock_control/clock_control_nrf.c @@ -436,6 +436,13 @@ void z_nrf_clock_bt_ctlr_hf_release(void) irq_unlock(key); } +#if DT_NODE_EXISTS(DT_NODELABEL(hfxo)) +uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void) +{ + return DT_PROP(DT_NODELABEL(hfxo), startup_time_us); +} +#endif + static int stop(const struct device *dev, clock_control_subsys_t subsys, uint32_t ctx) { diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index c3c85b110a3..cbfef90faa5 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -22,6 +22,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf51-hfxo"; + clock-frequency = <16000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 238876e4255..2134605c9f8 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -27,6 +27,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 0155485509e..6e09220e78b 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -31,6 +31,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index e22ce7b0742..12d0a0ea4d6 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -35,6 +35,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index f7ec2b926f6..d15fbb2ae4e 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -35,6 +35,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 693116c2ffd..eef2297c43b 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -31,6 +31,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 2a240db0a44..1b3620aa01c 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -35,6 +35,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index eab9c8454ee..88b3eddd6e1 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -31,6 +31,15 @@ }; }; + clocks { + hfxo: hfxo { + compatible = "nordic,nrf52-hfxo"; + clock-frequency = <64000000>; + startup-time-us = <1400>; + #clock-cells = <0>; + }; + }; + soc { ficr: ficr@10000000 { compatible = "nordic,nrf-ficr"; diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index 244459a0f16..7021b7eedeb 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -26,6 +26,7 @@ oscillators: clock-controller@4000 { compatible = "nordic,nrf53-hfxo"; #clock-cells = <0>; clock-frequency = ; + startup-time-us = <1400>; }; }; diff --git a/dts/bindings/clock/nordic,nrf51-hfxo.yaml b/dts/bindings/clock/nordic,nrf51-hfxo.yaml new file mode 100644 index 00000000000..328bdb8655b --- /dev/null +++ b/dts/bindings/clock/nordic,nrf51-hfxo.yaml @@ -0,0 +1,26 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nRF high-frequency crystal oscillator (nRF51 series) + +compatible: "nordic,nrf51-hfxo" + +include: fixed-clock.yaml + +properties: + clock-frequency: + const: 16000000 + + startup-time-us: + type: int + required: true + description: | + Startup time in microseconds. + + The value can be obtained by first measuring the time between + TASKS_HFCLKSTART and EVENTS_HFCLKSTARTED. Then multiply + the value by 2 to account for temperature and supply variations. + + Note that the startup time will be longer usual on the first + power-up and as such should not be used to determine + startup-time-us. diff --git a/dts/bindings/clock/nordic,nrf52-hfxo.yaml b/dts/bindings/clock/nordic,nrf52-hfxo.yaml new file mode 100644 index 00000000000..603cdc4ea2e --- /dev/null +++ b/dts/bindings/clock/nordic,nrf52-hfxo.yaml @@ -0,0 +1,25 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nRF high-frequency crystal oscillator (nRF52 series) + +compatible: "nordic,nrf52-hfxo" + +include: fixed-clock.yaml + +properties: + clock-frequency: + const: 64000000 + + startup-time-us: + type: int + description: | + Startup time in microseconds. + + The value can be obtained by first measuring the time between + TASKS_HFCLKSTART and EVENTS_HFCLKSTARTED. Then multiply + the value by 2 to account for temperature and supply variations. + + Note that the startup time will be longer usual on the first + power-up and as such should not be used to determine + startup-time-us. diff --git a/dts/bindings/clock/nordic,nrf53-hfxo.yaml b/dts/bindings/clock/nordic,nrf53-hfxo.yaml index b89cebedac0..f17f4218f65 100644 --- a/dts/bindings/clock/nordic,nrf53-hfxo.yaml +++ b/dts/bindings/clock/nordic,nrf53-hfxo.yaml @@ -11,6 +11,20 @@ properties: clock-frequency: const: 32000000 + startup-time-us: + type: int + required: true + description: | + Startup time in microseconds. + + The value can be obtained by first measuring the time between + TASKS_HFCLKSTART and EVENTS_HFCLKSTARTED. Then multiply + the value by 2 to account for temperature and supply variations. + + Note that the startup time will be longer usual on the first + power-up and as such should not be used to determine + startup-time-us. + load-capacitors: type: string enum: diff --git a/dts/bindings/clock/nordic,nrf-hfxo.yaml b/dts/bindings/clock/nordic,nrf54l-hfxo.yaml similarity index 70% rename from dts/bindings/clock/nordic,nrf-hfxo.yaml rename to dts/bindings/clock/nordic,nrf54l-hfxo.yaml index cd82e1c34d3..174fbb5c78f 100644 --- a/dts/bindings/clock/nordic,nrf-hfxo.yaml +++ b/dts/bindings/clock/nordic,nrf54l-hfxo.yaml @@ -1,9 +1,9 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -description: Nordic nRF high-frequency crystal oscillator +description: Nordic nRF high-frequency crystal oscillator (nRF54L series) -compatible: "nordic,nrf-hfxo" +compatible: "nordic,nrf54l-hfxo" include: fixed-clock.yaml @@ -11,6 +11,20 @@ properties: clock-frequency: const: 32000000 + startup-time-us: + type: int + required: true + description: | + Startup time in microseconds. + + The value can be obtained by first measuring the time between + TASKS_XOSTART and EVENTS_XOTUNED. Then multiply the value by 2 to + account for temperature and supply variations. + + Note that the startup time will be longer usual on the first + power-up and as such should not be used to determine + startup-time-us. + load-capacitors: type: string enum: diff --git a/dts/bindings/clock/nordic,nrf-lfxo.yaml b/dts/bindings/clock/nordic,nrf54l-lfxo.yaml similarity index 90% rename from dts/bindings/clock/nordic,nrf-lfxo.yaml rename to dts/bindings/clock/nordic,nrf54l-lfxo.yaml index 328c374769c..a023f01fb33 100644 --- a/dts/bindings/clock/nordic,nrf-lfxo.yaml +++ b/dts/bindings/clock/nordic,nrf54l-lfxo.yaml @@ -1,9 +1,9 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -description: Nordic nRF low-frequency crystal oscillator +description: Nordic nRF low-frequency crystal oscillator (nRF54L series) -compatible: "nordic,nrf-lfxo" +compatible: "nordic,nrf54l-lfxo" include: fixed-clock.yaml diff --git a/dts/common/nordic/nrf54l09.dtsi b/dts/common/nordic/nrf54l09.dtsi index ac780378837..562dc6128b0 100644 --- a/dts/common/nordic/nrf54l09.dtsi +++ b/dts/common/nordic/nrf54l09.dtsi @@ -56,15 +56,16 @@ }; lfxo: lfxo { - compatible = "nordic,nrf-lfxo"; + compatible = "nordic,nrf54l-lfxo"; #clock-cells = <0>; clock-frequency = <32768>; }; hfxo: hfxo { - compatible = "nordic,nrf-hfxo"; + compatible = "nordic,nrf54l-hfxo"; #clock-cells = <0>; clock-frequency = ; + startup-time-us = <1650>; }; hfpll: hfpll { diff --git a/dts/common/nordic/nrf54l20.dtsi b/dts/common/nordic/nrf54l20.dtsi index 917f1b3270b..b5efb351276 100644 --- a/dts/common/nordic/nrf54l20.dtsi +++ b/dts/common/nordic/nrf54l20.dtsi @@ -61,15 +61,16 @@ }; lfxo: lfxo { - compatible = "nordic,nrf-lfxo"; + compatible = "nordic,nrf54l-lfxo"; #clock-cells = <0>; clock-frequency = <32768>; }; hfxo: hfxo { - compatible = "nordic,nrf-hfxo"; + compatible = "nordic,nrf54l-hfxo"; #clock-cells = <0>; clock-frequency = ; + startup-time-us = <1650>; }; hfpll: hfpll { diff --git a/dts/common/nordic/nrf54l_05_10_15.dtsi b/dts/common/nordic/nrf54l_05_10_15.dtsi index 6ea1a1f2976..f7141ecfbf8 100644 --- a/dts/common/nordic/nrf54l_05_10_15.dtsi +++ b/dts/common/nordic/nrf54l_05_10_15.dtsi @@ -56,15 +56,16 @@ }; lfxo: lfxo { - compatible = "nordic,nrf-lfxo"; + compatible = "nordic,nrf54l-lfxo"; #clock-cells = <0>; clock-frequency = <32768>; }; hfxo: hfxo { - compatible = "nordic,nrf-hfxo"; + compatible = "nordic,nrf54l-hfxo"; #clock-cells = <0>; clock-frequency = ; + startup-time-us = <1650>; }; hfpll: hfpll { diff --git a/include/zephyr/drivers/clock_control/nrf_clock_control.h b/include/zephyr/drivers/clock_control/nrf_clock_control.h index f94667700d2..bbc581f96c4 100644 --- a/include/zephyr/drivers/clock_control/nrf_clock_control.h +++ b/include/zephyr/drivers/clock_control/nrf_clock_control.h @@ -162,6 +162,13 @@ void z_nrf_clock_bt_ctlr_hf_request(void); */ void z_nrf_clock_bt_ctlr_hf_release(void); +/** + * @brief Get clock startup time + * + * @retval HFCLK startup time in microseconds + */ +uint32_t z_nrf_clock_bt_ctlr_hf_get_startup_time_us(void); + #endif /* defined(CONFIG_CLOCK_CONTROL_NRF) */ 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..1ade977118e 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 @@ -18,7 +18,11 @@ static bool hfclk_is_running; void nrf_802154_clock_init(void) { - /* Intentionally empty. */ +#ifdef NRF54L_SERIES + uint32_t clock_latency_us = z_nrf_clock_bt_ctlr_hf_get_startup_time_us(); + + nrf_802154_clock_hfclk_latency_set(clock_latency_us); +#endif } void nrf_802154_clock_deinit(void)