Skip to content

Commit 5932b8a

Browse files
committed
[nrf noup] soc: nordic: nrf54l Fix for arch_busy_wait on 54l with tfm
Noup as it patches code that does not exist in zephyr arch_busy_wait waited half the expected time due to SystemCoreClock being set back to the default value when ns builds. Changed to rely on device tree as to avoid hardcoded clock frequencies Signed-off-by: Dag Erik Gjørvad <[email protected]>
1 parent a70d6bd commit 5932b8a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

soc/nordic/nrf54l/soc.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
4747
#define HFXO_NODE DT_NODELABEL(hfxo)
4848
#endif
4949

50+
#if DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)
51+
#define DEVICE_DT_CLOCK_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)
52+
#elif DT_PROP(DT_PATH(cpus, cpu_1), clock_frequency)
53+
#define DEVICE_DT_CLOCK_FREQ DT_PROP(DT_PATH(cpus, cpu_1), clock_frequency)
54+
#endif
55+
5056
#if defined(NRF_APPLICATION)
5157
static inline void power_and_clock_configuration(void)
5258
{
@@ -170,19 +176,16 @@ static inline void power_and_clock_configuration(void)
170176

171177
int nordicsemi_nrf54l_init(void)
172178
{
173-
/* Update the SystemCoreClock global variable with current core clock
174-
* retrieved from hardware state.
175-
*/
176-
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
177-
/* Currently not supported for non-secure */
178-
SystemCoreClockUpdate();
179-
#endif
180-
181179
#ifdef __NRF_TFM__
182180
/* TF-M enables the instruction cache from target_cfg.c, so we
183181
* don't need to enable it here.
184182
*/
185183
#else
184+
/* Update SystemCoreClock in Zephyr based on device tree to avoid SystemCoreClock
185+
* being overwritten with default value when initializing with TFM
186+
*/
187+
SystemCoreClock = DEVICE_DT_CLOCK_FREQ;
188+
186189
/* Enable ICACHE */
187190
sys_cache_instr_enable();
188191
#endif

0 commit comments

Comments
 (0)