Skip to content

Commit 833cea9

Browse files
yangbolu1991kartben
authored andcommitted
boards: nxp: imx95_evk: add board init for NETC
Added board init for NETC. Signed-off-by: Yangbo Lu <[email protected]>
1 parent 95f3147 commit 833cea9

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

boards/nxp/imx95_evk/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ if (CONFIG_SOF AND CONFIG_BOARD_IMX95_EVK_MIMX9596_M7_DDR)
1111
DEPENDS ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
1212
)
1313
endif()
14+
15+
zephyr_library()
16+
zephyr_library_sources(board.c)

boards/nxp/imx95_evk/board.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2024 NXP
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/devicetree.h>
7+
#include <zephyr/init.h>
8+
#include <zephyr/kernel.h>
9+
#include <soc.h>
10+
11+
static int board_init(void)
12+
{
13+
#if defined(CONFIG_ETH_NXP_IMX_NETC) && (DT_CHILD_NUM_STATUS_OKAY(DT_NODELABEL(netc)) != 0)
14+
/* Port 0 to 2 protocol configure: RGMII, RGMII, XGMII */
15+
BLK_CTRL_NETCMIX->CFG_LINK_MII_PROT = 0x00000522;
16+
BLK_CTRL_NETCMIX->CFG_LINK_PCS_PROT_2 = 0x00000040;
17+
18+
/* Unlock the IERB. It will warm reset whole NETC. */
19+
NETC_PRIV->NETCRR &= ~NETC_PRIV_NETCRR_LOCK_MASK;
20+
while ((NETC_PRIV->NETCRR & NETC_PRIV_NETCRR_LOCK_MASK) != 0U) {
21+
}
22+
23+
/* Lock the IERB. */
24+
NETC_PRIV->NETCRR |= NETC_PRIV_NETCRR_LOCK_MASK;
25+
while ((NETC_PRIV->NETCSR & NETC_PRIV_NETCSR_STATE_MASK) != 0U) {
26+
}
27+
#endif
28+
return 0;
29+
}
30+
31+
/*
32+
* Because platform is using ARM SCMI, drivers like scmi, mbox etc. are
33+
* initialized during PRE_KERNEL_1. Common init hooks is not able to use.
34+
* SoC early init and board early init could be run during PRE_KERNEL_2 instead.
35+
*/
36+
SYS_INIT(board_init, PRE_KERNEL_2, 10);

0 commit comments

Comments
 (0)