Skip to content

Nordic nRF54HX and nRF92X soc trims #90741

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bjarki-andreasen
Copy link
Collaborator

Add missing factory calibration trim values to devicetree sources and move applying them to common, scalable file to be used by both nRF54HX and nRF92X SoCs.

The nRF54HX and nRF92X series need to read and apply factory
trims to peripherals owned by individual domains at runtime.

To simplify this procedure, make it scalable, simplify drivers, and
save on ROM, collect all trim handling in one place.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add support for applying HSFLL TCOEF trim.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add missing nordic,nrf-memconf bindings and nodes to the nrf54h
and nrf92 socs.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Implement trim of memconf blocks for nrf54hx and nrf92x app and rad
cores.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Copy link

@@ -113,7 +112,6 @@ static int clock_control_nrf_auxpll_init(const struct device *dev)
nrf_auxpll_ctrl_frequency_set(config->auxpll, config->frequency);

nrf_auxpll_lock(config->auxpll);
nrf_auxpll_trim_ctune_set(config->auxpll, sys_read8(config->ficr_ctune));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For peripherals that can be trimmed in init(), trimming should be kept in separate drivers.

Copy link
Collaborator Author

@bjarki-andreasen bjarki-andreasen Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, if all of this can be moved to nrfx_<periph>_init() that would be great, and if we had some init for hsfll and memconf as well we could call from early c code that would solve the issue. Then we could move all of this out of the devicetree.

Comment on lines +79 to +93
static void trim_memconf(void)
{
NRF_MEMCONF_Type *memconf = (NRF_MEMCONF_Type *)DT_REG_ADDR(MEMCONF_NODE);

const uint16_t trims[4] = {
sys_read32(FICR_ADDR_GET_BY_IDX(MEMCONF_NODE, 0)),
sys_read32(FICR_ADDR_GET_BY_IDX(MEMCONF_NODE, 1)),
sys_read32(FICR_ADDR_GET_BY_IDX(MEMCONF_NODE, 2)),
sys_read32(FICR_ADDR_GET_BY_IDX(MEMCONF_NODE, 3)),
};

ARRAY_FOR_EACH(trims, i) {
nrf_memconf_memtrim_set(memconf, i, trims[i]);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEMCONF should be trimmed before accessing memory.

@@ -38,3 +38,7 @@ endif()

zephyr_library_sources_ifdef(CONFIG_NRF_SYS_EVENT nrf_sys_event.c)
zephyr_library_sources_ifdef(CONFIG_MRAM_LATENCY mram_latency.c)

if((CONFIG_SOC_SERIES_NRF54HX OR CONFIG_SOC_SERIES_NRF92X) AND CONFIG_ARM)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a Kconfig selected by SoCs that need it?
Considering AUXPLL and MEMCONF should not be included here, perhaps a fitting name would be HAS_HSFLL_TRIM.

Copy link
Collaborator Author

@bjarki-andreasen bjarki-andreasen Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just how its done for other code specifc to these two SoCs ATM. and it does not only trim HSFLL, so NEEDS_SOFTWARE_TRIM or something maybe, if its worth the time to make this a kconfig in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants