net: phy: aquantia: add USXGMII support and warn if XGMII mode is set
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 23 May 2019 18:09:08 +0000 (20:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 May 2019 20:39:34 +0000 (13:39 -0700)
So far we didn't support mode USXGMII, and in order to not break few
boards mode XGMII was accepted for the AQR107 family even though it
doesn't support XGMII. Add USXGMII support to the Aquantia PHY driver
and warn if XGMII mode is set.

v2:
- add warning if XGMII mode is set

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/aquantia_main.c

index 0fedd28fdb6e3966806f5c708c2d142584a9375c..3b29d381116f8e88dc25dc0d17c485db2b4ef6e2 100644 (file)
@@ -27,6 +27,7 @@
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK    GENMASK(7, 3)
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR      0
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI     2
+#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII 3
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII   6
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII 10
 
@@ -360,6 +361,9 @@ static int aqr107_read_status(struct phy_device *phydev)
        case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI:
                phydev->interface = PHY_INTERFACE_MODE_10GKR;
                break;
+       case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII:
+               phydev->interface = PHY_INTERFACE_MODE_USXGMII;
+               break;
        case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII:
                phydev->interface = PHY_INTERFACE_MODE_SGMII;
                break;
@@ -488,9 +492,13 @@ static int aqr107_config_init(struct phy_device *phydev)
        if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
            phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
            phydev->interface != PHY_INTERFACE_MODE_XGMII &&
+           phydev->interface != PHY_INTERFACE_MODE_USXGMII &&
            phydev->interface != PHY_INTERFACE_MODE_10GKR)
                return -ENODEV;
 
+       WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII,
+            "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n");
+
        ret = aqr107_wait_reset_complete(phydev);
        if (!ret)
                aqr107_chip_info(phydev);