[PATCH net-next 2/2] net: phy: aquantia: enable USXGMII autoneg on AQR107

From: Robert Marko
Date: Fri Nov 17 2023 - 05:10:12 EST


In case USXGMII is being used as the PHY interface mode then USXGMII
autoneg must be enabled as well.

HW defaults to USXGMII autoneg being disabled which then results in
autoneg timeout, so enable it in case USXGMII is used.

Signed-off-by: Robert Marko <robimarko@xxxxxxxxx>
---
drivers/net/phy/aquantia/aquantia_main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index 7711e052e737..c602873052a0 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -26,6 +26,9 @@
#define PHY_ID_AQR412 0x03a1b712
#define PHY_ID_AQR113C 0x31c31c12

+#define MDIO_PHYXS_XAUI_RX_VEND2 0xc441
+#define MDIO_PHYXS_XAUI_RX_VEND2_USX_AUTONEG_EN BIT(3)
+
#define MDIO_PHYXS_VEND_IF_STATUS 0xe812
#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3)
#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0
@@ -545,6 +548,15 @@ static int aqr107_config_init(struct phy_device *phydev)

aqr107_validate_mode(phydev, phydev->interface);

+ if (phydev->interface == PHY_INTERFACE_MODE_USXGMII) {
+ ret = phy_modify_mmd(phydev, MDIO_MMD_PHYXS,
+ MDIO_PHYXS_XAUI_RX_VEND2,
+ MDIO_PHYXS_XAUI_RX_VEND2_USX_AUTONEG_EN,
+ MDIO_PHYXS_XAUI_RX_VEND2_USX_AUTONEG_EN);
+ if (ret)
+ return ret;
+ }
+
return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
}

--
2.42.0