FEC_MXC_SHARE_MDIO on i.MX6ULL

Oleh Kravchenko oleg at kaa.org.ua
Sun May 2 00:24:37 CEST 2021


Hi all,

I'm working on adding u-boot support for boards based on i.MX6ULL SoC.
One board has a shared MDIO (CONFIG_FEC_MXC_SHARE_MDIO=y).

> U-Boot 2021.04-00002-gb199ac910c-dirty (May 02 2021 - 01:03:13 +0300)

I've found a weird race condition in phy_find_by_mask() function.
During the cold boot, it's don't initialize properly:

> Net:   
> Warning: ethernet at 20b4000 (eth1) using random MAC address - 9e:55:17:69:4a:cb
> eth1: ethernet at 20b4000Get shared mii bus on ethernet at 2188000
> Could not get PHY for FEC1: addr 0

Everything initializes properly If I perform hot boot:
> Net:   
> Warning: ethernet at 20b4000 (eth1) using random MAC address - f6:cc:65:df:9d:99
> eth1: ethernet at 20b4000Get shared mii bus on ethernet at 2188000
> 
> Warning: ethernet at 2188000 (eth0) using random MAC address - 16:1b:89:80:44:8e
> , eth0: ethernet at 2188000

After some debugging, I've change phy_find_by_mask():
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 89e3076bfd..5dfc8cba37 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -914,12 +914,11 @@ struct phy_device *phy_find_by_mask(struct mii_dev *bus, uint phy_mask,
 				    phy_interface_t interface)
 {
 	/* Reset the bus */
-	if (bus->reset) {
+	if (bus->reset)
 		bus->reset(bus);
 
-		/* Wait 15ms to make sure the PHY has come out of hard reset */
-		mdelay(15);
-	}
+	/* Wait 15ms to make sure the PHY has come out of hard reset */
+	mdelay(15);
 
 	return get_phy_device_by_mask(bus, phy_mask, interface);
 }

Any ideas on how to fix this issue properly?
Or patch above is good enough to be merged into the u-boot source tree?

-- 
Best regards,
Oleh Kravchenko



More information about the U-Boot mailing list