Skip to content

Commit 577f5f0

Browse files
[nrf noup] soc: nrf54h: work around missing power domain handling
This patch should be dropped as part of the next upmerge. The upcoming release of IronSide SE no longer disables RETAIN in all GPIO instances on boot, so the application must be able to handle the hardware default state of RETAIN being enabled. The GPIO retention is properly handled by changes that are currently only upstream and will be pulled in by the next upmerge. This patch exists a workaround to be able to integrate IronSide SE before the proper solution is pulled in. Signed-off-by: Jonathan Nilsen <[email protected]>
1 parent c1bf433 commit 577f5f0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

soc/nordic/nrf54h/soc.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <zephyr/logging/log_frontend_stmesp.h>
1515
#endif
1616

17+
#include <hal/nrf_gpio.h>
1718
#include <hal/nrf_hsfll.h>
1819
#include <hal/nrf_lrcconf.h>
1920
#include <hal/nrf_spu.h>
@@ -143,6 +144,18 @@ bool z_arm_on_enter_cpu_idle(void)
143144
}
144145
#endif
145146

147+
static void disable_all_gpio_retention(void)
148+
{
149+
NRF_GPIO_Type *gpio_regs[GPIO_COUNT] = GPIO_REG_LIST;
150+
151+
/* Some pins may not be owned by this core, depending on the configuration. The effect of
152+
* this should be that retention is disabled only for the pins owned by this core.
153+
*/
154+
for (int i = 0; i < NRFX_ARRAY_SIZE(gpio_regs); i++) {
155+
nrf_gpio_port_retain_set(gpio_regs[i], 0);
156+
}
157+
}
158+
146159
void soc_early_init_hook(void)
147160
{
148161
int err;
@@ -173,6 +186,11 @@ void soc_early_init_hook(void)
173186
DT_PROP_OR(DT_NODELABEL(nfct), nfct_pins_as_gpios, 0)) {
174187
nrf_nfct_pad_config_enable_set(NRF_NFCT, false);
175188
}
189+
190+
/* This is a workaround for not yet having upstream patches for properly handling
191+
* pin retention. It should be removed as part of the next upmerge.
192+
*/
193+
disable_all_gpio_retention();
176194
}
177195

178196
#if defined(CONFIG_SOC_LATE_INIT_HOOK)

0 commit comments

Comments
 (0)