Line data Source code
1 0 : /*
2 : * Copyright 2025 NXP
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #ifndef __NXP_IMX_NETC_H__
7 : #define __NXP_IMX_NETC_H__
8 :
9 0 : #define NETC_BD_ALIGN 128
10 :
11 0 : #define FREESCALE_OUI_B0 0x00
12 0 : #define FREESCALE_OUI_B1 0x04
13 0 : #define FREESCALE_OUI_B2 0x9f
14 :
15 : /* Get phy mode from dts. Default RMII for i.MXRT1180 ENETC which hasn't added the property. */
16 0 : #define NETC_PHY_MODE(node_id) \
17 : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, mii) \
18 : ? kNETC_MiiMode \
19 : : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, rmii) \
20 : ? kNETC_RmiiMode \
21 : : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, rgmii) \
22 : ? kNETC_RgmiiMode \
23 : : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, gmii) \
24 : ? kNETC_GmiiMode \
25 : : kNETC_RmiiMode))))
26 :
27 : /* Helper macros to convert from Zephyr PHY speed to NETC speed/duplex types */
28 0 : #define PHY_TO_NETC_SPEED(x) \
29 : (PHY_LINK_IS_SPEED_1000M(x) \
30 : ? kNETC_MiiSpeed1000M \
31 : : (PHY_LINK_IS_SPEED_100M(x) ? kNETC_MiiSpeed100M : kNETC_MiiSpeed10M))
32 :
33 0 : #define PHY_TO_NETC_DUPLEX_MODE(x) \
34 : (PHY_LINK_IS_FULL_DUPLEX(x) ? kNETC_MiiFullDuplex : kNETC_MiiHalfDuplex)
35 :
36 : #endif
|