]>
Commit | Line | Data |
---|---|---|
9525ae83 RK |
1 | #ifndef NETDEV_PCS_H |
2 | #define NETDEV_PCS_H | |
3 | ||
4 | #include <linux/phy.h> | |
5 | #include <linux/spinlock.h> | |
6 | #include <linux/workqueue.h> | |
7 | ||
8 | struct device_node; | |
9 | struct ethtool_cmd; | |
8fa7b9b6 | 10 | struct fwnode_handle; |
9525ae83 RK |
11 | struct net_device; |
12 | ||
13 | enum { | |
14 | MLO_PAUSE_NONE, | |
4e5aeb41 RK |
15 | MLO_PAUSE_RX = BIT(0), |
16 | MLO_PAUSE_TX = BIT(1), | |
9525ae83 | 17 | MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX, |
4e5aeb41 | 18 | MLO_PAUSE_AN = BIT(2), |
9525ae83 RK |
19 | |
20 | MLO_AN_PHY = 0, /* Conventional PHY */ | |
21 | MLO_AN_FIXED, /* Fixed-link mode */ | |
86a362c4 | 22 | MLO_AN_INBAND, /* In-band protocol */ |
9525ae83 RK |
23 | }; |
24 | ||
25 | static inline bool phylink_autoneg_inband(unsigned int mode) | |
26 | { | |
86a362c4 | 27 | return mode == MLO_AN_INBAND; |
9525ae83 RK |
28 | } |
29 | ||
8796c892 RK |
30 | /** |
31 | * struct phylink_link_state - link state structure | |
32 | * @advertising: ethtool bitmask containing advertised link modes | |
33 | * @lp_advertising: ethtool bitmask containing link partner advertised link | |
34 | * modes | |
35 | * @interface: link &typedef phy_interface_t mode | |
36 | * @speed: link speed, one of the SPEED_* constants. | |
37 | * @duplex: link duplex mode, one of DUPLEX_* constants. | |
38 | * @pause: link pause state, described by MLO_PAUSE_* constants. | |
39 | * @link: true if the link is up. | |
40 | * @an_enabled: true if autonegotiation is enabled/desired. | |
41 | * @an_complete: true if autonegotiation has completed. | |
42 | */ | |
9525ae83 RK |
43 | struct phylink_link_state { |
44 | __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); | |
45 | __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising); | |
8796c892 | 46 | phy_interface_t interface; |
9525ae83 RK |
47 | int speed; |
48 | int duplex; | |
49 | int pause; | |
50 | unsigned int link:1; | |
51 | unsigned int an_enabled:1; | |
52 | unsigned int an_complete:1; | |
53 | }; | |
54 | ||
44cc27e4 IC |
55 | enum phylink_op_type { |
56 | PHYLINK_NETDEV = 0, | |
43de6195 | 57 | PHYLINK_DEV, |
44cc27e4 IC |
58 | }; |
59 | ||
60 | /** | |
61 | * struct phylink_config - PHYLINK configuration structure | |
62 | * @dev: a pointer to a struct device associated with the MAC | |
63 | * @type: operation type of PHYLINK instance | |
1511ed0a | 64 | * @pcs_poll: MAC PCS cannot provide link change interrupt |
5d682f5e MCC |
65 | * @poll_fixed_state: if true, starts link_poll, |
66 | * if MAC link is at %MLO_AN_FIXED mode. | |
ab393850 | 67 | * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND |
5d682f5e MCC |
68 | * @get_fixed_state: callback to execute to determine the fixed link state, |
69 | * if MAC link is at %MLO_AN_FIXED mode. | |
44cc27e4 IC |
70 | */ |
71 | struct phylink_config { | |
72 | struct device *dev; | |
73 | enum phylink_op_type type; | |
1511ed0a | 74 | bool pcs_poll; |
5c05c1db | 75 | bool poll_fixed_state; |
ab393850 | 76 | bool ovr_an_inband; |
5c05c1db RK |
77 | void (*get_fixed_state)(struct phylink_config *config, |
78 | struct phylink_link_state *state); | |
44cc27e4 IC |
79 | }; |
80 | ||
8796c892 RK |
81 | /** |
82 | * struct phylink_mac_ops - MAC operations structure. | |
83 | * @validate: Validate and update the link configuration. | |
d46b7e4f | 84 | * @mac_pcs_get_state: Read the current link state from the hardware. |
b7ad14c2 | 85 | * @mac_prepare: prepare for a major reconfiguration of the interface. |
8796c892 | 86 | * @mac_config: configure the MAC for the selected mode and state. |
b7ad14c2 | 87 | * @mac_finish: finish a major reconfiguration of the interface. |
8796c892 RK |
88 | * @mac_an_restart: restart 802.3z BaseX autonegotiation. |
89 | * @mac_link_down: take the link down. | |
90 | * @mac_link_up: allow the link to come up. | |
91 | * | |
92 | * The individual methods are described more fully below. | |
93 | */ | |
9525ae83 | 94 | struct phylink_mac_ops { |
44cc27e4 IC |
95 | void (*validate)(struct phylink_config *config, |
96 | unsigned long *supported, | |
9525ae83 | 97 | struct phylink_link_state *state); |
d46b7e4f RK |
98 | void (*mac_pcs_get_state)(struct phylink_config *config, |
99 | struct phylink_link_state *state); | |
b7ad14c2 RK |
100 | int (*mac_prepare)(struct phylink_config *config, unsigned int mode, |
101 | phy_interface_t iface); | |
44cc27e4 | 102 | void (*mac_config)(struct phylink_config *config, unsigned int mode, |
9525ae83 | 103 | const struct phylink_link_state *state); |
b7ad14c2 RK |
104 | int (*mac_finish)(struct phylink_config *config, unsigned int mode, |
105 | phy_interface_t iface); | |
44cc27e4 IC |
106 | void (*mac_an_restart)(struct phylink_config *config); |
107 | void (*mac_link_down)(struct phylink_config *config, unsigned int mode, | |
c6ab3008 | 108 | phy_interface_t interface); |
91a208f2 RK |
109 | void (*mac_link_up)(struct phylink_config *config, |
110 | struct phy_device *phy, unsigned int mode, | |
111 | phy_interface_t interface, int speed, int duplex, | |
112 | bool tx_pause, bool rx_pause); | |
9525ae83 RK |
113 | }; |
114 | ||
8796c892 RK |
115 | #if 0 /* For kernel-doc purposes only. */ |
116 | /** | |
117 | * validate - Validate and update the link configuration | |
44cc27e4 | 118 | * @config: a pointer to a &struct phylink_config. |
8796c892 RK |
119 | * @supported: ethtool bitmask for supported link modes. |
120 | * @state: a pointer to a &struct phylink_link_state. | |
121 | * | |
122 | * Clear bits in the @supported and @state->advertising masks that | |
123 | * are not supportable by the MAC. | |
124 | * | |
125 | * Note that the PHY may be able to transform from one connection | |
126 | * technology to another, so, eg, don't clear 1000BaseX just | |
127 | * because the MAC is unable to BaseX mode. This is more about | |
32e454ef RK |
128 | * clearing unsupported speeds and duplex settings. The port modes |
129 | * should not be cleared; phylink_set_port_modes() will help with this. | |
8796c892 RK |
130 | * |
131 | * If the @state->interface mode is %PHY_INTERFACE_MODE_1000BASEX | |
132 | * or %PHY_INTERFACE_MODE_2500BASEX, select the appropriate mode | |
133 | * based on @state->advertising and/or @state->speed and update | |
32e454ef RK |
134 | * @state->interface accordingly. See phylink_helper_basex_speed(). |
135 | * | |
136 | * When @state->interface is %PHY_INTERFACE_MODE_NA, phylink expects the | |
137 | * MAC driver to return all supported link modes. | |
138 | * | |
139 | * If the @state->interface mode is not supported, then the @supported | |
140 | * mask must be cleared. | |
8796c892 | 141 | */ |
44cc27e4 | 142 | void validate(struct phylink_config *config, unsigned long *supported, |
8796c892 RK |
143 | struct phylink_link_state *state); |
144 | ||
145 | /** | |
d46b7e4f | 146 | * mac_pcs_get_state() - Read the current inband link state from the hardware |
44cc27e4 | 147 | * @config: a pointer to a &struct phylink_config. |
8796c892 RK |
148 | * @state: a pointer to a &struct phylink_link_state. |
149 | * | |
d46b7e4f RK |
150 | * Read the current inband link state from the MAC PCS, reporting the |
151 | * current speed in @state->speed, duplex mode in @state->duplex, pause | |
152 | * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits, | |
153 | * negotiation completion state in @state->an_complete, and link up state | |
154 | * in @state->link. If possible, @state->lp_advertising should also be | |
155 | * populated. | |
8796c892 | 156 | */ |
d46b7e4f RK |
157 | void mac_pcs_get_state(struct phylink_config *config, |
158 | struct phylink_link_state *state); | |
8796c892 | 159 | |
b7ad14c2 RK |
160 | /** |
161 | * mac_prepare() - prepare to change the PHY interface mode | |
162 | * @config: a pointer to a &struct phylink_config. | |
163 | * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. | |
164 | * @iface: interface mode to switch to | |
165 | * | |
166 | * phylink will call this method at the beginning of a full initialisation | |
167 | * of the link, which includes changing the interface mode or at initial | |
168 | * startup time. It may be called for the current mode. The MAC driver | |
169 | * should perform whatever actions are required, e.g. disabling the | |
170 | * Serdes PHY. | |
171 | * | |
172 | * This will be the first call in the sequence: | |
173 | * - mac_prepare() | |
174 | * - mac_config() | |
175 | * - pcs_config() | |
176 | * - possible pcs_an_restart() | |
177 | * - mac_finish() | |
178 | * | |
179 | * Returns zero on success, or negative errno on failure which will be | |
180 | * reported to the kernel log. | |
181 | */ | |
182 | int mac_prepare(struct phylink_config *config, unsigned int mode, | |
183 | phy_interface_t iface); | |
184 | ||
8796c892 RK |
185 | /** |
186 | * mac_config() - configure the MAC for the selected mode and state | |
44cc27e4 | 187 | * @config: a pointer to a &struct phylink_config. |
8796c892 RK |
188 | * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. |
189 | * @state: a pointer to a &struct phylink_link_state. | |
190 | * | |
4add7009 RKAL |
191 | * Note - not all members of @state are valid. In particular, |
192 | * @state->lp_advertising, @state->link, @state->an_complete are never | |
193 | * guaranteed to be correct, and so any mac_config() implementation must | |
194 | * never reference these fields. | |
195 | * | |
91a208f2 RK |
196 | * (this requires a rewrite - please refer to mac_link_up() for situations |
197 | * where the PCS and MAC are not tightly integrated.) | |
198 | * | |
b70486f9 RK |
199 | * In all negotiation modes, as defined by @mode, @state->pause indicates the |
200 | * pause settings which should be applied as follows. If %MLO_PAUSE_AN is not | |
201 | * set, %MLO_PAUSE_TX and %MLO_PAUSE_RX indicate whether the MAC should send | |
202 | * pause frames and/or act on received pause frames respectively. Otherwise, | |
203 | * the results of in-band negotiation/status from the MAC PCS should be used | |
204 | * to control the MAC pause mode settings. | |
205 | * | |
8796c892 RK |
206 | * The action performed depends on the currently selected mode: |
207 | * | |
208 | * %MLO_AN_FIXED, %MLO_AN_PHY: | |
91a208f2 RK |
209 | * Configure for non-inband negotiation mode, where the link settings |
210 | * are completely communicated via mac_link_up(). The physical link | |
211 | * protocol from the MAC is specified by @state->interface. | |
212 | * | |
213 | * @state->advertising may be used, but is not required. | |
214 | * | |
215 | * Older drivers (prior to the mac_link_up() change) may use @state->speed, | |
216 | * @state->duplex and @state->pause to configure the MAC, but this is | |
217 | * deprecated; such drivers should be converted to use mac_link_up(). | |
4add7009 | 218 | * |
91a208f2 RK |
219 | * Other members of @state must be ignored. |
220 | * | |
221 | * Valid state members: interface, advertising. | |
222 | * Deprecated state members: speed, duplex, pause. | |
8796c892 RK |
223 | * |
224 | * %MLO_AN_INBAND: | |
225 | * place the link in an inband negotiation mode (such as 802.3z | |
226 | * 1000base-X or Cisco SGMII mode depending on the @state->interface | |
227 | * mode). In both cases, link state management (whether the link | |
228 | * is up or not) is performed by the MAC, and reported via the | |
d46b7e4f | 229 | * mac_pcs_get_state() callback. Changes in link state must be made |
8796c892 RK |
230 | * by calling phylink_mac_change(). |
231 | * | |
b70486f9 RK |
232 | * Interface mode specific details are mentioned below. |
233 | * | |
8796c892 | 234 | * If in 802.3z mode, the link speed is fixed, dependent on the |
b70486f9 RK |
235 | * @state->interface. Duplex and pause modes are negotiated via |
236 | * the in-band configuration word. Advertised pause modes are set | |
237 | * according to the @state->an_enabled and @state->advertising | |
238 | * flags. Beware of MACs which only support full duplex at gigabit | |
239 | * and higher speeds. | |
8796c892 RK |
240 | * |
241 | * If in Cisco SGMII mode, the link speed and duplex mode are passed | |
242 | * in the serial bitstream 16-bit configuration word, and the MAC | |
243 | * should be configured to read these bits and acknowledge the | |
244 | * configuration word. Nothing is advertised by the MAC. The MAC is | |
245 | * responsible for reading the configuration word and configuring | |
246 | * itself accordingly. | |
0e29ae03 | 247 | * |
4add7009 RKAL |
248 | * Valid state members: interface, an_enabled, pause, advertising. |
249 | * | |
0e29ae03 RK |
250 | * Implementations are expected to update the MAC to reflect the |
251 | * requested settings - i.o.w., if nothing has changed between two | |
252 | * calls, no action is expected. If only flow control settings have | |
253 | * changed, flow control should be updated *without* taking the link | |
254 | * down. This "update" behaviour is critical to avoid bouncing the | |
255 | * link up status. | |
8796c892 | 256 | */ |
44cc27e4 | 257 | void mac_config(struct phylink_config *config, unsigned int mode, |
8796c892 RK |
258 | const struct phylink_link_state *state); |
259 | ||
b7ad14c2 RK |
260 | /** |
261 | * mac_finish() - finish a to change the PHY interface mode | |
262 | * @config: a pointer to a &struct phylink_config. | |
263 | * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. | |
264 | * @iface: interface mode to switch to | |
265 | * | |
266 | * phylink will call this if it called mac_prepare() to allow the MAC to | |
267 | * complete any necessary steps after the MAC and PCS have been configured | |
268 | * for the @mode and @iface. E.g. a MAC driver may wish to re-enable the | |
269 | * Serdes PHY here if it was previously disabled by mac_prepare(). | |
270 | * | |
271 | * Returns zero on success, or negative errno on failure which will be | |
272 | * reported to the kernel log. | |
273 | */ | |
274 | int mac_finish(struct phylink_config *config, unsigned int mode, | |
275 | phy_interface_t iface); | |
276 | ||
8796c892 RK |
277 | /** |
278 | * mac_an_restart() - restart 802.3z BaseX autonegotiation | |
44cc27e4 | 279 | * @config: a pointer to a &struct phylink_config. |
8796c892 | 280 | */ |
44cc27e4 | 281 | void mac_an_restart(struct phylink_config *config); |
8796c892 RK |
282 | |
283 | /** | |
284 | * mac_link_down() - take the link down | |
44cc27e4 | 285 | * @config: a pointer to a &struct phylink_config. |
8796c892 | 286 | * @mode: link autonegotiation mode |
c6ab3008 | 287 | * @interface: link &typedef phy_interface_t mode |
8796c892 RK |
288 | * |
289 | * If @mode is not an in-band negotiation mode (as defined by | |
290 | * phylink_autoneg_inband()), force the link down and disable any | |
c6ab3008 FF |
291 | * Energy Efficient Ethernet MAC configuration. Interface type |
292 | * selection must be done in mac_config(). | |
8796c892 | 293 | */ |
44cc27e4 | 294 | void mac_link_down(struct phylink_config *config, unsigned int mode, |
c6ab3008 | 295 | phy_interface_t interface); |
8796c892 RK |
296 | |
297 | /** | |
298 | * mac_link_up() - allow the link to come up | |
44cc27e4 | 299 | * @config: a pointer to a &struct phylink_config. |
91a208f2 | 300 | * @phy: any attached phy |
8796c892 | 301 | * @mode: link autonegotiation mode |
c6ab3008 | 302 | * @interface: link &typedef phy_interface_t mode |
91a208f2 RK |
303 | * @speed: link speed |
304 | * @duplex: link duplex | |
305 | * @tx_pause: link transmit pause enablement status | |
306 | * @rx_pause: link receive pause enablement status | |
8796c892 | 307 | * |
91a208f2 RK |
308 | * Configure the MAC for an established link. |
309 | * | |
310 | * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link | |
311 | * settings, and should be used to configure the MAC block appropriately | |
312 | * where these settings are not automatically conveyed from the PCS block, | |
313 | * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode)) | |
314 | * is disabled. | |
315 | * | |
316 | * Note that when 802.3z in-band negotiation is in use, it is possible | |
317 | * that the user wishes to override the pause settings, and this should | |
318 | * be allowed when considering the implementation of this method. | |
319 | * | |
320 | * If in-band negotiation mode is disabled, allow the link to come up. If | |
321 | * @phy is non-%NULL, configure Energy Efficient Ethernet by calling | |
8796c892 | 322 | * phy_init_eee() and perform appropriate MAC configuration for EEE. |
c6ab3008 | 323 | * Interface type selection must be done in mac_config(). |
8796c892 | 324 | */ |
91a208f2 RK |
325 | void mac_link_up(struct phylink_config *config, struct phy_device *phy, |
326 | unsigned int mode, phy_interface_t interface, | |
327 | int speed, int duplex, bool tx_pause, bool rx_pause); | |
8796c892 RK |
328 | #endif |
329 | ||
7137e18f RK |
330 | struct phylink_pcs_ops; |
331 | ||
332 | /** | |
333 | * struct phylink_pcs - PHYLINK PCS instance | |
334 | * @ops: a pointer to the &struct phylink_pcs_ops structure | |
335 | * @poll: poll the PCS for link changes | |
336 | * | |
337 | * This structure is designed to be embedded within the PCS private data, | |
338 | * and will be passed between phylink and the PCS. | |
339 | */ | |
340 | struct phylink_pcs { | |
341 | const struct phylink_pcs_ops *ops; | |
342 | bool poll; | |
343 | }; | |
344 | ||
4c0d6d3a RK |
345 | /** |
346 | * struct phylink_pcs_ops - MAC PCS operations structure. | |
347 | * @pcs_get_state: read the current MAC PCS link state from the hardware. | |
348 | * @pcs_config: configure the MAC PCS for the selected mode and state. | |
349 | * @pcs_an_restart: restart 802.3z BaseX autonegotiation. | |
350 | * @pcs_link_up: program the PCS for the resolved link configuration | |
351 | * (where necessary). | |
352 | */ | |
353 | struct phylink_pcs_ops { | |
7137e18f | 354 | void (*pcs_get_state)(struct phylink_pcs *pcs, |
4c0d6d3a | 355 | struct phylink_link_state *state); |
7137e18f | 356 | int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode, |
4c0d6d3a | 357 | phy_interface_t interface, |
1571e700 RK |
358 | const unsigned long *advertising, |
359 | bool permit_pause_to_mac); | |
7137e18f RK |
360 | void (*pcs_an_restart)(struct phylink_pcs *pcs); |
361 | void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int mode, | |
4c0d6d3a RK |
362 | phy_interface_t interface, int speed, int duplex); |
363 | }; | |
364 | ||
365 | #if 0 /* For kernel-doc purposes only. */ | |
366 | /** | |
367 | * pcs_get_state() - Read the current inband link state from the hardware | |
7137e18f | 368 | * @pcs: a pointer to a &struct phylink_pcs. |
4c0d6d3a RK |
369 | * @state: a pointer to a &struct phylink_link_state. |
370 | * | |
371 | * Read the current inband link state from the MAC PCS, reporting the | |
372 | * current speed in @state->speed, duplex mode in @state->duplex, pause | |
373 | * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits, | |
374 | * negotiation completion state in @state->an_complete, and link up state | |
375 | * in @state->link. If possible, @state->lp_advertising should also be | |
376 | * populated. | |
377 | * | |
378 | * When present, this overrides mac_pcs_get_state() in &struct | |
379 | * phylink_mac_ops. | |
380 | */ | |
7137e18f | 381 | void pcs_get_state(struct phylink_pcs *pcs, |
4c0d6d3a RK |
382 | struct phylink_link_state *state); |
383 | ||
384 | /** | |
385 | * pcs_config() - Configure the PCS mode and advertisement | |
7137e18f | 386 | * @pcs: a pointer to a &struct phylink_pcs. |
4c0d6d3a RK |
387 | * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND. |
388 | * @interface: interface mode to be used | |
389 | * @advertising: adertisement ethtool link mode mask | |
1571e700 | 390 | * @permit_pause_to_mac: permit forwarding pause resolution to MAC |
4c0d6d3a RK |
391 | * |
392 | * Configure the PCS for the operating mode, the interface mode, and set | |
1571e700 RK |
393 | * the advertisement mask. @permit_pause_to_mac indicates whether the |
394 | * hardware may forward the pause mode resolution to the MAC. | |
4c0d6d3a RK |
395 | * |
396 | * When operating in %MLO_AN_INBAND, inband should always be enabled, | |
397 | * otherwise inband should be disabled. | |
398 | * | |
399 | * For SGMII, there is no advertisement from the MAC side, the PCS should | |
400 | * be programmed to acknowledge the inband word from the PHY. | |
401 | * | |
402 | * For 1000BASE-X, the advertisement should be programmed into the PCS. | |
403 | * | |
404 | * For most 10GBASE-R, there is no advertisement. | |
405 | */ | |
7137e18f | 406 | int pcs_config(struct phylink_pcs *pcs, unsigned int mode, |
0b76e642 RD |
407 | phy_interface_t interface, const unsigned long *advertising, |
408 | bool permit_pause_to_mac); | |
4c0d6d3a RK |
409 | |
410 | /** | |
411 | * pcs_an_restart() - restart 802.3z BaseX autonegotiation | |
7137e18f | 412 | * @pcs: a pointer to a &struct phylink_pcs. |
4c0d6d3a RK |
413 | * |
414 | * When PCS ops are present, this overrides mac_an_restart() in &struct | |
415 | * phylink_mac_ops. | |
416 | */ | |
7137e18f | 417 | void pcs_an_restart(struct phylink_pcs *pcs); |
4c0d6d3a RK |
418 | |
419 | /** | |
420 | * pcs_link_up() - program the PCS for the resolved link configuration | |
7137e18f | 421 | * @pcs: a pointer to a &struct phylink_pcs. |
4c0d6d3a RK |
422 | * @mode: link autonegotiation mode |
423 | * @interface: link &typedef phy_interface_t mode | |
424 | * @speed: link speed | |
425 | * @duplex: link duplex | |
426 | * | |
427 | * This call will be made just before mac_link_up() to inform the PCS of | |
428 | * the resolved link parameters. For example, a PCS operating in SGMII | |
429 | * mode without in-band AN needs to be manually configured for the link | |
430 | * and duplex setting. Otherwise, this should be a no-op. | |
431 | */ | |
7137e18f RK |
432 | void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, |
433 | phy_interface_t interface, int speed, int duplex); | |
4c0d6d3a RK |
434 | #endif |
435 | ||
44cc27e4 IC |
436 | struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, |
437 | phy_interface_t iface, | |
e7765d63 | 438 | const struct phylink_mac_ops *mac_ops); |
7137e18f | 439 | void phylink_set_pcs(struct phylink *, struct phylink_pcs *pcs); |
9525ae83 RK |
440 | void phylink_destroy(struct phylink *); |
441 | ||
442 | int phylink_connect_phy(struct phylink *, struct phy_device *); | |
0a62964c | 443 | int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); |
25396f68 CJ |
444 | int phylink_fwnode_phy_connect(struct phylink *pl, |
445 | struct fwnode_handle *fwnode, | |
446 | u32 flags); | |
9525ae83 RK |
447 | void phylink_disconnect_phy(struct phylink *); |
448 | ||
449 | void phylink_mac_change(struct phylink *, bool up); | |
450 | ||
451 | void phylink_start(struct phylink *); | |
452 | void phylink_stop(struct phylink *); | |
453 | ||
454 | void phylink_ethtool_get_wol(struct phylink *, struct ethtool_wolinfo *); | |
455 | int phylink_ethtool_set_wol(struct phylink *, struct ethtool_wolinfo *); | |
456 | ||
457 | int phylink_ethtool_ksettings_get(struct phylink *, | |
458 | struct ethtool_link_ksettings *); | |
459 | int phylink_ethtool_ksettings_set(struct phylink *, | |
460 | const struct ethtool_link_ksettings *); | |
461 | int phylink_ethtool_nway_reset(struct phylink *); | |
462 | void phylink_ethtool_get_pauseparam(struct phylink *, | |
463 | struct ethtool_pauseparam *); | |
464 | int phylink_ethtool_set_pauseparam(struct phylink *, | |
465 | struct ethtool_pauseparam *); | |
9525ae83 | 466 | int phylink_get_eee_err(struct phylink *); |
86e58135 | 467 | int phylink_init_eee(struct phylink *, bool); |
9525ae83 RK |
468 | int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *); |
469 | int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *); | |
470 | int phylink_mii_ioctl(struct phylink *, struct ifreq *, int); | |
c6d5d843 RK |
471 | int phylink_speed_down(struct phylink *pl, bool sync); |
472 | int phylink_speed_up(struct phylink *pl); | |
9525ae83 RK |
473 | |
474 | #define phylink_zero(bm) \ | |
475 | bitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS) | |
476 | #define __phylink_do_bit(op, bm, mode) \ | |
477 | op(ETHTOOL_LINK_MODE_ ## mode ## _BIT, bm) | |
478 | ||
479 | #define phylink_set(bm, mode) __phylink_do_bit(__set_bit, bm, mode) | |
480 | #define phylink_clear(bm, mode) __phylink_do_bit(__clear_bit, bm, mode) | |
481 | #define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode) | |
482 | ||
483 | void phylink_set_port_modes(unsigned long *bits); | |
624c0f02 | 484 | void phylink_helper_basex_speed(struct phylink_link_state *state); |
9525ae83 | 485 | |
74db1c18 RK |
486 | void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, |
487 | struct phylink_link_state *state); | |
488 | int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, | |
0bd27406 RK |
489 | phy_interface_t interface, |
490 | const unsigned long *advertising); | |
93eaceb0 RK |
491 | int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, |
492 | phy_interface_t interface, | |
493 | const unsigned long *advertising); | |
74db1c18 RK |
494 | void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs); |
495 | ||
b8679ef8 RK |
496 | void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs, |
497 | struct phylink_link_state *state); | |
afd62209 IC |
498 | |
499 | void phylink_decode_usxgmii_word(struct phylink_link_state *state, | |
500 | uint16_t lpa); | |
9525ae83 | 501 | #endif |