Skip to content

Commit

Permalink
[nrf fromlist] nrf5340: pretick decoupled from workaround anomaly 160
Browse files Browse the repository at this point in the history
Coupling in code between workarounds for anomaly 160 and anomaly 165
(pretick) is decreased.

Upstream PR: zephyrproject-rtos/zephyr#63597

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
  • Loading branch information
ankuns authored and rlubos committed Oct 11, 2023
1 parent fe1202d commit 1d4a51c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions soc/arm/nordic_nrf/nrf53/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ config SOC_NRF53_ANOMALY_160_WORKAROUND

config SOC_NRF53_RTC_PRETICK
bool "Pre-tick workaround for nRF5340 anomaly 165"
depends on (SYS_CLOCK_EXISTS && SOC_NRF5340_CPUNET) || SOC_NRF5340_CPUAPP
select NRFX_DPPI
select ARM_ON_ENTER_CPU_IDLE_HOOK if SOC_NRF5340_CPUNET
select ARM_ON_ENTER_CPU_IDLE_PREPARE_HOOK if SOC_NRF5340_CPUNET
Expand Down
9 changes: 8 additions & 1 deletion soc/arm/nordic_nrf/nrf53/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ static bool nrf53_anomaly_160_check(void)

return true;
}
#endif /* CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND */

#if defined(CONFIG_SOC_NRF53_RTC_PRETICK) && defined(CONFIG_SOC_NRF5340_CPUNET)

Expand Down Expand Up @@ -337,6 +338,8 @@ void z_arm_on_enter_cpu_idle_prepare(void)
}
#endif /* CONFIG_SOC_NRF53_RTC_PRETICK && CONFIG_SOC_NRF5340_CPUNET */

#if defined(CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND) || \
(defined(CONFIG_SOC_NRF53_RTC_PRETICK) && defined(CONFIG_SOC_NRF5340_CPUNET))
bool z_arm_on_enter_cpu_idle(void)
{
bool ok_to_sleep = true;
Expand All @@ -357,6 +360,7 @@ bool z_arm_on_enter_cpu_idle(void)
}
#endif

#if defined(CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND)
if (ok_to_sleep) {
ok_to_sleep = nrf53_anomaly_160_check();

Expand All @@ -371,6 +375,7 @@ bool z_arm_on_enter_cpu_idle(void)
}
#endif
}
#endif /* CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND */

#if defined(CONFIG_SOC_NRF53_RTC_PRETICK) && defined(CONFIG_SOC_NRF5340_CPUNET)
if (!ok_to_sleep) {
Expand All @@ -382,7 +387,9 @@ bool z_arm_on_enter_cpu_idle(void)

return ok_to_sleep;
}
#endif /* CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND */
#endif /* CONFIG_SOC_NRF53_ANOMALY_160_WORKAROUND ||
* (CONFIG_SOC_NRF53_RTC_PRETICK && CONFIG_SOC_NRF5340_CPUNET)
*/

#if CONFIG_SOC_NRF53_RTC_PRETICK
#ifdef CONFIG_SOC_NRF5340_CPUAPP
Expand Down

0 comments on commit 1d4a51c

Please sign in to comment.