Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clocks property to CPUs in nRF54L series which can be used to get CPU clock frequency #83527

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions boards/nordic/nrf54l09pdk/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ config BT_CTLR
config ROM_START_OFFSET
default 0x800 if BOOTLOADER_MCUBOOT

config SOC_NRF54LX_SKIP_CLOCK_CONFIG
default y

config SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE
default y

Expand Down
5 changes: 5 additions & 0 deletions boards/nordic/nrf54l09pdk/nrf54l09_cpuapp_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
status = "okay";
};

&hfpll {
/* For now use 64 MHz clock for CPU and fast peripherals. */
clock-frequency = <DT_FREQ_M(64)>;
};

&lfxo {
load-capacitors = "internal";
load-capacitance-femtofarad = <15500>;
Expand Down
3 changes: 0 additions & 3 deletions boards/nordic/nrf54l20pdk/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ if BOARD_NRF54L20PDK_NRF54L20_CPUAPP
config ROM_START_OFFSET
default 0x800 if BOOTLOADER_MCUBOOT

config SOC_NRF54LX_SKIP_CLOCK_CONFIG
default y
masz-nordic marked this conversation as resolved.
Show resolved Hide resolved

config SOC_NRF54LX_SKIP_GLITCHDETECTOR_DISABLE
default y

Expand Down
5 changes: 5 additions & 0 deletions boards/nordic/nrf54l20pdk/nrf54l20_cpuapp_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
status = "okay";
};

&hfpll {
/* For now use 64 MHz clock for CPU and fast peripherals. */
clock-frequency = <DT_FREQ_M(64)>;
};

&lfxo {
load-capacitors = "internal";
load-capacitance-femtofarad = <15500>;
Expand Down
2 changes: 1 addition & 1 deletion dts/common/nordic/nrf54l09.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
compatible = "arm,cortex-m33f";
reg = <0>;
device_type = "cpu";
clock-frequency = <DT_FREQ_M(64)>;
clocks = <&hfpll>;
#address-cells = <1>;
#size-cells = <1>;
itm: itm@e0000000 {
Expand Down
2 changes: 1 addition & 1 deletion dts/common/nordic/nrf54l20.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
compatible = "arm,cortex-m33f";
reg = <0>;
device_type = "cpu";
clock-frequency = <DT_FREQ_M(128)>;
clocks = <&hfpll>;
#address-cells = <1>;
#size-cells = <1>;
itm: itm@e0000000 {
Expand Down
4 changes: 2 additions & 2 deletions dts/common/nordic/nrf54l_05_10_15.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
compatible = "arm,cortex-m33f";
reg = <0>;
device_type = "cpu";
clock-frequency = <DT_FREQ_M(128)>;
clocks = <&hfpll>;
#address-cells = <1>;
#size-cells = <1>;
itm: itm@e0000000 {
Expand All @@ -41,7 +41,7 @@
compatible = "nordic,vpr";
reg = <1>;
device_type = "cpu";
clock-frequency = <DT_FREQ_M(128)>;
clocks = <&hfpll>;
riscv,isa = "rv32emc";
nordic,bus-width = <32>;
};
Expand Down
5 changes: 4 additions & 1 deletion modules/hal_nordic/nrfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ if(DEFINED uicr_path)
endif()

if(CONFIG_SOC_NRF54L_CPUAPP_COMMON)
dt_prop(clock_frequency PATH "/cpus/cpu@0" PROPERTY "clock-frequency")
# Ideally, hfpll should taken as a phandle from clocks property from cpu but it
# seems that there is no such option in DT cmake functions. Assuming that nrf54l
# is using hfpll as CPU clock source (true for all existing devices).
dt_prop(clock_frequency PATH "/clocks/hfpll" PROPERTY "clock-frequency")
math(EXPR clock_frequency_mhz "${clock_frequency} / 1000000")
zephyr_compile_definitions("NRF_CONFIG_CPU_FREQ_MHZ=${clock_frequency_mhz}")
endif()
Expand Down
Loading