Skip to contentSkip to conversation

net: phy: prioritize GMII2RGMII bridge over DM-bound PHY lookup

PATCH In review Pranav Tilak 2 participants 2 messages Oct 1 – Oct 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: prioritize GMII2RGMII bridge over DM-bound PHY lookup

phy_connect() currently checks for a DM-bound PHY before attempting GMII-to-RGMII bridge discovery. On boards using a GMII-to-RGMII bridge, the external PHY node is already DM-bound, so phy_connect_dm_bound() returns it first and the bridge is never selected. This skips xilinxgmiitorgmii_startup(), preventing the GMII-to-RGMII converter from being configured for the negotiated link parameters and leaving the GEM's MAC-side phydev pointing at the external PHY instead of the bridge.

Check for the gmii2rgmii bridge first and fall back to the DM-bound lookup only when no bridge device is found, restoring the bridge as the MAC-side phydev on boards that have one.

Fixes 2671bd1d77ab ("net: phy: fix duplicate eth_phy binding")
---
 drivers/net/phy/phy.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/phy/phy.c +6 -6
index f2e9b2a9820..cb4fba93391 100644
@@ -950,8 +950,13 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 	struct phy_device *phydev = NULL;
 	uint mask = (addr >= 0) ? (1 << addr) : 0xffffffff;
 
+#ifdef CONFIG_PHY_XILINX_GMII2RGMII
+	phydev = phy_connect_gmii2rgmii(bus, dev);
+#endif
+
 #ifdef CONFIG_DM_ETH_PHY
-	phydev = phy_connect_dm_bound(bus, dev, mask);
+	if (!phydev)
+		phydev = phy_connect_dm_bound(bus, dev, mask);
 #endif
 
 #ifdef CONFIG_PHY_FIXED
@@ -969,11 +974,6 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 		phydev = phy_connect_phy_id(bus, dev, addr);
 #endif
 
-#ifdef CONFIG_PHY_XILINX_GMII2RGMII
-	if (!phydev)
-		phydev = phy_connect_gmii2rgmii(bus, dev);
-#endif
-
 	if (!phydev)
 		phydev = phy_find_by_mask(bus, mask);
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Pranav Tilak

phy_connect() currently checks for a DM-bound PHY before attempting GMII-to-RGMII bridge discovery. On boards using a GMII-to-RGMII bridge, the external PHY node is already DM-bound, so phy_connect_dm_bound() returns it first and the bridge is never selected. This skips xilinxgmiitorgmii_startup(), preventing the GMII-to-RGMII converter from being configured for the negotiated link parameters and leaving the GEM's MAC-side phydev pointing at the external PHY instead of the bridge.

[...]

Applied to u-boot-net branch for-next, thanks!

[1/1] net: phy: prioritize GMII2RGMII bridge over DM-bound PHY lookup

      commit: 3518647f4d4d30e40cc015d670734e61f98e9133

Best regards,

Signature · 1 line
Jerome Forissier <[email protected]>