Skip to content

Commit c867cec

Browse files
lstnlrlubos
authored andcommitted
[nrf fromlist] soc: nordic: ironside: dvfs: check abb analog status more than once
Added ABB analog status lock read retries if needed. After cpu idle ABB macro may need some time to initialize and report status locked. Attempts cound can be configured using Kconfig option. Upstream PR #: 93595 Signed-off-by: Łukasz Stępnicki <[email protected]>
1 parent ec8bfd8 commit c867cec

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

soc/nordic/ironside/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ config NRF_IRONSIDE_DVFS_SERVICE
6565

6666
if NRF_IRONSIDE_DVFS_SERVICE
6767

68-
config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS
69-
int "IRONSside DVFS change oppoint mutex timeout"
70-
default 100
68+
config NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS
69+
int "IRONSside DVFS ABB analog status check maximum attempts"
70+
range 0 255
71+
default 50
7172
help
72-
Maximum timeout when waiting for DVFS oppoint change mutex lock.
73+
Maximum attempts with 10us intervals before busy status will be reported.
7374

7475
endif # NRF_IRONSIDE_DVFS_SERVICE
7576

soc/nordic/ironside/dvfs.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH;
1818
#error "Unsupported SoC series for IronSide DVFS"
1919
#endif
2020

21+
#define ABB_STATUSANA_CHECK_MAX_ATTEMPTS (CONFIG_NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS)
22+
#define ABB_STATUSANA_CHECK_INTERVAL_US (10U)
23+
2124
struct dvfs_hsfll_data_t {
2225
uint32_t new_f_mult;
2326
uint32_t new_f_trim_entry;
@@ -129,6 +132,13 @@ static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb)
129132
/* Temporary workaround until STATUSANA register is visible. */
130133
volatile const uint32_t *statusana = (uint32_t *)abb + ABB_STATUSANA_REG_OFFSET;
131134

135+
uint8_t status_read_attempts = ABB_STATUSANA_CHECK_MAX_ATTEMPTS;
136+
137+
while ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) == 0 && status_read_attempts > 0) {
138+
k_busy_wait(ABB_STATUSANA_CHECK_INTERVAL_US);
139+
status_read_attempts--;
140+
}
141+
132142
return ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) != 0);
133143
}
134144

0 commit comments

Comments
 (0)