Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules: hal_nordic: nrfs: DVFS cleanup #82341

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 5 additions & 123 deletions modules/hal_nordic/nrfs/dvfs/ld_dvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,7 @@ void ld_dvfs_init(void)

const struct dvfs_oppoint_data *opp_data = get_dvfs_oppoint_data(DVFS_FREQ_HIGH);

#if defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
LOG_DBG("%s", __func__);
LOG_DBG("REGW: NRF_ABB->TRIM.RINGO[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.RINGO[CURR_TARG_ABB_SLOT],
opp_data->abb_ringo);
LOG_DBG("REGW: NRF_ABB->TRIM.LOCKRANGE[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.LOCKRANGE[CURR_TARG_ABB_SLOT],
opp_data->abb_lockrange);
LOG_DBG("REGW: NRF_ABB->TRIM.PVTMONCYCLES[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.PVTMONCYCLES[CURR_TARG_ABB_SLOT],
opp_data->abb_pvtmoncycles);

/*For app core.*/
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.RINGO[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.RINGO[CURR_TARG_ABB_SLOT],
opp_data->abb_ringo);
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.LOCKRANGE[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.LOCKRANGE[CURR_TARG_ABB_SLOT],
opp_data->abb_lockrange);
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.PVTMONCYCLES[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.PVTMONCYCLES[CURR_TARG_ABB_SLOT],
opp_data->abb_pvtmoncycles);
#else
#if !defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
/* TODO: Change to NRFX Hal function when available. */
NRF_ABB->TRIM.RINGO[CURR_TARG_ABB_SLOT] = opp_data->abb_ringo;
NRF_ABB->TRIM.LOCKRANGE[CURR_TARG_ABB_SLOT] = opp_data->abb_lockrange;
Expand All @@ -84,12 +56,7 @@ void ld_dvfs_init(void)
void ld_dvfs_clear_zbb(void)
{
#if defined(NRF_SECURE)
#if defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
LOG_DBG("%s", __func__);
LOG_DBG("REGW: NRF_ABB->CONFIG.CTRL1.MODE 0x%x, V: 0x%x",
(uint32_t)&NRF_ABB->CONFIG.CTRL1,
LD_ABB_CLR_ZBB);
#else
#if !defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
/* TODO: Change to NRFX Hal function when available. */
NRF_ABB->CONFIG.CTRL1 &= ~(ABB_CONFIG_CTRL1_MODE_Msk);
NRF_APPLICATION_ABB->CONFIG.CTRL1 &= ~(ABB_CONFIG_CTRL1_MODE_Msk);
Expand Down Expand Up @@ -161,34 +128,7 @@ void ld_dvfs_configure_abb_for_transition(enum dvfs_frequency_setting transient_
const struct dvfs_oppoint_data *opp_data = get_dvfs_oppoint_data(transient_opp);

#if defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
LOG_DBG("%s", __func__);
LOG_DBG("transient_opp: %d, curr_targ_opp: %d", transient_opp, curr_targ_opp);
LOG_DBG("REGW: NRF_ABB->TRIM.RINGO[%d] 0x%x, V: 0x%x",
TRANSIENT_ZBB_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.RINGO[TRANSIENT_ZBB_ABB_SLOT],
opp_data->abb_ringo);
LOG_DBG("REGW: NRF_ABB->TRIM.LOCKRANGE[%d] 0x%x, V: 0x%x",
TRANSIENT_ZBB_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.LOCKRANGE[TRANSIENT_ZBB_ABB_SLOT],
opp_data->abb_lockrange);
LOG_DBG("REGW: NRF_ABB->TRIM.PVTMONCYCLES[%d] 0x%x, V: 0x%x",
TRANSIENT_ZBB_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.PVTMONCYCLES[TRANSIENT_ZBB_ABB_SLOT],
opp_data->abb_pvtmoncycles);

/* For app core.*/
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.RINGO[%d] 0x%x, V: 0x%x",
TRANSIENT_ZBB_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.RINGO[TRANSIENT_ZBB_ABB_SLOT],
opp_data->abb_ringo);
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.LOCKRANGE[%d] 0x%x, V: 0x%x",
TRANSIENT_ZBB_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.LOCKRANGE[TRANSIENT_ZBB_ABB_SLOT],
opp_data->abb_lockrange);
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.PVTMONCYCLES[%d] 0x%x, V: 0x%x",
TRANSIENT_ZBB_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.PVTMONCYCLES[TRANSIENT_ZBB_ABB_SLOT],
opp_data->abb_pvtmoncycles);
#else

NRF_ABB->TRIM.RINGO[TRANSIENT_ZBB_ABB_SLOT] = opp_data->abb_ringo;
Expand All @@ -201,42 +141,8 @@ void ld_dvfs_configure_abb_for_transition(enum dvfs_frequency_setting transient_
#endif
opp_data = get_dvfs_oppoint_data(curr_targ_opp);

#if defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
LOG_DBG("REGW: NRF_ABB->TRIM.RINGO[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.RINGO[CURR_TARG_ABB_SLOT],
opp_data->abb_ringo);
LOG_DBG("REGW: NRF_ABB->TRIM.LOCKRANGE[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.LOCKRANGE[CURR_TARG_ABB_SLOT],
opp_data->abb_lockrange);
LOG_DBG("REGW: NRF_ABB->TRIM.PVTMONCYCLES[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_ABB->TRIM.PVTMONCYCLES[CURR_TARG_ABB_SLOT],
opp_data->abb_pvtmoncycles);

LOG_DBG("REGW: TODO: NRF_ABB->CONFIG.CTRL4 0x%x, V: 0x%lx",
(uint32_t)&NRF_ABB->CONFIG.CTRL4,
LD_ABB_CTRL4_TRANSITION_OPERATION);

/* For app core */
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.RINGO[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.RINGO[CURR_TARG_ABB_SLOT],
opp_data->abb_ringo);
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.LOCKRANGE[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.LOCKRANGE[CURR_TARG_ABB_SLOT],
opp_data->abb_lockrange);
LOG_DBG("REGW: NRF_APPLICATION_ABB->TRIM.PVTMONCYCLES[%d] 0x%x, V: 0x%x",
CURR_TARG_ABB_SLOT,
(uint32_t)&NRF_APPLICATION_ABB->TRIM.PVTMONCYCLES[CURR_TARG_ABB_SLOT],
opp_data->abb_pvtmoncycles);

LOG_DBG("REGW: TODO: NRF_APPLICATION_ABB->CONFIG.CTRL4 0x%x, V: 0x%lx",
(uint32_t)&NRF_APPLICATION_ABB->CONFIG.CTRL4,
LD_ABB_CTRL4_TRANSITION_OPERATION);
#else
#if !defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)

NRF_ABB->TRIM.RINGO[CURR_TARG_ABB_SLOT] = opp_data->abb_ringo;
NRF_ABB->TRIM.LOCKRANGE[CURR_TARG_ABB_SLOT] = opp_data->abb_lockrange;
NRF_ABB->TRIM.PVTMONCYCLES[CURR_TARG_ABB_SLOT] = opp_data->abb_pvtmoncycles;
Expand Down Expand Up @@ -281,22 +187,6 @@ int32_t ld_dvfs_configure_hsfll(enum dvfs_frequency_setting oppoint)

#if defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
LOG_DBG("%s oppoint: %d", __func__, oppoint);
LOG_DBG("REGW: NRF_HSFLL->MIRROR 0x%x, V: 0x%x", (uint32_t)&NRF_HSFLL->MIRROR, 1);
LOG_DBG("REGW: NRF_HSFLL->TRIM.COARSE 0x%x, V: 0x%x",
(uint32_t)&NRF_HSFLL->TRIM.COARSE,
hsfll_trim.coarse);
LOG_DBG("REGW: NRF_HSFLL->TRIM.FINE 0x%x, V: 0x%x",
(uint32_t)&NRF_HSFLL->TRIM.FINE,
hsfll_trim.fine);
LOG_DBG("REGW: NRF_HSFLL->MIRROR 0x%x, V: 0x%x", (uint32_t)&NRF_HSFLL->MIRROR, 0);

LOG_DBG("REGW: NRF_HSFLL->CLOCKCTRL.MULT 0x%x, V: 0x%x",
(uint32_t)&NRF_HSFLL->CLOCKCTRL.MULT,
get_dvfs_oppoint_data(oppoint)->new_f_mult);

LOG_DBG("REGW: NRF_HSFLL->NRF_HSFLL_TASK_FREQ_CHANGE 0x%x, V: 0x%x",
(uint32_t)NRF_HSFLL + NRF_HSFLL_TASK_FREQ_CHANGE,
0x1);
return 0;
#else

Expand Down Expand Up @@ -337,15 +227,7 @@ void ld_dvfs_scaling_background_process(bool downscaling)
void ld_dvfs_scaling_finish(bool downscaling)
{
#if defined(NRF_SECURE)
#if defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
LOG_DBG("%s", __func__);
LOG_DBG("REGW: NRF_ABB->CONFIG.CTRL4 0x%x, V: 0x%lx",
(uint32_t)&NRF_ABB->CONFIG.CTRL4,
LD_ABB_CTRL4_NORMAL_OPERATION);
LOG_DBG("REGW: NRF_APPLICATION_ABB->CONFIG.CTRL4 0x%x, V: 0x%lx",
(uint32_t)&NRF_APPLICATION_ABB->CONFIG.CTRL4,
LD_ABB_CTRL4_NORMAL_OPERATION);
#else
#if !defined(CONFIG_NRFS_LOCAL_DOMAIN_DVFS_TEST)
NRF_ABB->CONFIG.CTRL4 = LD_ABB_CTRL4_NORMAL_OPERATION;
NRF_APPLICATION_ABB->CONFIG.CTRL4 = LD_ABB_CTRL4_NORMAL_OPERATION;
#endif
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ manifest:
groups:
- hal
- name: hal_nordic
revision: e0e48c4ec75595767a286389e2fcda72b21363b0
revision: pull/264/head
path: modules/hal/nordic
groups:
- hal
Expand Down
Loading