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")
Signed-off-by: Pranav Tilak <[email protected]>
---
drivers/net/phy/phy.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f2e9b2a9820..cb4fba93391 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -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);
--
2.43.0