|
1 | 1 | /*
|
2 |
| - * Copyright 2024 NXP |
| 2 | + * Copyright 2024-2025 NXP |
3 | 3 | * SPDX-License-Identifier: Apache-2.0
|
4 | 4 | */
|
5 | 5 | #include <zephyr/init.h>
|
@@ -84,6 +84,19 @@ __ramfunc static void enable_cache64(void)
|
84 | 84 | }
|
85 | 85 | #endif
|
86 | 86 |
|
| 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 | + |
87 | 100 | void board_early_init_hook(void)
|
88 | 101 | {
|
89 | 102 | power_mode_od();
|
@@ -183,22 +196,27 @@ void board_early_init_hook(void)
|
183 | 196 |
|
184 | 197 | #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0))
|
185 | 198 | CLOCK_EnableClock(kCLOCK_Gpio0);
|
| 199 | + unsecure_gpio(GPIO0); |
186 | 200 | #endif
|
187 | 201 |
|
188 | 202 | #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1))
|
189 | 203 | CLOCK_EnableClock(kCLOCK_Gpio1);
|
| 204 | + unsecure_gpio(GPIO1); |
190 | 205 | #endif
|
191 | 206 |
|
192 | 207 | #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2))
|
193 | 208 | CLOCK_EnableClock(kCLOCK_Gpio2);
|
| 209 | + unsecure_gpio(GPIO2); |
194 | 210 | #endif
|
195 | 211 |
|
196 | 212 | #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3))
|
197 | 213 | CLOCK_EnableClock(kCLOCK_Gpio3);
|
| 214 | + unsecure_gpio(GPIO3); |
198 | 215 | #endif
|
199 | 216 |
|
200 | 217 | #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4))
|
201 | 218 | CLOCK_EnableClock(kCLOCK_Gpio4);
|
| 219 | + unsecure_gpio(GPIO4); |
202 | 220 | #endif
|
203 | 221 |
|
204 | 222 | #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0))
|
|
0 commit comments