Skip to content

Commit

Permalink
soc:nordic:nrf54l Fix for arch_busy_wait on 54l with tfm
Browse files Browse the repository at this point in the history
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 <dag.erik.gjorvad@nordicsemi.no>
  • Loading branch information
degjorva committed Nov 12, 2024
1 parent a70d6bd commit 1de1822
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions soc/nordic/nrf54l/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
#define HFXO_NODE DT_NODELABEL(hfxo)
#endif

#define DEVICE_DT_CLOCK_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency);

#if defined(NRF_APPLICATION)
static inline void power_and_clock_configuration(void)
{
Expand Down Expand Up @@ -170,19 +172,16 @@ static inline void power_and_clock_configuration(void)

int nordicsemi_nrf54l_init(void)
{
/* Update the SystemCoreClock global variable with current core clock
* retrieved from hardware state.
*/
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
/* Currently not supported for non-secure */
SystemCoreClockUpdate();
#endif

#ifdef __NRF_TFM__
/* TF-M enables the instruction cache from target_cfg.c, so we
* don't need to enable it here.
*/
#else
/* Update SystemCoreClock in Zephyr based on device tree to avoid SystemCoreClock
* being overwritten with default value when initializing with TFM
*/
SystemCoreClock = DEVICE_DT_CLOCK_FREQ;

/* Enable ICACHE */
sys_cache_instr_enable();
#endif
Expand Down

0 comments on commit 1de1822

Please sign in to comment.