From adec56bcee504d34b11a78a2fbf89bcdb51030b7 Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Tue, 10 Oct 2023 20:14:30 +0200 Subject: [PATCH] nrf5340: pretick decoupled from workaround anomaly 160 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coupling in code between workarounds for anomaly 160 and anomaly 165 (pretick) is decreased. Signed-off-by: Andrzej KuroĊ› --- soc/arm/nordic_nrf/nrf53/Kconfig.soc | 1 + soc/arm/nordic_nrf/nrf53/soc.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index 87d961d6fb3..2cd934af324 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -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 diff --git a/soc/arm/nordic_nrf/nrf53/soc.c b/soc/arm/nordic_nrf/nrf53/soc.c index 396ce79f49e..39d64d72cc2 100644 --- a/soc/arm/nordic_nrf/nrf53/soc.c +++ b/soc/arm/nordic_nrf/nrf53/soc.c @@ -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) @@ -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; @@ -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(); @@ -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) { @@ -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