diff --git a/soc/nordic/ironside/Kconfig b/soc/nordic/ironside/Kconfig index 2430090c943..3136e3bd5f4 100644 --- a/soc/nordic/ironside/Kconfig +++ b/soc/nordic/ironside/Kconfig @@ -65,11 +65,12 @@ config NRF_IRONSIDE_DVFS_SERVICE if NRF_IRONSIDE_DVFS_SERVICE -config NRF_IRONSIDE_DVFS_OPPOINT_CHANGE_MUTEX_TIMEOUT_MS - int "IRONSside DVFS change oppoint mutex timeout" - default 100 +config NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS + int "IRONSside DVFS ABB analog status check maximum attempts" + range 0 255 + default 50 help - Maximum tiemout when waiting for DVFS oppoint change mutex lock. + Maximum attempts with 10us intervals before busy status will be reported. endif # NRF_IRONSIDE_DVFS_SERVICE diff --git a/soc/nordic/ironside/dvfs.c b/soc/nordic/ironside/dvfs.c index 7793ff015b1..6c7a86cd0ad 100644 --- a/soc/nordic/ironside/dvfs.c +++ b/soc/nordic/ironside/dvfs.c @@ -18,6 +18,9 @@ static enum ironside_dvfs_oppoint current_dvfs_oppoint = IRONSIDE_DVFS_OPP_HIGH; #error "Unsupported SoC series for IronSide DVFS" #endif +#define ABB_STATUSANA_CHECK_MAX_ATTEMPTS (CONFIG_NRF_IRONSIDE_ABB_STATUSANA_CHECK_MAX_ATTEMPTS) +#define ABB_STATUSANA_CHECK_INTERVAL_US (10U) + struct dvfs_hsfll_data_t { uint32_t new_f_mult; uint32_t new_f_trim_entry; @@ -129,6 +132,13 @@ static inline bool ironside_dvfs_is_abb_locked(NRF_ABB_Type *abb) /* Temporary workaround until STATUSANA register is visible. */ volatile const uint32_t *statusana = (uint32_t *)abb + ABB_STATUSANA_REG_OFFSET; + uint8_t status_read_attempts = ABB_STATUSANA_CHECK_MAX_ATTEMPTS; + + while ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) == 0 && status_read_attempts > 0) { + k_busy_wait(ABB_STATUSANA_CHECK_INTERVAL_US); + status_read_attempts--; + } + return ((*statusana & ABB_STATUSANA_LOCKED_L_Msk) != 0); }