sdk_dpaa: memac: fix AQR autoneg to lower than 10G partners
authorCamelia Groza <camelia.groza@nxp.com>
Tue, 24 Nov 2020 11:08:35 +0000 (13:08 +0200)
committerXiaobo Xie <xiaobo.xie@nxp.com>
Tue, 8 Jun 2021 05:01:47 +0000 (07:01 +0200)
Stop removing unsupported system side modes with AQR PHYs. Originally,
their removal didn't impact the modes advertised by the PHY. Since
auto-negotiation support was added to the aquantia driver, the
unsupported modes were no longer advertised. This prohibited the
PHY from negotiating with 1G link partners on LS1046ARDB.

Patch adapted from similar fix for the upstream DPAA1 Ethernet driver:
commit fddb5a50801a ("dpaa_eth: support all modes with rate adapting PHYs")

Aquantia auto-negotiation:
commit 09c4c57f7bc4 ("net: phy: aquantia: add support for auto-negotiation
configuration")

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c

index d0dda69..cf96d82 100644 (file)
@@ -496,6 +496,8 @@ static int xgmac_init_phy(struct net_device *net_dev,
        return 0;
 }
 
+/* The Aquantia PHYs are capable of performing rate adaptation */
+#define PHY_VEND_AQUANTIA      0x03a1b400
 static int memac_init_phy(struct net_device *net_dev,
                          struct mac_device *mac_dev)
 {
@@ -545,9 +547,15 @@ static int memac_init_phy(struct net_device *net_dev,
                return phy_dev == NULL ? -ENODEV : PTR_ERR(phy_dev);
        }
 
-       /* Remove any features not supported by the controller */
-       ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support);
-       linkmode_and(phy_dev->supported, phy_dev->supported, mask);
+       /* Unless the PHY is capable of rate adaptation */
+       if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII ||
+           ((phy_dev->drv->phy_id & GENMASK(31, 10)) != PHY_VEND_AQUANTIA)) {
+               /* Remove any features not supported by the controller */
+               ethtool_convert_legacy_u32_to_link_mode(mask,
+                                                       mac_dev->if_support);
+               linkmode_and(phy_dev->supported, phy_dev->supported, mask);
+       }
+
        /* Enable the symmetric and asymmetric PAUSE frame advertisements,
         * as most of the PHY drivers do not enable them by default.
         */