Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
nxp_imx_netc.h
Go to the documentation of this file.
1/*
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
11
12#define NETC_BD_ALIGN 128
13
14#define FREESCALE_OUI_B0 0x00
15#define FREESCALE_OUI_B1 0x04
16#define FREESCALE_OUI_B2 0x9f
17
18/* Get phy mode from dts. Default RMII for i.MXRT1180 ENETC which hasn't added the property. */
19#define NETC_PHY_MODE(node_id) \
20 (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, mii) \
21 ? kNETC_MiiMode \
22 : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, rmii) \
23 ? kNETC_RmiiMode \
24 : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, rgmii) \
25 ? kNETC_RgmiiMode \
26 : (DT_ENUM_HAS_VALUE(node_id, phy_connection_type, gmii) \
27 ? kNETC_GmiiMode \
28 : kNETC_RmiiMode))))
29
30/* Helper macros to convert from Zephyr PHY speed to NETC speed/duplex types */
31#define PHY_TO_NETC_SPEED(x) \
32 (PHY_LINK_IS_SPEED_1000M(x) \
33 ? kNETC_MiiSpeed1000M \
34 : (PHY_LINK_IS_SPEED_100M(x) ? kNETC_MiiSpeed100M : kNETC_MiiSpeed10M))
35
36#define PHY_TO_NETC_DUPLEX_MODE(x) \
37 (PHY_LINK_IS_FULL_DUPLEX(x) ? kNETC_MiiFullDuplex : kNETC_MiiHalfDuplex)
38
39#if defined(CONFIG_NET_L2_PTP) && defined(CONFIG_PTP_CLOCK_NXP_NETC)
40#define NETC_PTP_TIMESTAMPING_SUPPORT 1
41#endif
42
43#if defined(FSL_FEATURE_NETC_HAS_SWITCH_TAG) && FSL_FEATURE_NETC_HAS_SWITCH_TAG
44#define NETC_SWITCH_TAG_SUPPORT 1
45#endif
46
47#if defined(CONFIG_DSA_NXP_IMX_NETC) && (!defined(NETC_SWITCH_TAG_SUPPORT))
48#define NETC_SWITCH_NO_TAG_DRIVER_SUPPORT 1
49#endif
50
51#if defined(CONFIG_DSA_NXP_IMX_NETC)
52/*
53 * For tag supported switch, tag driver handles timestamping.
54 * For no-tag supported switch, export timestamp functions for host driver to handle.
55 */
56#if defined(NETC_PTP_TIMESTAMPING_SUPPORT) && (!defined(NETC_SWITCH_TAG_SUPPORT))
57void dsa_netc_port_txtsid(const struct device *dev, uint16_t id);
58void dsa_netc_port_twostep_timestamp(struct dsa_switch_context *dsa_switch_ctx, uint16_t ts_req_id,
59 uint32_t timestamp);
60#endif /* NETC_PTP_TIMESTAMPING_SUPPORT && NETC_SWITCH_TAG_SUPPORT */
61#endif /* CONFIG_DSA_NXP_IMX_NETC */
62
63#endif
Distributed Switch Architecture (DSA).
Main header file for PTP (Precision Time Protocol) clock driver API.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
DSA switch context data.
Definition dsa_core.h:74