Back to home page

OSCL-LXR

 
 

    


0001 #ifndef NETDEV_PCS_H
0002 #define NETDEV_PCS_H
0003 
0004 #include <linux/phy.h>
0005 #include <linux/spinlock.h>
0006 #include <linux/workqueue.h>
0007 
0008 struct device_node;
0009 struct ethtool_cmd;
0010 struct fwnode_handle;
0011 struct net_device;
0012 
0013 enum {
0014     MLO_PAUSE_NONE,
0015     MLO_PAUSE_RX = BIT(0),
0016     MLO_PAUSE_TX = BIT(1),
0017     MLO_PAUSE_TXRX_MASK = MLO_PAUSE_TX | MLO_PAUSE_RX,
0018     MLO_PAUSE_AN = BIT(2),
0019 
0020     MLO_AN_PHY = 0, /* Conventional PHY */
0021     MLO_AN_FIXED,   /* Fixed-link mode */
0022     MLO_AN_INBAND,  /* In-band protocol */
0023 
0024     MAC_SYM_PAUSE   = BIT(0),
0025     MAC_ASYM_PAUSE  = BIT(1),
0026     MAC_10HD    = BIT(2),
0027     MAC_10FD    = BIT(3),
0028     MAC_10      = MAC_10HD | MAC_10FD,
0029     MAC_100HD   = BIT(4),
0030     MAC_100FD   = BIT(5),
0031     MAC_100     = MAC_100HD | MAC_100FD,
0032     MAC_1000HD  = BIT(6),
0033     MAC_1000FD  = BIT(7),
0034     MAC_1000    = MAC_1000HD | MAC_1000FD,
0035     MAC_2500FD  = BIT(8),
0036     MAC_5000FD  = BIT(9),
0037     MAC_10000FD = BIT(10),
0038     MAC_20000FD = BIT(11),
0039     MAC_25000FD = BIT(12),
0040     MAC_40000FD = BIT(13),
0041     MAC_50000FD = BIT(14),
0042     MAC_56000FD = BIT(15),
0043     MAC_100000FD    = BIT(16),
0044     MAC_200000FD    = BIT(17),
0045     MAC_400000FD    = BIT(18),
0046 };
0047 
0048 static inline bool phylink_autoneg_inband(unsigned int mode)
0049 {
0050     return mode == MLO_AN_INBAND;
0051 }
0052 
0053 /**
0054  * struct phylink_link_state - link state structure
0055  * @advertising: ethtool bitmask containing advertised link modes
0056  * @lp_advertising: ethtool bitmask containing link partner advertised link
0057  *   modes
0058  * @interface: link &typedef phy_interface_t mode
0059  * @speed: link speed, one of the SPEED_* constants.
0060  * @duplex: link duplex mode, one of DUPLEX_* constants.
0061  * @pause: link pause state, described by MLO_PAUSE_* constants.
0062  * @link: true if the link is up.
0063  * @an_enabled: true if autonegotiation is enabled/desired.
0064  * @an_complete: true if autonegotiation has completed.
0065  */
0066 struct phylink_link_state {
0067     __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
0068     __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
0069     phy_interface_t interface;
0070     int speed;
0071     int duplex;
0072     int pause;
0073     unsigned int link:1;
0074     unsigned int an_enabled:1;
0075     unsigned int an_complete:1;
0076 };
0077 
0078 enum phylink_op_type {
0079     PHYLINK_NETDEV = 0,
0080     PHYLINK_DEV,
0081 };
0082 
0083 /**
0084  * struct phylink_config - PHYLINK configuration structure
0085  * @dev: a pointer to a struct device associated with the MAC
0086  * @type: operation type of PHYLINK instance
0087  * @legacy_pre_march2020: driver has not been updated for March 2020 updates
0088  *  (See commit 7cceb599d15d ("net: phylink: avoid mac_config calls")
0089  * @poll_fixed_state: if true, starts link_poll,
0090  *            if MAC link is at %MLO_AN_FIXED mode.
0091  * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
0092  * @get_fixed_state: callback to execute to determine the fixed link state,
0093  *           if MAC link is at %MLO_AN_FIXED mode.
0094  * @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
0095  *                        are supported by the MAC/PCS.
0096  * @mac_capabilities: MAC pause/speed/duplex capabilities.
0097  */
0098 struct phylink_config {
0099     struct device *dev;
0100     enum phylink_op_type type;
0101     bool legacy_pre_march2020;
0102     bool poll_fixed_state;
0103     bool ovr_an_inband;
0104     void (*get_fixed_state)(struct phylink_config *config,
0105                 struct phylink_link_state *state);
0106     DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
0107     unsigned long mac_capabilities;
0108 };
0109 
0110 /**
0111  * struct phylink_mac_ops - MAC operations structure.
0112  * @validate: Validate and update the link configuration.
0113  * @mac_select_pcs: Select a PCS for the interface mode.
0114  * @mac_pcs_get_state: Read the current link state from the hardware.
0115  * @mac_prepare: prepare for a major reconfiguration of the interface.
0116  * @mac_config: configure the MAC for the selected mode and state.
0117  * @mac_finish: finish a major reconfiguration of the interface.
0118  * @mac_an_restart: restart 802.3z BaseX autonegotiation.
0119  * @mac_link_down: take the link down.
0120  * @mac_link_up: allow the link to come up.
0121  *
0122  * The individual methods are described more fully below.
0123  */
0124 struct phylink_mac_ops {
0125     void (*validate)(struct phylink_config *config,
0126              unsigned long *supported,
0127              struct phylink_link_state *state);
0128     struct phylink_pcs *(*mac_select_pcs)(struct phylink_config *config,
0129                           phy_interface_t interface);
0130     void (*mac_pcs_get_state)(struct phylink_config *config,
0131                   struct phylink_link_state *state);
0132     int (*mac_prepare)(struct phylink_config *config, unsigned int mode,
0133                phy_interface_t iface);
0134     void (*mac_config)(struct phylink_config *config, unsigned int mode,
0135                const struct phylink_link_state *state);
0136     int (*mac_finish)(struct phylink_config *config, unsigned int mode,
0137               phy_interface_t iface);
0138     void (*mac_an_restart)(struct phylink_config *config);
0139     void (*mac_link_down)(struct phylink_config *config, unsigned int mode,
0140                   phy_interface_t interface);
0141     void (*mac_link_up)(struct phylink_config *config,
0142                 struct phy_device *phy, unsigned int mode,
0143                 phy_interface_t interface, int speed, int duplex,
0144                 bool tx_pause, bool rx_pause);
0145 };
0146 
0147 #if 0 /* For kernel-doc purposes only. */
0148 /**
0149  * validate - Validate and update the link configuration
0150  * @config: a pointer to a &struct phylink_config.
0151  * @supported: ethtool bitmask for supported link modes.
0152  * @state: a pointer to a &struct phylink_link_state.
0153  *
0154  * Clear bits in the @supported and @state->advertising masks that
0155  * are not supportable by the MAC.
0156  *
0157  * Note that the PHY may be able to transform from one connection
0158  * technology to another, so, eg, don't clear 1000BaseX just
0159  * because the MAC is unable to BaseX mode. This is more about
0160  * clearing unsupported speeds and duplex settings. The port modes
0161  * should not be cleared; phylink_set_port_modes() will help with this.
0162  *
0163  * When @config->supported_interfaces has been set, phylink will iterate
0164  * over the supported interfaces to determine the full capability of the
0165  * MAC. The validation function must not print errors if @state->interface
0166  * is set to an unexpected value.
0167  *
0168  * When @config->supported_interfaces is empty, phylink will call this
0169  * function with @state->interface set to %PHY_INTERFACE_MODE_NA, and
0170  * expects the MAC driver to return all supported link modes.
0171  *
0172  * If the @state->interface mode is not supported, then the @supported
0173  * mask must be cleared.
0174  */
0175 void validate(struct phylink_config *config, unsigned long *supported,
0176           struct phylink_link_state *state);
0177 /**
0178  * mac_select_pcs: Select a PCS for the interface mode.
0179  * @config: a pointer to a &struct phylink_config.
0180  * @interface: PHY interface mode for PCS
0181  *
0182  * Return the &struct phylink_pcs for the specified interface mode, or
0183  * NULL if none is required, or an error pointer on error.
0184  *
0185  * This must not modify any state. It is used to query which PCS should
0186  * be used. Phylink will use this during validation to ensure that the
0187  * configuration is valid, and when setting a configuration to internally
0188  * set the PCS that will be used.
0189  */
0190 struct phylink_pcs *mac_select_pcs(struct phylink_config *config,
0191                    phy_interface_t interface);
0192 
0193 /**
0194  * mac_pcs_get_state() - Read the current inband link state from the hardware
0195  * @config: a pointer to a &struct phylink_config.
0196  * @state: a pointer to a &struct phylink_link_state.
0197  *
0198  * Read the current inband link state from the MAC PCS, reporting the
0199  * current speed in @state->speed, duplex mode in @state->duplex, pause
0200  * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
0201  * negotiation completion state in @state->an_complete, and link up state
0202  * in @state->link. If possible, @state->lp_advertising should also be
0203  * populated.
0204  *
0205  * Note: This is a legacy method. This function will not be called unless
0206  * legacy_pre_march2020 is set in &struct phylink_config and there is no
0207  * PCS attached.
0208  */
0209 void mac_pcs_get_state(struct phylink_config *config,
0210                struct phylink_link_state *state);
0211 
0212 /**
0213  * mac_prepare() - prepare to change the PHY interface mode
0214  * @config: a pointer to a &struct phylink_config.
0215  * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
0216  * @iface: interface mode to switch to
0217  *
0218  * phylink will call this method at the beginning of a full initialisation
0219  * of the link, which includes changing the interface mode or at initial
0220  * startup time. It may be called for the current mode. The MAC driver
0221  * should perform whatever actions are required, e.g. disabling the
0222  * Serdes PHY.
0223  *
0224  * This will be the first call in the sequence:
0225  * - mac_prepare()
0226  * - mac_config()
0227  * - pcs_config()
0228  * - possible pcs_an_restart()
0229  * - mac_finish()
0230  *
0231  * Returns zero on success, or negative errno on failure which will be
0232  * reported to the kernel log.
0233  */
0234 int mac_prepare(struct phylink_config *config, unsigned int mode,
0235         phy_interface_t iface);
0236 
0237 /**
0238  * mac_config() - configure the MAC for the selected mode and state
0239  * @config: a pointer to a &struct phylink_config.
0240  * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
0241  * @state: a pointer to a &struct phylink_link_state.
0242  *
0243  * Note - not all members of @state are valid.  In particular,
0244  * @state->lp_advertising, @state->link, @state->an_complete are never
0245  * guaranteed to be correct, and so any mac_config() implementation must
0246  * never reference these fields.
0247  *
0248  * Note: For legacy March 2020 drivers (drivers with legacy_pre_march2020 set
0249  * in their &phylnk_config and which don't have a PCS), this function will be
0250  * called on each link up event, and to also change the in-band advert. For
0251  * non-legacy drivers, it will only be called to reconfigure the MAC for a
0252  * "major" change in e.g. interface mode. It will not be called for changes
0253  * in speed, duplex or pause modes or to change the in-band advertisement.
0254  * In any case, it is strongly preferred that speed, duplex and pause settings
0255  * are handled in the mac_link_up() method and not in this method.
0256  *
0257  * (this requires a rewrite - please refer to mac_link_up() for situations
0258  *  where the PCS and MAC are not tightly integrated.)
0259  *
0260  * In all negotiation modes, as defined by @mode, @state->pause indicates the
0261  * pause settings which should be applied as follows. If %MLO_PAUSE_AN is not
0262  * set, %MLO_PAUSE_TX and %MLO_PAUSE_RX indicate whether the MAC should send
0263  * pause frames and/or act on received pause frames respectively. Otherwise,
0264  * the results of in-band negotiation/status from the MAC PCS should be used
0265  * to control the MAC pause mode settings.
0266  *
0267  * The action performed depends on the currently selected mode:
0268  *
0269  * %MLO_AN_FIXED, %MLO_AN_PHY:
0270  *   Configure for non-inband negotiation mode, where the link settings
0271  *   are completely communicated via mac_link_up().  The physical link
0272  *   protocol from the MAC is specified by @state->interface.
0273  *
0274  *   @state->advertising may be used, but is not required.
0275  *
0276  *   Older drivers (prior to the mac_link_up() change) may use @state->speed,
0277  *   @state->duplex and @state->pause to configure the MAC, but this is
0278  *   deprecated; such drivers should be converted to use mac_link_up().
0279  *
0280  *   Other members of @state must be ignored.
0281  *
0282  *   Valid state members: interface, advertising.
0283  *   Deprecated state members: speed, duplex, pause.
0284  *
0285  * %MLO_AN_INBAND:
0286  *   place the link in an inband negotiation mode (such as 802.3z
0287  *   1000base-X or Cisco SGMII mode depending on the @state->interface
0288  *   mode). In both cases, link state management (whether the link
0289  *   is up or not) is performed by the MAC, and reported via the
0290  *   mac_pcs_get_state() callback. Changes in link state must be made
0291  *   by calling phylink_mac_change().
0292  *
0293  *   Interface mode specific details are mentioned below.
0294  *
0295  *   If in 802.3z mode, the link speed is fixed, dependent on the
0296  *   @state->interface. Duplex and pause modes are negotiated via
0297  *   the in-band configuration word. Advertised pause modes are set
0298  *   according to the @state->an_enabled and @state->advertising
0299  *   flags. Beware of MACs which only support full duplex at gigabit
0300  *   and higher speeds.
0301  *
0302  *   If in Cisco SGMII mode, the link speed and duplex mode are passed
0303  *   in the serial bitstream 16-bit configuration word, and the MAC
0304  *   should be configured to read these bits and acknowledge the
0305  *   configuration word. Nothing is advertised by the MAC. The MAC is
0306  *   responsible for reading the configuration word and configuring
0307  *   itself accordingly.
0308  *
0309  *   Valid state members: interface, an_enabled, pause, advertising.
0310  *
0311  * Implementations are expected to update the MAC to reflect the
0312  * requested settings - i.o.w., if nothing has changed between two
0313  * calls, no action is expected.  If only flow control settings have
0314  * changed, flow control should be updated *without* taking the link
0315  * down.  This "update" behaviour is critical to avoid bouncing the
0316  * link up status.
0317  */
0318 void mac_config(struct phylink_config *config, unsigned int mode,
0319         const struct phylink_link_state *state);
0320 
0321 /**
0322  * mac_finish() - finish a to change the PHY interface mode
0323  * @config: a pointer to a &struct phylink_config.
0324  * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
0325  * @iface: interface mode to switch to
0326  *
0327  * phylink will call this if it called mac_prepare() to allow the MAC to
0328  * complete any necessary steps after the MAC and PCS have been configured
0329  * for the @mode and @iface. E.g. a MAC driver may wish to re-enable the
0330  * Serdes PHY here if it was previously disabled by mac_prepare().
0331  *
0332  * Returns zero on success, or negative errno on failure which will be
0333  * reported to the kernel log.
0334  */
0335 int mac_finish(struct phylink_config *config, unsigned int mode,
0336         phy_interface_t iface);
0337 
0338 /**
0339  * mac_an_restart() - restart 802.3z BaseX autonegotiation
0340  * @config: a pointer to a &struct phylink_config.
0341  *
0342  * Note: This is a legacy method. This function will not be called unless
0343  * legacy_pre_march2020 is set in &struct phylink_config and there is no
0344  * PCS attached.
0345  */
0346 void mac_an_restart(struct phylink_config *config);
0347 
0348 /**
0349  * mac_link_down() - take the link down
0350  * @config: a pointer to a &struct phylink_config.
0351  * @mode: link autonegotiation mode
0352  * @interface: link &typedef phy_interface_t mode
0353  *
0354  * If @mode is not an in-band negotiation mode (as defined by
0355  * phylink_autoneg_inband()), force the link down and disable any
0356  * Energy Efficient Ethernet MAC configuration. Interface type
0357  * selection must be done in mac_config().
0358  */
0359 void mac_link_down(struct phylink_config *config, unsigned int mode,
0360            phy_interface_t interface);
0361 
0362 /**
0363  * mac_link_up() - allow the link to come up
0364  * @config: a pointer to a &struct phylink_config.
0365  * @phy: any attached phy
0366  * @mode: link autonegotiation mode
0367  * @interface: link &typedef phy_interface_t mode
0368  * @speed: link speed
0369  * @duplex: link duplex
0370  * @tx_pause: link transmit pause enablement status
0371  * @rx_pause: link receive pause enablement status
0372  *
0373  * Configure the MAC for an established link.
0374  *
0375  * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link
0376  * settings, and should be used to configure the MAC block appropriately
0377  * where these settings are not automatically conveyed from the PCS block,
0378  * or if in-band negotiation (as defined by phylink_autoneg_inband(@mode))
0379  * is disabled.
0380  *
0381  * Note that when 802.3z in-band negotiation is in use, it is possible
0382  * that the user wishes to override the pause settings, and this should
0383  * be allowed when considering the implementation of this method.
0384  *
0385  * If in-band negotiation mode is disabled, allow the link to come up. If
0386  * @phy is non-%NULL, configure Energy Efficient Ethernet by calling
0387  * phy_init_eee() and perform appropriate MAC configuration for EEE.
0388  * Interface type selection must be done in mac_config().
0389  */
0390 void mac_link_up(struct phylink_config *config, struct phy_device *phy,
0391          unsigned int mode, phy_interface_t interface,
0392          int speed, int duplex, bool tx_pause, bool rx_pause);
0393 #endif
0394 
0395 struct phylink_pcs_ops;
0396 
0397 /**
0398  * struct phylink_pcs - PHYLINK PCS instance
0399  * @ops: a pointer to the &struct phylink_pcs_ops structure
0400  * @poll: poll the PCS for link changes
0401  *
0402  * This structure is designed to be embedded within the PCS private data,
0403  * and will be passed between phylink and the PCS.
0404  */
0405 struct phylink_pcs {
0406     const struct phylink_pcs_ops *ops;
0407     bool poll;
0408 };
0409 
0410 /**
0411  * struct phylink_pcs_ops - MAC PCS operations structure.
0412  * @pcs_validate: validate the link configuration.
0413  * @pcs_get_state: read the current MAC PCS link state from the hardware.
0414  * @pcs_config: configure the MAC PCS for the selected mode and state.
0415  * @pcs_an_restart: restart 802.3z BaseX autonegotiation.
0416  * @pcs_link_up: program the PCS for the resolved link configuration
0417  *               (where necessary).
0418  */
0419 struct phylink_pcs_ops {
0420     int (*pcs_validate)(struct phylink_pcs *pcs, unsigned long *supported,
0421                 const struct phylink_link_state *state);
0422     void (*pcs_get_state)(struct phylink_pcs *pcs,
0423                   struct phylink_link_state *state);
0424     int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode,
0425               phy_interface_t interface,
0426               const unsigned long *advertising,
0427               bool permit_pause_to_mac);
0428     void (*pcs_an_restart)(struct phylink_pcs *pcs);
0429     void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int mode,
0430                 phy_interface_t interface, int speed, int duplex);
0431 };
0432 
0433 #if 0 /* For kernel-doc purposes only. */
0434 /**
0435  * pcs_validate() - validate the link configuration.
0436  * @pcs: a pointer to a &struct phylink_pcs.
0437  * @supported: ethtool bitmask for supported link modes.
0438  * @state: a const pointer to a &struct phylink_link_state.
0439  *
0440  * Validate the interface mode, and advertising's autoneg bit, removing any
0441  * media ethtool link modes that would not be supportable from the supported
0442  * mask. Phylink will propagate the changes to the advertising mask. See the
0443  * &struct phylink_mac_ops validate() method.
0444  *
0445  * Returns -EINVAL if the interface mode/autoneg mode is not supported.
0446  * Returns non-zero positive if the link state can be supported.
0447  */
0448 int pcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
0449          const struct phylink_link_state *state);
0450 
0451 /**
0452  * pcs_get_state() - Read the current inband link state from the hardware
0453  * @pcs: a pointer to a &struct phylink_pcs.
0454  * @state: a pointer to a &struct phylink_link_state.
0455  *
0456  * Read the current inband link state from the MAC PCS, reporting the
0457  * current speed in @state->speed, duplex mode in @state->duplex, pause
0458  * mode in @state->pause using the %MLO_PAUSE_RX and %MLO_PAUSE_TX bits,
0459  * negotiation completion state in @state->an_complete, and link up state
0460  * in @state->link. If possible, @state->lp_advertising should also be
0461  * populated.
0462  *
0463  * When present, this overrides mac_pcs_get_state() in &struct
0464  * phylink_mac_ops.
0465  */
0466 void pcs_get_state(struct phylink_pcs *pcs,
0467            struct phylink_link_state *state);
0468 
0469 /**
0470  * pcs_config() - Configure the PCS mode and advertisement
0471  * @pcs: a pointer to a &struct phylink_pcs.
0472  * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
0473  * @interface: interface mode to be used
0474  * @advertising: adertisement ethtool link mode mask
0475  * @permit_pause_to_mac: permit forwarding pause resolution to MAC
0476  *
0477  * Configure the PCS for the operating mode, the interface mode, and set
0478  * the advertisement mask. @permit_pause_to_mac indicates whether the
0479  * hardware may forward the pause mode resolution to the MAC.
0480  *
0481  * When operating in %MLO_AN_INBAND, inband should always be enabled,
0482  * otherwise inband should be disabled.
0483  *
0484  * For SGMII, there is no advertisement from the MAC side, the PCS should
0485  * be programmed to acknowledge the inband word from the PHY.
0486  *
0487  * For 1000BASE-X, the advertisement should be programmed into the PCS.
0488  *
0489  * For most 10GBASE-R, there is no advertisement.
0490  */
0491 int pcs_config(struct phylink_pcs *pcs, unsigned int mode,
0492            phy_interface_t interface, const unsigned long *advertising,
0493            bool permit_pause_to_mac);
0494 
0495 /**
0496  * pcs_an_restart() - restart 802.3z BaseX autonegotiation
0497  * @pcs: a pointer to a &struct phylink_pcs.
0498  *
0499  * When PCS ops are present, this overrides mac_an_restart() in &struct
0500  * phylink_mac_ops.
0501  */
0502 void pcs_an_restart(struct phylink_pcs *pcs);
0503 
0504 /**
0505  * pcs_link_up() - program the PCS for the resolved link configuration
0506  * @pcs: a pointer to a &struct phylink_pcs.
0507  * @mode: link autonegotiation mode
0508  * @interface: link &typedef phy_interface_t mode
0509  * @speed: link speed
0510  * @duplex: link duplex
0511  *
0512  * This call will be made just before mac_link_up() to inform the PCS of
0513  * the resolved link parameters. For example, a PCS operating in SGMII
0514  * mode without in-band AN needs to be manually configured for the link
0515  * and duplex setting. Otherwise, this should be a no-op.
0516  */
0517 void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
0518          phy_interface_t interface, int speed, int duplex);
0519 #endif
0520 
0521 void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface,
0522                unsigned long mac_capabilities);
0523 void phylink_generic_validate(struct phylink_config *config,
0524                   unsigned long *supported,
0525                   struct phylink_link_state *state);
0526 
0527 struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
0528                    phy_interface_t iface,
0529                    const struct phylink_mac_ops *mac_ops);
0530 void phylink_destroy(struct phylink *);
0531 
0532 int phylink_connect_phy(struct phylink *, struct phy_device *);
0533 int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
0534 int phylink_fwnode_phy_connect(struct phylink *pl,
0535                    struct fwnode_handle *fwnode,
0536                    u32 flags);
0537 void phylink_disconnect_phy(struct phylink *);
0538 
0539 void phylink_mac_change(struct phylink *, bool up);
0540 
0541 void phylink_start(struct phylink *);
0542 void phylink_stop(struct phylink *);
0543 
0544 void phylink_suspend(struct phylink *pl, bool mac_wol);
0545 void phylink_resume(struct phylink *pl);
0546 
0547 void phylink_ethtool_get_wol(struct phylink *, struct ethtool_wolinfo *);
0548 int phylink_ethtool_set_wol(struct phylink *, struct ethtool_wolinfo *);
0549 
0550 int phylink_ethtool_ksettings_get(struct phylink *,
0551                   struct ethtool_link_ksettings *);
0552 int phylink_ethtool_ksettings_set(struct phylink *,
0553                   const struct ethtool_link_ksettings *);
0554 int phylink_ethtool_nway_reset(struct phylink *);
0555 void phylink_ethtool_get_pauseparam(struct phylink *,
0556                     struct ethtool_pauseparam *);
0557 int phylink_ethtool_set_pauseparam(struct phylink *,
0558                    struct ethtool_pauseparam *);
0559 int phylink_get_eee_err(struct phylink *);
0560 int phylink_init_eee(struct phylink *, bool);
0561 int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
0562 int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
0563 int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
0564 int phylink_speed_down(struct phylink *pl, bool sync);
0565 int phylink_speed_up(struct phylink *pl);
0566 
0567 #define phylink_zero(bm) \
0568     bitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS)
0569 #define __phylink_do_bit(op, bm, mode) \
0570     op(ETHTOOL_LINK_MODE_ ## mode ## _BIT, bm)
0571 
0572 #define phylink_set(bm, mode)   __phylink_do_bit(__set_bit, bm, mode)
0573 #define phylink_clear(bm, mode) __phylink_do_bit(__clear_bit, bm, mode)
0574 #define phylink_test(bm, mode)  __phylink_do_bit(test_bit, bm, mode)
0575 
0576 void phylink_set_port_modes(unsigned long *bits);
0577 
0578 void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
0579                       u16 bmsr, u16 lpa);
0580 void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
0581                    struct phylink_link_state *state);
0582 int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface,
0583                          const unsigned long *advertising);
0584 int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode,
0585                    phy_interface_t interface,
0586                    const unsigned long *advertising);
0587 void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
0588 
0589 void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
0590                    struct phylink_link_state *state);
0591 
0592 void phylink_decode_usxgmii_word(struct phylink_link_state *state,
0593                  uint16_t lpa);
0594 #endif