Skip to content

Commit 40f0842

Browse files
VitekSTfabiobaltieri
authored andcommitted
boards: mimxrt700_evk: Enable NS & NP GPIO0 access
Enable the GPIO0 peripheral regardless of DT status. Program the peripheral to allow non-secured and non-privileged accesses. This is to enable access to the GPIO0 peripheral (both port reads/writes and interrupts) from the mimxrt798s/hifi4 domain, as that domain is non-privileged. Signed-off-by: Vit Stanicek <[email protected]>
1 parent 8b1affb commit 40f0842

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

boards/nxp/mimxrt700_evk/board.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,14 @@ void board_early_init_hook(void)
308308
CLOCK_SetClkDiv(kCLOCK_DivFlexioClk, 1U);
309309
#endif
310310

311-
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay)
311+
#if CONFIG_BOARD_MIMXRT700_EVK_MIMXRT798S_CM33_CPU0
312312
CLOCK_EnableClock(kCLOCK_Gpio0);
313313
RESET_ClearPeripheralReset(kGPIO0_RST_SHIFT_RSTn);
314+
315+
GPIO0->PCNS = 0xFFFFFFFFU;
316+
GPIO0->PCNP = 0xFFFFFFFFU;
317+
GPIO0->ICNP = 0xFFFFFFFFU;
318+
GPIO0->ICNS = 0xFFFFFFFFU;
314319
#endif
315320

316321
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay)
@@ -454,7 +459,9 @@ void board_early_init_hook(void)
454459
CLOCK_AttachClk(kLPOSC_to_WWDT0);
455460
#endif
456461

457-
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sai0), okay)
462+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sai0), okay) \
463+
|| DT_NODE_HAS_STATUS(DT_NODELABEL(sai1), okay) \
464+
|| DT_NODE_HAS_STATUS(DT_NODELABEL(sai2), okay)
458465
/* SAI clock 368.64 / 15 = 24.576MHz */
459466
CLOCK_AttachClk(kAUDIO_PLL_PFD3_to_AUDIO_VDD2);
460467
CLOCK_AttachClk(kAUDIO_VDD2_to_SAI012);
@@ -554,10 +561,12 @@ static void GlikeyClearConfig(GLIKEY_Type *base)
554561
static void BOARD_InitAHBSC(void)
555562
{
556563
#if defined(CONFIG_SOC_MIMXRT798S_CM33_CPU0)
564+
GlikeyWriteEnable(GLIKEY0, 0U);
557565
GlikeyWriteEnable(GLIKEY0, 1U);
558-
AHBSC0->MISC_CTRL_DP_REG = 0x000086aa;
566+
GlikeyWriteEnable(GLIKEY0, 2U);
559567
/* AHBSC0 MISC_CTRL_REG, disable Privilege & Secure checking. */
560568
AHBSC0->MISC_CTRL_REG = 0x000086aa;
569+
AHBSC0->MISC_CTRL_DP_REG = 0x000086aa;
561570

562571
GlikeyWriteEnable(GLIKEY0, 7U);
563572
/* Enable arbiter0 accessing SRAM */
@@ -566,6 +575,14 @@ static void BOARD_InitAHBSC(void)
566575
AHBSC0->MEDIA_ARB0RAM_ACCESS_ENABLE = 0x3FFFFFFF;
567576
AHBSC0->NPU_ARB0RAM_ACCESS_ENABLE = 0x3FFFFFFF;
568577
AHBSC0->HIFI4_ARB0RAM_ACCESS_ENABLE = 0x3FFFFFFF;
578+
579+
GlikeyWriteEnable(GLIKEY0, 6U);
580+
AHBSC0->MASTER_SEC_LEVEL = 0x3;
581+
AHBSC0->MASTER_SEC_ANTI_POL_REG = 0xFFC;
582+
583+
AHBSC0->APB_SLAVE_GROUP0_RULE0 = 0x00000000;
584+
AHBSC0->AHB_PERIPHERAL0_SLAVE_RULE1 = 0x00000000;
585+
AHBSC0->AIPS1_BRIDGE_GROUP0_MEM_RULE2 = 0x00000000;
569586
#endif
570587

571588
GlikeyWriteEnable(GLIKEY1, 1U);

0 commit comments

Comments
 (0)