Skip to content

Commit d75fe02

Browse files
DerekSnellkartben
authored andcommitted
boards: nxp: frdm_mcxn947: enable GPIO in all modes
For CPU1 access, enable GPIO access in non-secure and non-privilege modes. Signed-off-by: Derek Snell <[email protected]>
1 parent e4a9467 commit d75fe02

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

boards/nxp/frdm_mcxn947/board.c

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 NXP
2+
* Copyright 2024-2025 NXP
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#include <zephyr/init.h>
@@ -84,6 +84,19 @@ __ramfunc static void enable_cache64(void)
8484
}
8585
#endif
8686

87+
static void unsecure_gpio(GPIO_Type * base)
88+
{
89+
/* Enables CPU1 to access GPIO registers
90+
* Pins and interrupts can be configured in non-secure access
91+
*/
92+
base->PCNS = 0xFFFFFFFFU;
93+
base->ICNS = GPIO_ICNS_NSE1_MASK | GPIO_ICNS_NSE0_MASK;
94+
95+
/* Pins and interrupts can be configured in non-privilege access */
96+
base->PCNP = 0xFFFFFFFFU;
97+
base->ICNP = GPIO_ICNP_NPE1_MASK | GPIO_ICNP_NPE0_MASK;
98+
}
99+
87100
void board_early_init_hook(void)
88101
{
89102
power_mode_od();
@@ -183,22 +196,27 @@ void board_early_init_hook(void)
183196

184197
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0))
185198
CLOCK_EnableClock(kCLOCK_Gpio0);
199+
unsecure_gpio(GPIO0);
186200
#endif
187201

188202
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1))
189203
CLOCK_EnableClock(kCLOCK_Gpio1);
204+
unsecure_gpio(GPIO1);
190205
#endif
191206

192207
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2))
193208
CLOCK_EnableClock(kCLOCK_Gpio2);
209+
unsecure_gpio(GPIO2);
194210
#endif
195211

196212
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3))
197213
CLOCK_EnableClock(kCLOCK_Gpio3);
214+
unsecure_gpio(GPIO3);
198215
#endif
199216

200217
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4))
201218
CLOCK_EnableClock(kCLOCK_Gpio4);
219+
unsecure_gpio(GPIO4);
202220
#endif
203221

204222
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0))

0 commit comments

Comments
 (0)