1 /*
2  * Copyright (c) 2025 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief CPU frequency boost for nRF53 series
10  */
11 
12 #include <zephyr/kernel.h>
13 #include <zephyr/logging/log.h>
14 
15 #include <nrfx_clock.h>
16 
17 LOG_MODULE_DECLARE(zperf, CONFIG_NET_ZPERF_LOG_LEVEL);
18 
nrf53_cpu_boost(void)19 static int nrf53_cpu_boost(void)
20 {
21 	int err;
22 
23 	/* For optimal performance, the CPU frequency should be set to 128 MHz */
24 	err = nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK, NRF_CLOCK_HFCLK_DIV_1);
25 	err -= NRFX_ERROR_BASE_NUM;
26 	if (err != 0) {
27 		LOG_WRN("Failed to set 128 MHz: %d", err);
28 	}
29 
30 	LOG_INF("Starting %s with CPU frequency: %d MHz", CONFIG_BOARD, SystemCoreClock/MHZ(1));
31 
32 	return err;
33 }
34 
35 SYS_INIT(nrf53_cpu_boost, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
36