Skip to content

Commit ae69de0

Browse files
dhsu-nordicbjarki-andreasen
authored andcommitted
boards: nordic: nrf7120pdk: Add clock sources to GRTC
* Add clock sources to GRTC node * Disable CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC by default Signed-off-by: Dhanoo Surasarang <[email protected]>
1 parent fd3639d commit ae69de0

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

boards/nordic/nrf7120pdk/board.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@
44
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
*/
66

7+
#include <zephyr/device.h>
78
#include <zephyr/platform/hooks.h>
89
#include "nrf7120_enga_types.h"
910
#include "nrf7120_enga_global.h"
1011

1112
#if CONFIG_BOARD_EARLY_INIT_HOOK
12-
/* Temporary workaround while VPR does not handle starting LFRC */
13+
/* Temporary workaround while VPR does not handle starting clocks */
1314
void board_early_init_hook(void)
1415
{
16+
#if defined(CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC)
1517
NRF_CLOCK_S->LFCLK.SRC = CLOCK_LFCLK_SRC_SRC_LFRC;
18+
#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lfxo))
19+
NRF_CLOCK_S->LFCLK.SRC = CLOCK_LFCLK_SRC_SRC_LFXO;
20+
#else
21+
NRF_CLOCK_S->LFCLK.SRC = CLOCK_LFCLK_SRC_SRC_LFSYNT;
22+
#endif
1623
NRF_CLOCK_S->TASKS_LFCLKSTART = 1;
1724

1825
/* Wait for event */

boards/nordic/nrf7120pdk/nrf7120pdk_nrf7120_cpuapp_emu_defconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y
2424
# Start SYSCOUNTER on driver init
2525
CONFIG_NRF_GRTC_TIMER_APP_DEFINED_INIT=n
2626
CONFIG_NRF_GRTC_START_SYSCOUNTER=y
27-
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
27+
28+
# LFRC is not working in EMU at the moment
29+
# CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
2830

2931
# Enable Debugging when working with emulator
3032
CONFIG_OUTPUT_DISASSEMBLY=y

dts/common/nordic/nrf7120_enga.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
};
4444

4545
clocks {
46+
pclk: pclk {
47+
compatible = "fixed-clock";
48+
#clock-cells = <0>;
49+
clock-frequency = <DT_FREQ_M(16)>;
50+
};
51+
4652
lfxo: lfxo {
4753
compatible = "fixed-clock";
4854
#clock-cells = <0>;
@@ -657,6 +663,8 @@
657663
compatible = "nordic,nrf-grtc";
658664
reg = <0xe2000 0x1000>;
659665
cc-num = <16>;
666+
clocks = <&lfxo>, <&pclk>;
667+
clock-names = "lfclock", "hfclock";
660668
status = "disabled";
661669
};
662670

0 commit comments

Comments
 (0)