dts: common: nordic: nrf54l: Add clocks to cpu

Add clocks property to CPUs. nRF54Lx series is using hfpll as clock
source for CPU (and fast peripherals). CPU clock frequency can be
derived from frequency of the source clock so clock-frequency property
is removed from cpu as it is redundant.

nrfx/MDK expects that NRF_CONFIG_CPU_FREQ_MHZ define is set to correct
CPU frequency. Modified nrfx CMakeLists.txt to use clock frequency of
hfpll instead of CPU clock-frequency property.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruściński 2025-01-03 11:51:50 +01:00 committed by Benjamin Cabé
commit 43f442be46
4 changed files with 8 additions and 5 deletions

View file

@ -27,7 +27,7 @@
compatible = "arm,cortex-m33f"; compatible = "arm,cortex-m33f";
reg = <0>; reg = <0>;
device_type = "cpu"; device_type = "cpu";
clock-frequency = <DT_FREQ_M(64)>; clocks = <&hfpll>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
itm: itm@e0000000 { itm: itm@e0000000 {

View file

@ -23,7 +23,7 @@
compatible = "arm,cortex-m33f"; compatible = "arm,cortex-m33f";
reg = <0>; reg = <0>;
device_type = "cpu"; device_type = "cpu";
clock-frequency = <DT_FREQ_M(128)>; clocks = <&hfpll>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
itm: itm@e0000000 { itm: itm@e0000000 {

View file

@ -27,7 +27,7 @@
compatible = "arm,cortex-m33f"; compatible = "arm,cortex-m33f";
reg = <0>; reg = <0>;
device_type = "cpu"; device_type = "cpu";
clock-frequency = <DT_FREQ_M(128)>; clocks = <&hfpll>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
itm: itm@e0000000 { itm: itm@e0000000 {
@ -41,7 +41,7 @@
compatible = "nordic,vpr"; compatible = "nordic,vpr";
reg = <1>; reg = <1>;
device_type = "cpu"; device_type = "cpu";
clock-frequency = <DT_FREQ_M(128)>; clocks = <&hfpll>;
riscv,isa = "rv32emc"; riscv,isa = "rv32emc";
nordic,bus-width = <32>; nordic,bus-width = <32>;
}; };

View file

@ -184,7 +184,10 @@ if(DEFINED uicr_path)
endif() endif()
if(CONFIG_SOC_NRF54L_CPUAPP_COMMON) 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") math(EXPR clock_frequency_mhz "${clock_frequency} / 1000000")
zephyr_compile_definitions("NRF_CONFIG_CPU_FREQ_MHZ=${clock_frequency_mhz}") zephyr_compile_definitions("NRF_CONFIG_CPU_FREQ_MHZ=${clock_frequency_mhz}")
endif() endif()