5 #include <linux/spinlock.h>
6 #include <linux/workqueue.h>
16 MLO_PAUSE_RX = BIT(0),
17 MLO_PAUSE_TX = BIT(1),
18 MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
19 MLO_PAUSE_AN = BIT(2),
21 MLO_AN_PHY = 0, /* Conventional PHY */
22 MLO_AN_FIXED, /* Fixed-link mode */
23 MLO_AN_INBAND, /* In-band protocol */
25 /* PCS "negotiation" mode.
26 * PHYLINK_PCS_NEG_NONE - protocol has no inband capability
27 * PHYLINK_PCS_NEG_OUTBAND - some out of band or fixed link setting
28 * PHYLINK_PCS_NEG_INBAND_DISABLED - inband mode disabled, e.g.
29 * 1000base-X with autoneg off
30 * PHYLINK_PCS_NEG_INBAND_ENABLED - inband mode enabled
31 * Additionally, this can be tested using bitmasks:
32 * PHYLINK_PCS_NEG_INBAND - inband mode selected
33 * PHYLINK_PCS_NEG_ENABLED - negotiation mode enabled
35 PHYLINK_PCS_NEG_NONE = 0,
36 PHYLINK_PCS_NEG_ENABLED = BIT(4),
37 PHYLINK_PCS_NEG_OUTBAND = BIT(5),
38 PHYLINK_PCS_NEG_INBAND = BIT(6),
39 PHYLINK_PCS_NEG_INBAND_DISABLED = PHYLINK_PCS_NEG_INBAND,
40 PHYLINK_PCS_NEG_INBAND_ENABLED = PHYLINK_PCS_NEG_INBAND |
41 PHYLINK_PCS_NEG_ENABLED,
43 /* MAC_SYM_PAUSE and MAC_ASYM_PAUSE are used when configuring our
44 * autonegotiation advertisement. They correspond to the PAUSE and
45 * ASM_DIR bits defined by 802.3, respectively.
47 * The following table lists the values of tx_pause and rx_pause which
48 * might be requested in mac_link_up. The exact values depend on either
49 * the results of autonegotation (if MLO_PAUSE_AN is set) or user
50 * configuration (if MLO_PAUSE_AN is not set).
52 * MAC_SYM_PAUSE MAC_ASYM_PAUSE MLO_PAUSE_AN tx_pause/rx_pause
53 * ============= ============== ============ ==================
56 * 0 1 0 0/0, 0/1, 1/0, 1/1
60 * 1 1 0 0/0, 0/1, 1/0, 1/1
63 * If you set MAC_ASYM_PAUSE, the user may request any combination of
64 * tx_pause and rx_pause. You do not have to support these
67 * However, you should support combinations of tx_pause and rx_pause
68 * which might be the result of autonegotation. For example, don't set
69 * MAC_SYM_PAUSE unless your device can support tx_pause and rx_pause
72 MAC_SYM_PAUSE = BIT(0),
73 MAC_ASYM_PAUSE = BIT(1),
76 MAC_10 = MAC_10HD | MAC_10FD,
79 MAC_100 = MAC_100HD | MAC_100FD,
82 MAC_1000 = MAC_1000HD | MAC_1000FD,
85 MAC_10000FD = BIT(10),
86 MAC_20000FD = BIT(11),
87 MAC_25000FD = BIT(12),
88 MAC_40000FD = BIT(13),
89 MAC_50000FD = BIT(14),
90 MAC_56000FD = BIT(15),
91 MAC_100000FD = BIT(16),
92 MAC_200000FD = BIT(17),
93 MAC_400000FD = BIT(18),
96 static inline bool phylink_autoneg_inband(unsigned int mode)
98 return mode == MLO_AN_INBAND;
102 * struct phylink_link_state - link state structure
103 * @advertising: ethtool bitmask containing advertised link modes
104 * @lp_advertising: ethtool bitmask containing link partner advertised link
106 * @interface: link &typedef phy_interface_t mode
107 * @speed: link speed, one of the SPEED_* constants.
108 * @duplex: link duplex mode, one of DUPLEX_* constants.
109 * @pause: link pause state, described by MLO_PAUSE_* constants.
110 * @rate_matching: rate matching being performed, one of the RATE_MATCH_*
111 * constants. If rate matching is taking place, then the speed/duplex of
112 * the medium link mode (@speed and @duplex) and the speed/duplex of the phy
113 * interface mode (@interface) are different.
114 * @link: true if the link is up.
115 * @an_complete: true if autonegotiation has completed.
117 struct phylink_link_state {
118 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
119 __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
120 phy_interface_t interface;
126 unsigned int an_complete:1;
129 enum phylink_op_type {
135 * struct phylink_config - PHYLINK configuration structure
136 * @dev: a pointer to a struct device associated with the MAC
137 * @type: operation type of PHYLINK instance
138 * @poll_fixed_state: if true, starts link_poll,
139 * if MAC link is at %MLO_AN_FIXED mode.
140 * @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
141 * @mac_requires_rxc: if true, the MAC always requires a receive clock from PHY.
142 * The PHY driver should start the clock signal as soon as
143 * possible and avoid stopping it during suspend events.
144 * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
145 * @get_fixed_state: callback to execute to determine the fixed link state,
146 * if MAC link is at %MLO_AN_FIXED mode.
147 * @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
148 * are supported by the MAC/PCS.
149 * @mac_capabilities: MAC pause/speed/duplex capabilities.
151 struct phylink_config {
153 enum phylink_op_type type;
154 bool poll_fixed_state;
156 bool mac_requires_rxc;
158 void (*get_fixed_state)(struct phylink_config *config,
159 struct phylink_link_state *state);
160 DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
161 unsigned long mac_capabilities;
164 void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed);
167 * struct phylink_mac_ops - MAC operations structure.
168 * @mac_get_caps: Get MAC capabilities for interface mode.
169 * @mac_select_pcs: Select a PCS for the interface mode.
170 * @mac_prepare: prepare for a major reconfiguration of the interface.
171 * @mac_config: configure the MAC for the selected mode and state.
172 * @mac_finish: finish a major reconfiguration of the interface.
173 * @mac_link_down: take the link down.
174 * @mac_link_up: allow the link to come up.
176 * The individual methods are described more fully below.
178 struct phylink_mac_ops {
179 unsigned long (*mac_get_caps)(struct phylink_config *config,
180 phy_interface_t interface);
181 struct phylink_pcs *(*mac_select_pcs)(struct phylink_config *config,
182 phy_interface_t interface);
183 int (*mac_prepare)(struct phylink_config *config, unsigned int mode,
184 phy_interface_t iface);
185 void (*mac_config)(struct phylink_config *config, unsigned int mode,
186 const struct phylink_link_state *state);
187 int (*mac_finish)(struct phylink_config *config, unsigned int mode,
188 phy_interface_t iface);
189 void (*mac_link_down)(struct phylink_config *config, unsigned int mode,
190 phy_interface_t interface);
191 void (*mac_link_up)(struct phylink_config *config,
192 struct phy_device *phy, unsigned int mode,
193 phy_interface_t interface, int speed, int duplex,
194 bool tx_pause, bool rx_pause);
197 #if 0 /* For kernel-doc purposes only. */
199 * mac_get_caps: Get MAC capabilities for interface mode.
200 * @config: a pointer to a &struct phylink_config.
201 * @interface: PHY interface mode.
203 * Optional method. When not provided, config->mac_capabilities will be used.
204 * When implemented, this returns the MAC capabilities for the specified
205 * interface mode where there is some special handling required by the MAC
206 * driver (e.g. not supporting half-duplex in certain interface modes.)
208 unsigned long mac_get_caps(struct phylink_config *config,
209 phy_interface_t interface);
211 * mac_select_pcs: Select a PCS for the interface mode.
212 * @config: a pointer to a &struct phylink_config.
213 * @interface: PHY interface mode for PCS
215 * Return the &struct phylink_pcs for the specified interface mode, or
216 * NULL if none is required, or an error pointer on error.
218 * This must not modify any state. It is used to query which PCS should
219 * be used. Phylink will use this during validation to ensure that the
220 * configuration is valid, and when setting a configuration to internally
221 * set the PCS that will be used.
223 struct phylink_pcs *mac_select_pcs(struct phylink_config *config,
224 phy_interface_t interface);
227 * mac_prepare() - prepare to change the PHY interface mode
228 * @config: a pointer to a &struct phylink_config.
229 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
230 * @iface: interface mode to switch to
232 * phylink will call this method at the beginning of a full initialisation
233 * of the link, which includes changing the interface mode or at initial
234 * startup time. It may be called for the current mode. The MAC driver
235 * should perform whatever actions are required, e.g. disabling the
238 * This will be the first call in the sequence:
242 * - possible pcs_an_restart()
245 * Returns zero on success, or negative errno on failure which will be
246 * reported to the kernel log.
248 int mac_prepare(struct phylink_config *config, unsigned int mode,
249 phy_interface_t iface);
252 * mac_config() - configure the MAC for the selected mode and state
253 * @config: a pointer to a &struct phylink_config.
254 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
255 * @state: a pointer to a &struct phylink_link_state.
257 * Note - not all members of @state are valid. In particular,
258 * @state->lp_advertising, @state->link, @state->an_complete are never
259 * guaranteed to be correct, and so any mac_config() implementation must
260 * never reference these fields.
262 * This will only be called to reconfigure the MAC for a "major" change in
263 * e.g. interface mode. It will not be called for changes in speed, duplex
264 * or pause modes or to change the in-band advertisement.
266 * In all negotiation modes, as defined by @mode, @state->pause indicates the
267 * pause settings which should be applied as follows. If %MLO_PAUSE_AN is not
268 * set, %MLO_PAUSE_TX and %MLO_PAUSE_RX indicate whether the MAC should send
269 * pause frames and/or act on received pause frames respectively. Otherwise,
270 * the results of in-band negotiation/status from the MAC PCS should be used
271 * to control the MAC pause mode settings.
273 * The action performed depends on the currently selected mode:
275 * %MLO_AN_FIXED, %MLO_AN_PHY:
276 * Configure for non-inband negotiation mode, where the link settings
277 * are completely communicated via mac_link_up(). The physical link
278 * protocol from the MAC is specified by @state->interface.
280 * @state->advertising may be used, but is not required.
282 * Older drivers (prior to the mac_link_up() change) may use @state->speed,
283 * @state->duplex and @state->pause to configure the MAC, but this is
284 * deprecated; such drivers should be converted to use mac_link_up().
286 * Other members of @state must be ignored.
288 * Valid state members: interface, advertising.
289 * Deprecated state members: speed, duplex, pause.
292 * place the link in an inband negotiation mode (such as 802.3z
293 * 1000base-X or Cisco SGMII mode depending on the @state->interface
294 * mode). In both cases, link state management (whether the link
295 * is up or not) is performed by the MAC, and reported via the
296 * pcs_get_state() callback. Changes in link state must be made
297 * by calling phylink_mac_change().
299 * Interface mode specific details are mentioned below.
301 * If in 802.3z mode, the link speed is fixed, dependent on the
302 * @state->interface. Duplex and pause modes are negotiated via
303 * the in-band configuration word. Advertised pause modes are set
304 * according to the @state->an_enabled and @state->advertising
305 * flags. Beware of MACs which only support full duplex at gigabit
308 * If in Cisco SGMII mode, the link speed and duplex mode are passed
309 * in the serial bitstream 16-bit configuration word, and the MAC
310 * should be configured to read these bits and acknowledge the
311 * configuration word. Nothing is advertised by the MAC. The MAC is
312 * responsible for reading the configuration word and configuring
313 * itself accordingly.
315 * Valid state members: interface, an_enabled, pause, advertising.
317 * Implementations are expected to update the MAC to reflect the
318 * requested settings - i.o.w., if nothing has changed between two
319 * calls, no action is expected. If only flow control settings have
320 * changed, flow control should be updated *without* taking the link
321 * down. This "update" behaviour is critical to avoid bouncing the
324 void mac_config(struct phylink_config *config, unsigned int mode,
325 const struct phylink_link_state *state);
328 * mac_finish() - finish a to change the PHY interface mode
329 * @config: a pointer to a &struct phylink_config.
330 * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
331 * @iface: interface mode to switch to
333 * phylink will call this if it called mac_prepare() to allow the MAC to
334 * complete any necessary steps after the MAC and PCS have been configured
335 * for the @mode and @iface. E.g. a MAC driver may wish to re-enable the
336 * Serdes PHY here if it was previously disabled by mac_prepare().
338 * Returns zero on success, or negative errno on failure which will be
339 * reported to the kernel log.
341 int mac_finish(struct phylink_config *config, unsigned int mode,
342 phy_interface_t iface);
345 * mac_link_down() - take the link down
346 * @config: a pointer to a &struct phylink_config.
347 * @mode: link autonegotiation mode
348 * @interface: link &typedef phy_interface_t mode
350 * If @mode is not an in-band negotiation mode (as defined by
351 * phylink_autoneg_inband()), force the link down and disable any
352 * Energy Efficient Ethernet MAC configuration. Interface type
353 * selection must be done in mac_config().
355 void mac_link_down(struct phylink_config *config, unsigned int mode,
356 phy_interface_t interface);
359 * mac_link_up() - allow the link to come up
360 * @config: a pointer to a &struct phylink_config.
361 * @phy: any attached phy
362 * @mode: link autonegotiation mode
363 * @interface: link &typedef phy_interface_t mode
365 * @duplex: link duplex
366 * @tx_pause: link transmit pause enablement status
367 * @rx_pause: link receive pause enablement status
369 * Configure the MAC for an established link.
371 * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link
372 * settings, and should be used to configure the MAC block appropriately
373 * where these settings are not automatically conveyed from the PCS block,
374 * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode))
377 * Note that when 802.3z in-band negotiation is in use, it is possible
378 * that the user wishes to override the pause settings, and this should
379 * be allowed when considering the implementation of this method.
381 * If in-band negotiation mode is disabled, allow the link to come up. If
382 * @phy is non-%NULL, configure Energy Efficient Ethernet by calling
383 * phy_init_eee() and perform appropriate MAC configuration for EEE.
384 * Interface type selection must be done in mac_config().
386 void mac_link_up(struct phylink_config *config, struct phy_device *phy,
387 unsigned int mode, phy_interface_t interface,
388 int speed, int duplex, bool tx_pause, bool rx_pause);
391 struct phylink_pcs_ops;
394 * struct phylink_pcs - PHYLINK PCS instance
395 * @ops: a pointer to the &struct phylink_pcs_ops structure
396 * @phylink: pointer to &struct phylink_config
397 * @neg_mode: provide PCS neg mode via "mode" argument
398 * @poll: poll the PCS for link changes
399 * @rxc_always_on: The MAC driver requires the reference clock
400 * to always be on. Standalone PCS drivers which
401 * do not have access to a PHY device can check
402 * this instead of PHY_F_RXC_ALWAYS_ON.
404 * This structure is designed to be embedded within the PCS private data,
405 * and will be passed between phylink and the PCS.
407 * The @phylink member is private to phylink and must not be touched by
411 const struct phylink_pcs_ops *ops;
412 struct phylink *phylink;
419 * struct phylink_pcs_ops - MAC PCS operations structure.
420 * @pcs_validate: validate the link configuration.
421 * @pcs_enable: enable the PCS.
422 * @pcs_disable: disable the PCS.
423 * @pcs_pre_config: pre-mac_config method (for errata)
424 * @pcs_post_config: post-mac_config method (for arrata)
425 * @pcs_get_state: read the current MAC PCS link state from the hardware.
426 * @pcs_config: configure the MAC PCS for the selected mode and state.
427 * @pcs_an_restart: restart 802.3z BaseX autonegotiation.
428 * @pcs_link_up: program the PCS for the resolved link configuration
430 * @pcs_pre_init: configure PCS components necessary for MAC hardware
431 * initialization e.g. RX clock for stmmac.
433 struct phylink_pcs_ops {
434 int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported,
435 const struct phylink_link_state *state);
436 int (*pcs_enable)(struct phylink_pcs *pcs);
437 void (*pcs_disable)(struct phylink_pcs *pcs);
438 void (*pcs_pre_config)(struct phylink_pcs *pcs,
439 phy_interface_t interface);
440 int (*pcs_post_config)(struct phylink_pcs *pcs,
441 phy_interface_t interface);
442 void (*pcs_get_state)(struct phylink_pcs *pcs,
443 struct phylink_link_state *state);
444 int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,
445 phy_interface_t interface,
446 const unsigned long *advertising,
447 bool permit_pause_to_mac);
448 void (*pcs_an_restart)(struct phylink_pcs *pcs);
449 void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode,
450 phy_interface_t interface, int speed, int duplex);
451 int (*pcs_pre_init)(struct phylink_pcs *pcs);
454 #if 0 /* For kernel-doc purposes only. */
456 * pcs_validate() - validate the link configuration.
457 * @pcs: a pointer to a &struct phylink_pcs.
458 * @supported: ethtool bitmask for supported link modes.
459 * @state: a const pointer to a &struct phylink_link_state.
461 * Validate the interface mode, and advertising's autoneg bit, removing any
462 * media ethtool link modes that would not be supportable from the supported
463 * mask. Phylink will propagate the changes to the advertising mask. See the
464 * &struct phylink_mac_ops validate() method.
466 * Returns -EINVAL if the interface mode/autoneg mode is not supported.
467 * Returns non-zero positive if the link state can be supported.
469 int pcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
470 const struct phylink_link_state *state);
473 * pcs_enable() - enable the PCS.
474 * @pcs: a pointer to a &struct phylink_pcs.
476 int pcs_enable(struct phylink_pcs *pcs);
479 * pcs_disable() - disable the PCS.
480 * @pcs: a pointer to a &struct phylink_pcs.
482 void pcs_disable(struct phylink_pcs *pcs);
485 * pcs_get_state() - Read the current inband link state from the hardware
486 * @pcs: a pointer to a &struct phylink_pcs.
487 * @state: a pointer to a &struct phylink_link_state.
489 * Read the current inband link state from the MAC PCS, reporting the
490 * current speed in @state->speed, duplex mode in @state->duplex, pause
491 * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
492 * negotiation completion state in @state->an_complete, and link up state
493 * in @state->link. If possible, @state->lp_advertising should also be
496 void pcs_get_state(struct phylink_pcs *pcs,
497 struct phylink_link_state *state);
500 * pcs_config() - Configure the PCS mode and advertisement
501 * @pcs: a pointer to a &struct phylink_pcs.
502 * @neg_mode: link negotiation mode (see below)
503 * @interface: interface mode to be used
504 * @advertising: adertisement ethtool link mode mask
505 * @permit_pause_to_mac: permit forwarding pause resolution to MAC
507 * Configure the PCS for the operating mode, the interface mode, and set
508 * the advertisement mask. @permit_pause_to_mac indicates whether the
509 * hardware may forward the pause mode resolution to the MAC.
511 * When operating in %MLO_AN_INBAND, inband should always be enabled,
512 * otherwise inband should be disabled.
514 * For SGMII, there is no advertisement from the MAC side, the PCS should
515 * be programmed to acknowledge the inband word from the PHY.
517 * For 1000BASE-X, the advertisement should be programmed into the PCS.
519 * For most 10GBASE-R, there is no advertisement.
521 * The %neg_mode argument should be tested via the phylink_mode_*() family of
522 * functions, or for PCS that set pcs->neg_mode true, should be tested
523 * against the PHYLINK_PCS_NEG_* definitions.
525 int pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
526 phy_interface_t interface, const unsigned long *advertising,
527 bool permit_pause_to_mac);
530 * pcs_an_restart() - restart 802.3z BaseX autonegotiation
531 * @pcs: a pointer to a &struct phylink_pcs.
533 * When PCS ops are present, this overrides mac_an_restart() in &struct
536 void pcs_an_restart(struct phylink_pcs *pcs);
539 * pcs_link_up() - program the PCS for the resolved link configuration
540 * @pcs: a pointer to a &struct phylink_pcs.
541 * @neg_mode: link negotiation mode (see below)
542 * @interface: link &typedef phy_interface_t mode
544 * @duplex: link duplex
546 * This call will be made just before mac_link_up() to inform the PCS of
547 * the resolved link parameters. For example, a PCS operating in SGMII
548 * mode without in-band AN needs to be manually configured for the link
549 * and duplex setting. Otherwise, this should be a no-op.
551 * The %mode argument should be tested via the phylink_mode_*() family of
552 * functions, or for PCS that set pcs->neg_mode true, should be tested
553 * against the PHYLINK_PCS_NEG_* definitions.
555 void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
556 phy_interface_t interface, int speed, int duplex);
559 * pcs_pre_init() - Configure PCS components necessary for MAC initialization
560 * @pcs: a pointer to a &struct phylink_pcs.
562 * This function can be called by MAC drivers through the
563 * phylink_pcs_pre_init() wrapper, before their hardware is initialized. It
564 * should not be called after the link is brought up, as reconfiguring the PCS
565 * at this point could break the link.
567 * Some MAC devices require specific hardware initialization to be performed by
568 * their associated PCS device before they can properly initialize their own
569 * hardware. An example of this is the initialization of stmmac controllers,
570 * which requires an active REF_CLK signal to be provided by the PHY/PCS.
572 * By calling phylink_pcs_pre_init(), MAC drivers can ensure that the PCS is
573 * setup in a way that allows for successful hardware initialization.
575 * The specific configuration performed by pcs_pre_init() is dependent on the
576 * model of PCS and the requirements of the MAC device attached to it. PCS
577 * driver authors should consider whether their target device is to be used in
578 * conjunction with a MAC device whose driver calls phylink_pcs_pre_init(). MAC
579 * driver authors should document their requirements for the PCS
580 * pre-initialization.
583 int pcs_pre_init(struct phylink_pcs *pcs);
587 struct phylink *phylink_create(struct phylink_config *,
588 const struct fwnode_handle *,
590 const struct phylink_mac_ops *);
591 void phylink_destroy(struct phylink *);
592 bool phylink_expects_phy(struct phylink *pl);
594 int phylink_connect_phy(struct phylink *, struct phy_device *);
595 int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
596 int phylink_fwnode_phy_connect(struct phylink *pl,
597 const struct fwnode_handle *fwnode,
599 void phylink_disconnect_phy(struct phylink *);
601 void phylink_mac_change(struct phylink *, bool up);
602 void phylink_pcs_change(struct phylink_pcs *, bool up);
604 int phylink_pcs_pre_init(struct phylink *pl, struct phylink_pcs *pcs);
606 void phylink_start(struct phylink *);
607 void phylink_stop(struct phylink *);
609 void phylink_suspend(struct phylink *pl, bool mac_wol);
610 void phylink_resume(struct phylink *pl);
612 void phylink_ethtool_get_wol(struct phylink *, struct ethtool_wolinfo *);
613 int phylink_ethtool_set_wol(struct phylink *, struct ethtool_wolinfo *);
615 int phylink_ethtool_ksettings_get(struct phylink *,
616 struct ethtool_link_ksettings *);
617 int phylink_ethtool_ksettings_set(struct phylink *,
618 const struct ethtool_link_ksettings *);
619 int phylink_ethtool_nway_reset(struct phylink *);
620 void phylink_ethtool_get_pauseparam(struct phylink *,
621 struct ethtool_pauseparam *);
622 int phylink_ethtool_set_pauseparam(struct phylink *,
623 struct ethtool_pauseparam *);
624 int phylink_get_eee_err(struct phylink *);
625 int phylink_init_eee(struct phylink *, bool);
626 int phylink_ethtool_get_eee(struct phylink *link, struct ethtool_keee *eee);
627 int phylink_ethtool_set_eee(struct phylink *link, struct ethtool_keee *eee);
628 int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
629 int phylink_speed_down(struct phylink *pl, bool sync);
630 int phylink_speed_up(struct phylink *pl);
632 #define phylink_zero(bm) \
633 bitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS)
634 #define __phylink_do_bit(op, bm, mode) \
635 op(ETHTOOL_LINK_MODE_ ## mode ## _BIT, bm)
637 #define phylink_set(bm, mode) __phylink_do_bit(__set_bit, bm, mode)
638 #define phylink_clear(bm, mode) __phylink_do_bit(__clear_bit, bm, mode)
639 #define phylink_test(bm, mode) __phylink_do_bit(test_bit, bm, mode)
641 void phylink_set_port_modes(unsigned long *bits);
644 * phylink_get_link_timer_ns - return the PCS link timer value
645 * @interface: link &typedef phy_interface_t mode
647 * Return the PCS link timer setting in nanoseconds for the PHY @interface
648 * mode, or -EINVAL if not appropriate.
650 static inline int phylink_get_link_timer_ns(phy_interface_t interface)
653 case PHY_INTERFACE_MODE_SGMII:
654 case PHY_INTERFACE_MODE_QSGMII:
655 case PHY_INTERFACE_MODE_USXGMII:
658 case PHY_INTERFACE_MODE_1000BASEX:
659 case PHY_INTERFACE_MODE_2500BASEX:
667 void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
669 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
670 struct phylink_link_state *state);
671 int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface,
672 const unsigned long *advertising);
673 int phylink_mii_c22_pcs_config(struct mdio_device *pcs,
674 phy_interface_t interface,
675 const unsigned long *advertising,
676 unsigned int neg_mode);
677 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
679 void phylink_resolve_c73(struct phylink_link_state *state);
681 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
682 struct phylink_link_state *state);
684 void phylink_decode_usxgmii_word(struct phylink_link_state *state,