Commit 365c1e64 authored by Russell King's avatar Russell King Committed by David S. Miller

phy: add phy_interface_mode_is_8023z() helper

Add and use phy_interface_mode_is_8023z() helper to identify the
interface modes that use 802.3z negotiation.  Use it in phylink's
phylink_mac_an_restart().
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b0e9fe1b
...@@ -320,8 +320,7 @@ static void phylink_mac_config(struct phylink *pl, ...@@ -320,8 +320,7 @@ static void phylink_mac_config(struct phylink *pl,
static void phylink_mac_an_restart(struct phylink *pl) static void phylink_mac_an_restart(struct phylink *pl)
{ {
if (pl->link_config.an_enabled && if (pl->link_config.an_enabled &&
(pl->link_config.interface == PHY_INTERFACE_MODE_1000BASEX || phy_interface_mode_is_8023z(pl->link_config.interface))
pl->link_config.interface == PHY_INTERFACE_MODE_2500BASEX))
pl->ops->mac_an_restart(pl->netdev); pl->ops->mac_an_restart(pl->netdev);
} }
......
...@@ -761,6 +761,20 @@ static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode) ...@@ -761,6 +761,20 @@ static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode)
mode <= PHY_INTERFACE_MODE_RGMII_TXID; mode <= PHY_INTERFACE_MODE_RGMII_TXID;
}; };
/**
* phy_interface_mode_is_8023z() - does the phy interface mode use 802.3z
* negotiation
* @mode: one of &enum phy_interface_t
*
* Returns true if the phy interface mode uses the 16-bit negotiation
* word as defined in 802.3z. (See 802.3-2015 37.2.1 Config_Reg encoding)
*/
static inline bool phy_interface_mode_is_8023z(phy_interface_t mode)
{
return mode == PHY_INTERFACE_MODE_1000BASEX ||
mode == PHY_INTERFACE_MODE_2500BASEX;
}
/** /**
* phy_interface_is_rgmii - Convenience function for testing if a PHY interface * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
* is RGMII (all variants) * is RGMII (all variants)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment