Skip to content

Commit cc0d188

Browse files
ananglcvinayak
authored andcommitted
[nrf fromlist] soc: nrf53: Add implementation of workaround for anomaly 168
Use the already available in the tree mechanism of adding assembly instructions right after WFI/WFE to implement the workaround for nRF5340 anomaly 168 (replace the 4 NOP solution used on the network core as it turned out to be insufficient) and provide two related Kconfig options so that users are able to adjust the workaround to their actual needs (disable it entirely or use it in the extended version). Signed-off-by: Andrzej Głąbek <[email protected]> Upstream PR: zephyrproject-rtos/zephyr#66159
1 parent 2c45751 commit cc0d188

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

soc/arm/nordic_nrf/nrf53/Kconfig.soc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ config SOC_NRF5340_CPUAPP
1212
select HAS_POWEROFF
1313
select SOC_COMPATIBLE_NRF5340_CPUAPP
1414
imply SOC_NRF53_RTC_PRETICK
15+
imply SOC_NRF53_ANOMALY_168_WORKAROUND
1516

1617
config SOC_NRF5340_CPUNET
1718
bool
18-
select ARM_ON_EXIT_CPU_IDLE
1919
select SOC_COMPATIBLE_NRF5340_CPUNET
2020
imply SOC_NRF53_ANOMALY_160_WORKAROUND_NEEDED
2121
imply SOC_NRF53_RTC_PRETICK if !WDT_NRFX
22+
imply SOC_NRF53_ANOMALY_168_WORKAROUND
2223

2324
choice
2425
prompt "nRF53x MCU Selection"
@@ -79,6 +80,25 @@ config SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET
7980

8081
endif
8182

83+
config SOC_NRF53_ANOMALY_168_WORKAROUND
84+
bool "Workaround for nRF5340 anomaly 168"
85+
select ARM_ON_EXIT_CPU_IDLE
86+
help
87+
Indicates that the workaround for the anomaly 168 that affects
88+
the nRF5340 SoC should be applied.
89+
The workaround involves execution of 8 NOP instructions when the CPU
90+
exist its idle state (when the WFI/WFE instruction returns) and it is
91+
enabled by default for both the application and network core.
92+
93+
config SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM
94+
bool "Extend the workaround to execution at 128 MHz from RAM"
95+
depends on SOC_NRF53_ANOMALY_168_WORKAROUND && SOC_NRF5340_CPUAPP
96+
help
97+
Indicates that the anomaly 168 workaround is to be extended to cover
98+
also a specific case when the WFI/WFE instruction is executed at 128
99+
MHz from RAM. Then, 26 instead of 8 NOP instructions needs to be
100+
executed after WFI/WFE. This extension is not enabled by default.
101+
82102
if SOC_NRF5340_CPUAPP
83103

84104
config SOC_DCDC_NRF53X_APP

soc/arm/nordic_nrf/nrf53/soc_cpu_idle.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111

1212
#if defined(_ASMLANGUAGE)
1313

14+
#if defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM)
1415
#define SOC_ON_EXIT_CPU_IDLE \
16+
.rept 26 \
1517
nop; \
18+
.endr
19+
#elif defined(CONFIG_SOC_NRF53_ANOMALY_168_WORKAROUND)
20+
#define SOC_ON_EXIT_CPU_IDLE \
21+
.rept 8 \
1622
nop; \
17-
nop; \
18-
nop;
23+
.endr
24+
#endif
1925

2026
#endif /* _ASMLANGUAGE */

0 commit comments

Comments
 (0)