Skip to content

Commit fe95141

Browse files
yangbolu1991henrikbrixandersen
authored andcommitted
boards: nxp: mimxrt1180_evk: add board netc init
Added board netc init for mimxrt1180_evk. Signed-off-by: Yangbo Lu <[email protected]>
1 parent a168c62 commit fe95141

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

boards/nxp/mimxrt1180_evk/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# SPDX-License-Identifier: Apache-2.0
55
#
66

7+
zephyr_library()
8+
zephyr_library_sources(board.c)
9+
710
if(CONFIG_NXP_IMXRT_BOOT_HEADER)
8-
zephyr_library()
911
if(NOT ((DEFINED CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM33)
1012
OR (DEFINED CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM7)))
1113
message(WARNING "It appears you are using the board definition for "

boards/nxp/mimxrt1180_evk/Kconfig.defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ config EXTERNAL_MEM_CONFIG_DATA
1212
config NXP_IMX_EXTERNAL_HYPERRAM
1313
default y if CPU_CORTEX_M33
1414

15+
config BOARD_EARLY_INIT_HOOK
16+
default y
1517
endif # BOARD_MIMXRT1180_EVK

boards/nxp/mimxrt1180_evk/board.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2024 NXP
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/devicetree.h>
7+
#include <zephyr/platform/hooks.h>
8+
#include <soc.h>
9+
10+
#if CONFIG_BOARD_EARLY_INIT_HOOK
11+
void board_early_init_hook(void)
12+
{
13+
#if defined(CONFIG_ETH_NXP_IMX_NETC) && (DT_CHILD_NUM_STATUS_OKAY(DT_NODELABEL(netc)) != 0)
14+
/* RMII mode */
15+
BLK_CTRL_WAKEUPMIX->NETC_LINK_CFG[4] = BLK_CTRL_WAKEUPMIX_NETC_LINK_CFG_MII_PROT(1);
16+
17+
/* Output reference clock for RMII */
18+
BLK_CTRL_WAKEUPMIX->NETC_PORT_MISC_CFG |=
19+
BLK_CTRL_WAKEUPMIX_NETC_PORT_MISC_CFG_PORT4_RMII_REF_CLK_DIR_MASK;
20+
21+
/* Unlock the IERB. It will warm reset whole NETC. */
22+
NETC_PRIV->NETCRR &= ~NETC_PRIV_NETCRR_LOCK_MASK;
23+
24+
while ((NETC_PRIV->NETCRR & NETC_PRIV_NETCRR_LOCK_MASK) != 0U) {
25+
}
26+
27+
/* Set the access attribute, otherwise MSIX access will be blocked. */
28+
NETC_IERB->ARRAY_NUM_RC[0].RCMSIAMQR &= ~(7U << 27);
29+
NETC_IERB->ARRAY_NUM_RC[0].RCMSIAMQR |= (1U << 27);
30+
31+
/* Lock the IERB. */
32+
NETC_PRIV->NETCRR |= NETC_PRIV_NETCRR_LOCK_MASK;
33+
while ((NETC_PRIV->NETCSR & NETC_PRIV_NETCSR_STATE_MASK) != 0U) {
34+
}
35+
#endif
36+
}
37+
#endif

0 commit comments

Comments
 (0)