1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /* Copyright 2013-2016 Freescale Semiconductor Inc.
9 * Contains initialization APIs and runtime control APIs for DPMAC
14 int dpmac_open(struct fsl_mc_io
*mc_io
,
19 int dpmac_close(struct fsl_mc_io
*mc_io
,
24 * enum dpmac_link_type - DPMAC link type
25 * @DPMAC_LINK_TYPE_NONE: No link
26 * @DPMAC_LINK_TYPE_FIXED: Link is fixed type
27 * @DPMAC_LINK_TYPE_PHY: Link by PHY ID
28 * @DPMAC_LINK_TYPE_BACKPLANE: Backplane link type
30 enum dpmac_link_type
{
32 DPMAC_LINK_TYPE_FIXED
,
34 DPMAC_LINK_TYPE_BACKPLANE
38 * enum dpmac_eth_if - DPMAC Ethrnet interface
39 * @DPMAC_ETH_IF_MII: MII interface
40 * @DPMAC_ETH_IF_RMII: RMII interface
41 * @DPMAC_ETH_IF_SMII: SMII interface
42 * @DPMAC_ETH_IF_GMII: GMII interface
43 * @DPMAC_ETH_IF_RGMII: RGMII interface
44 * @DPMAC_ETH_IF_SGMII: SGMII interface
45 * @DPMAC_ETH_IF_QSGMII: QSGMII interface
46 * @DPMAC_ETH_IF_XAUI: XAUI interface
47 * @DPMAC_ETH_IF_XFI: XFI interface
48 * @DPMAC_ETH_IF_CAUI: CAUI interface
49 * @DPMAC_ETH_IF_1000BASEX: 1000BASEX interface
50 * @DPMAC_ETH_IF_USXGMII: USXGMII interface
63 DPMAC_ETH_IF_1000BASEX
,
68 * struct dpmac_attr - Structure representing DPMAC attributes
69 * @id: DPMAC object ID
70 * @max_rate: Maximum supported rate - in Mbps
71 * @eth_if: Ethernet interface
72 * @link_type: link type
77 enum dpmac_eth_if eth_if
;
78 enum dpmac_link_type link_type
;
81 int dpmac_get_attributes(struct fsl_mc_io
*mc_io
,
84 struct dpmac_attr
*attr
);
87 * DPMAC link configuration/state options
91 * Enable auto-negotiation
93 #define DPMAC_LINK_OPT_AUTONEG BIT_ULL(0)
95 * Enable half-duplex mode
97 #define DPMAC_LINK_OPT_HALF_DUPLEX BIT_ULL(1)
101 #define DPMAC_LINK_OPT_PAUSE BIT_ULL(2)
103 * Enable a-symmetric pause frames
105 #define DPMAC_LINK_OPT_ASYM_PAUSE BIT_ULL(3)
108 * Advertised link speeds
110 #define DPMAC_ADVERTISED_10BASET_FULL BIT_ULL(0)
111 #define DPMAC_ADVERTISED_100BASET_FULL BIT_ULL(1)
112 #define DPMAC_ADVERTISED_1000BASET_FULL BIT_ULL(2)
113 #define DPMAC_ADVERTISED_10000BASET_FULL BIT_ULL(4)
114 #define DPMAC_ADVERTISED_2500BASEX_FULL BIT_ULL(5)
117 * Advertise auto-negotiation enable
119 #define DPMAC_ADVERTISED_AUTONEG BIT_ULL(3)
122 * struct dpmac_link_state - DPMAC link configuration request
123 * @rate: Rate in Mbps
124 * @options: Enable/Disable DPMAC link cfg features (bitmap)
126 * @state_valid: Ignore/Update the state of the link
127 * @supported: Speeds capability of the phy (bitmap)
128 * @advertising: Speeds that are advertised for autoneg (bitmap)
130 struct dpmac_link_state
{
139 int dpmac_set_link_state(struct fsl_mc_io
*mc_io
,
142 struct dpmac_link_state
*link_state
);
145 * enum dpmac_counter_id - DPMAC counter types
147 * @DPMAC_CNT_ING_FRAME_64: counts 64-bytes frames, good or bad.
148 * @DPMAC_CNT_ING_FRAME_127: counts 65- to 127-bytes frames, good or bad.
149 * @DPMAC_CNT_ING_FRAME_255: counts 128- to 255-bytes frames, good or bad.
150 * @DPMAC_CNT_ING_FRAME_511: counts 256- to 511-bytes frames, good or bad.
151 * @DPMAC_CNT_ING_FRAME_1023: counts 512- to 1023-bytes frames, good or bad.
152 * @DPMAC_CNT_ING_FRAME_1518: counts 1024- to 1518-bytes frames, good or bad.
153 * @DPMAC_CNT_ING_FRAME_1519_MAX: counts 1519-bytes frames and larger
154 * (up to max frame length specified),
156 * @DPMAC_CNT_ING_FRAG: counts frames which are shorter than 64 bytes received
158 * @DPMAC_CNT_ING_JABBER: counts frames longer than the maximum frame length
159 * specified, with a bad frame check sequence.
160 * @DPMAC_CNT_ING_FRAME_DISCARD: counts dropped frames due to internal errors.
161 * Occurs when a receive FIFO overflows.
162 * Includes also frames truncated as a result of
163 * the receive FIFO overflow.
164 * @DPMAC_CNT_ING_ALIGN_ERR: counts frames with an alignment error
165 * (optional used for wrong SFD).
166 * @DPMAC_CNT_EGR_UNDERSIZED: counts frames transmitted that was less than 64
167 * bytes long with a good CRC.
168 * @DPMAC_CNT_ING_OVERSIZED: counts frames longer than the maximum frame length
169 * specified, with a good frame check sequence.
170 * @DPMAC_CNT_ING_VALID_PAUSE_FRAME: counts valid pause frames (regular and PFC)
171 * @DPMAC_CNT_EGR_VALID_PAUSE_FRAME: counts valid pause frames transmitted
173 * @DPMAC_CNT_ING_BYTE: counts bytes received except preamble for all valid
174 * frames and valid pause frames.
175 * @DPMAC_CNT_ING_MCAST_FRAME: counts received multicast frames.
176 * @DPMAC_CNT_ING_BCAST_FRAME: counts received broadcast frames.
177 * @DPMAC_CNT_ING_ALL_FRAME: counts each good or bad frames received.
178 * @DPMAC_CNT_ING_UCAST_FRAME: counts received unicast frames.
179 * @DPMAC_CNT_ING_ERR_FRAME: counts frames received with an error
180 * (except for undersized/fragment frame).
181 * @DPMAC_CNT_EGR_BYTE: counts bytes transmitted except preamble for all valid
182 * frames and valid pause frames transmitted.
183 * @DPMAC_CNT_EGR_MCAST_FRAME: counts transmitted multicast frames.
184 * @DPMAC_CNT_EGR_BCAST_FRAME: counts transmitted broadcast frames.
185 * @DPMAC_CNT_EGR_UCAST_FRAME: counts transmitted unicast frames.
186 * @DPMAC_CNT_EGR_ERR_FRAME: counts frames transmitted with an error.
187 * @DPMAC_CNT_ING_GOOD_FRAME: counts frames received without error, including
189 * @DPMAC_CNT_EGR_GOOD_FRAME: counts frames transmitted without error, including
192 enum dpmac_counter_id
{
193 DPMAC_CNT_ING_FRAME_64
,
194 DPMAC_CNT_ING_FRAME_127
,
195 DPMAC_CNT_ING_FRAME_255
,
196 DPMAC_CNT_ING_FRAME_511
,
197 DPMAC_CNT_ING_FRAME_1023
,
198 DPMAC_CNT_ING_FRAME_1518
,
199 DPMAC_CNT_ING_FRAME_1519_MAX
,
201 DPMAC_CNT_ING_JABBER
,
202 DPMAC_CNT_ING_FRAME_DISCARD
,
203 DPMAC_CNT_ING_ALIGN_ERR
,
204 DPMAC_CNT_EGR_UNDERSIZED
,
205 DPMAC_CNT_ING_OVERSIZED
,
206 DPMAC_CNT_ING_VALID_PAUSE_FRAME
,
207 DPMAC_CNT_EGR_VALID_PAUSE_FRAME
,
209 DPMAC_CNT_ING_MCAST_FRAME
,
210 DPMAC_CNT_ING_BCAST_FRAME
,
211 DPMAC_CNT_ING_ALL_FRAME
,
212 DPMAC_CNT_ING_UCAST_FRAME
,
213 DPMAC_CNT_ING_ERR_FRAME
,
215 DPMAC_CNT_EGR_MCAST_FRAME
,
216 DPMAC_CNT_EGR_BCAST_FRAME
,
217 DPMAC_CNT_EGR_UCAST_FRAME
,
218 DPMAC_CNT_EGR_ERR_FRAME
,
219 DPMAC_CNT_ING_GOOD_FRAME
,
220 DPMAC_CNT_EGR_GOOD_FRAME
223 int dpmac_get_counter(struct fsl_mc_io
*mc_io
, u32 cmd_flags
, u16 token
,
224 enum dpmac_counter_id id
, u64
*value
);
226 #endif /* __FSL_DPMAC_H */