Skip to contentSkip to conversation

net: macb: Fix GMAC not work when enable DM_ETH

PATCH In review Wenyou Yang 2 participants 3 messages Apr 20, 2017 – Jun 2, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: macb: Fix GMAC not work when enable DM_ETH

Always search the PHY to determine the macb->phy_addr before using the PHY to fix "No PHY present" error.

Fix the wrong test of the GMAC's phy interface mode, it should be PHY_INTERFACE_MODE_RGMII.

---

Changes in v2:
- Fix the wrong missed RMII phy interface mode.
- Add Reviewed-by tag.

 drivers/net/macb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/macb.c +2 -5
index 402e866817..8e9b38f34f 100644
@@ -447,7 +447,6 @@ static void macb_phy_reset(struct macb_device *macb, const char *name)
 		       name, status);
 }
 
-#ifdef CONFIG_MACB_SEARCH_PHY
 static int macb_phy_find(struct macb_device *macb, const char *name)
 {
 	int i;
@@ -468,7 +467,6 @@ static int macb_phy_find(struct macb_device *macb, const char *name)
 
 	return 0;
 }
-#endif /* CONFIG_MACB_SEARCH_PHY */
 
 #ifdef CONFIG_DM_ETH
 static int macb_phy_init(struct udevice *dev, const char *name)
@@ -488,11 +486,9 @@ static int macb_phy_init(struct macb_device *macb, const char *name)
 	int i;
 
 	arch_get_mdio_control(name);
-#ifdef CONFIG_MACB_SEARCH_PHY
 	/* Auto-detect phy_addr */
 	if (!macb_phy_find(macb, name))
 		return 0;
-#endif /* CONFIG_MACB_SEARCH_PHY */
 
 	/* Check if the PHY is up to snuff... */
 	phy_id = macb_mdio_read(macb, MII_PHYSID1);
@@ -667,7 +663,8 @@ static int _macb_init(struct macb_device *macb, const char *name)
 		 * to select interface between RMII and MII.
 		 */
 #ifdef CONFIG_DM_ETH
-		if (macb->phy_interface == PHY_INTERFACE_MODE_RMII)
+		if ((macb->phy_interface == PHY_INTERFACE_MODE_RMII) ||
+		    (macb->phy_interface == PHY_INTERFACE_MODE_RGMII))
 			gem_writel(macb, UR, GEM_BIT(RGMII));
 		else
 			gem_writel(macb, UR, 0);
Signature · 1 line
2.11.0