net: dsa: b53: Also include SGMII for mac_config and mac_link_state
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 21 Sep 2018 23:43:59 +0000 (16:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 22 Sep 2018 03:01:19 +0000 (20:01 -0700)
In both 802.3z and SGMII modes we need to configure the MAC accordingly
to flip between Fiber and SGMII modes, and we need to read the MAC
status from the SGMII in-band control word.

Fixes: 0e01491de646 ("net: dsa: b53: Add SerDes support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/b53/b53_common.c

index dbf5b86a07fe63cc8d31740f1a4b5c421560f88b..700d86dd5e130b46531cb2b5da6bfa353f310989 100644 (file)
@@ -1172,8 +1172,9 @@ int b53_phylink_mac_link_state(struct dsa_switch *ds, int port,
        struct b53_device *dev = ds->priv;
        int ret = -EOPNOTSUPP;
 
-       if (phy_interface_mode_is_8023z(state->interface) &&
-           dev->ops->serdes_link_state)
+       if ((phy_interface_mode_is_8023z(state->interface) ||
+            state->interface == PHY_INTERFACE_MODE_SGMII) &&
+            dev->ops->serdes_link_state)
                ret = dev->ops->serdes_link_state(dev, port, state);
 
        return ret;
@@ -1195,8 +1196,9 @@ void b53_phylink_mac_config(struct dsa_switch *ds, int port,
                return;
        }
 
-       if (phy_interface_mode_is_8023z(state->interface) &&
-           dev->ops->serdes_config)
+       if ((phy_interface_mode_is_8023z(state->interface) ||
+            state->interface == PHY_INTERFACE_MODE_SGMII) &&
+            dev->ops->serdes_config)
                dev->ops->serdes_config(dev, port, mode, state);
 }
 EXPORT_SYMBOL(b53_phylink_mac_config);