Skip to content

Commit 399b430

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 399b430

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

soc/nordic/nrf54l/soc.c

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

50+
#define DEVICE_DT_CLOCK_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency);
51+
5052
#if defined(NRF_APPLICATION)
5153
static inline void power_and_clock_configuration(void)
5254
{
@@ -170,19 +172,16 @@ static inline void power_and_clock_configuration(void)
170172

171173
int nordicsemi_nrf54l_init(void)
172174
{
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-
181175
#ifdef __NRF_TFM__
182176
/* TF-M enables the instruction cache from target_cfg.c, so we
183177
* don't need to enable it here.
184178
*/
185179
#else
180+
/* Update SystemCoreClock in Zephyr based on device tree to avoid SystemCoreClock
181+
* being overwritten with default value when initializing with TFM
182+
*/
183+
SystemCoreClock = DEVICE_DT_CLOCK_FREQ;
184+
186185
/* Enable ICACHE */
187186
sys_cache_instr_enable();
188187
#endif

0 commit comments

Comments
 (0)