Commit e334df1d authored by David S. Miller's avatar David S. Miller

Merge branch 'mvneta-phylink'

Russell King says:

====================
Convert mvneta to phylink supported_interfaces

This patch series converts mvneta to use phylinks supported_interfaces
bitmap to simplify the validate() implementation. The patches:

1) Add the supported interface modes the supported_interfaces bitmap.
2) Removes the checks for the interface type being supported from
   the validate callback
3) Removes the now unnecessary checks and call to
   phylink_helper_basex_speed() to support switching between
   1000base-X and 2500base-X for SFPs

(3) becomes possible because when asking the MAC for its complete
support, we walk all supported interfaces which will include 1000base-X
and 2500base-X only if the comphy is present.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c230dc86 099cbfa2
...@@ -3823,8 +3823,6 @@ static void mvneta_validate(struct phylink_config *config, ...@@ -3823,8 +3823,6 @@ static void mvneta_validate(struct phylink_config *config,
unsigned long *supported, unsigned long *supported,
struct phylink_link_state *state) struct phylink_link_state *state)
{ {
struct net_device *ndev = to_net_dev(config->dev);
struct mvneta_port *pp = netdev_priv(ndev);
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
/* We only support QSGMII, SGMII, 802.3z and RGMII modes. /* We only support QSGMII, SGMII, 802.3z and RGMII modes.
...@@ -3832,15 +3830,8 @@ static void mvneta_validate(struct phylink_config *config, ...@@ -3832,15 +3830,8 @@ static void mvneta_validate(struct phylink_config *config,
* "Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ... * "Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
* When <PortType> = 1 (1000BASE-X) this field must be set to 1." * When <PortType> = 1 (1000BASE-X) this field must be set to 1."
*/ */
if (phy_interface_mode_is_8023z(state->interface)) { if (phy_interface_mode_is_8023z(state->interface) &&
if (!phylink_test(state->advertising, Autoneg)) { !phylink_test(state->advertising, Autoneg)) {
linkmode_zero(supported);
return;
}
} else if (state->interface != PHY_INTERFACE_MODE_NA &&
state->interface != PHY_INTERFACE_MODE_QSGMII &&
state->interface != PHY_INTERFACE_MODE_SGMII &&
!phy_interface_mode_is_rgmii(state->interface)) {
linkmode_zero(supported); linkmode_zero(supported);
return; return;
} }
...@@ -3853,11 +3844,12 @@ static void mvneta_validate(struct phylink_config *config, ...@@ -3853,11 +3844,12 @@ static void mvneta_validate(struct phylink_config *config,
phylink_set(mask, Pause); phylink_set(mask, Pause);
/* Half-duplex at speeds higher than 100Mbit is unsupported */ /* Half-duplex at speeds higher than 100Mbit is unsupported */
if (pp->comphy || state->interface != PHY_INTERFACE_MODE_2500BASEX) { if (state->interface != PHY_INTERFACE_MODE_2500BASEX) {
phylink_set(mask, 1000baseT_Full); phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full); phylink_set(mask, 1000baseX_Full);
} }
if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) {
if (state->interface == PHY_INTERFACE_MODE_2500BASEX) {
phylink_set(mask, 2500baseT_Full); phylink_set(mask, 2500baseT_Full);
phylink_set(mask, 2500baseX_Full); phylink_set(mask, 2500baseX_Full);
} }
...@@ -3872,11 +3864,6 @@ static void mvneta_validate(struct phylink_config *config, ...@@ -3872,11 +3864,6 @@ static void mvneta_validate(struct phylink_config *config,
linkmode_and(supported, supported, mask); linkmode_and(supported, supported, mask);
linkmode_and(state->advertising, state->advertising, mask); linkmode_and(state->advertising, state->advertising, mask);
/* We can only operate at 2500BaseX or 1000BaseX. If requested
* to advertise both, only report advertising at 2500BaseX.
*/
phylink_helper_basex_speed(state);
} }
static void mvneta_mac_pcs_get_state(struct phylink_config *config, static void mvneta_mac_pcs_get_state(struct phylink_config *config,
...@@ -5179,6 +5166,31 @@ static int mvneta_probe(struct platform_device *pdev) ...@@ -5179,6 +5166,31 @@ static int mvneta_probe(struct platform_device *pdev)
pp->phylink_config.dev = &dev->dev; pp->phylink_config.dev = &dev->dev;
pp->phylink_config.type = PHYLINK_NETDEV; pp->phylink_config.type = PHYLINK_NETDEV;
phy_interface_set_rgmii(pp->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_QSGMII,
pp->phylink_config.supported_interfaces);
if (comphy) {
/* If a COMPHY is present, we can support any of the serdes
* modes and switch between them.
*/
__set_bit(PHY_INTERFACE_MODE_SGMII,
pp->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_1000BASEX,
pp->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_2500BASEX,
pp->phylink_config.supported_interfaces);
} else if (phy_mode == PHY_INTERFACE_MODE_2500BASEX) {
/* No COMPHY, with only 2500BASE-X mode supported */
__set_bit(PHY_INTERFACE_MODE_2500BASEX,
pp->phylink_config.supported_interfaces);
} else if (phy_mode == PHY_INTERFACE_MODE_1000BASEX ||
phy_mode == PHY_INTERFACE_MODE_SGMII) {
/* No COMPHY, we can switch between 1000BASE-X and SGMII */
__set_bit(PHY_INTERFACE_MODE_1000BASEX,
pp->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_SGMII,
pp->phylink_config.supported_interfaces);
}
phylink = phylink_create(&pp->phylink_config, pdev->dev.fwnode, phylink = phylink_create(&pp->phylink_config, pdev->dev.fwnode,
phy_mode, &mvneta_phylink_ops); phy_mode, &mvneta_phylink_ops);
......
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