From: Alex Marginean Date: Tue, 2 Jul 2019 22:11:41 +0300 Subject: [U-Boot] [PATCH] drivers: net: phy: Ignore PHY ID 0 during PHY probing In-Reply-To: References: <20190619090715.21538-1-alexandru.marginean@nxp.com> Message-ID: <99eb6cb3-cdcd-d87b-5c35-971be389c2e9@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Joe, On 7/2/2019 12:17 AM, Joe Hershberger wrote: > On Wed, Jun 19, 2019 at 4:07 AM Alexandru Marginean > wrote: >> >> Current code fails to probe some C45 PHYs that also respond to C22 reads. >> This is the case for PHYs like Aquantia AQR112, Marvell 88X2242 (as >> previously posted on the u-boot list). >> If the PHY ID reads all 0s just ignore it and try the next devad. >> >> Signed-off-by: Alex Marginean >> --- >> drivers/net/phy/phy.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c >> index c1c1af9abd..7ccbc4d9da 100644 >> --- a/drivers/net/phy/phy.c >> +++ b/drivers/net/phy/phy.c >> @@ -727,6 +727,15 @@ static struct phy_device *create_phy_by_mask(struct mii_dev *bus, >> while (phy_mask) { >> int addr = ffs(phy_mask) - 1; >> int r = get_phy_id(bus, addr, devad, &phy_id); >> + >> + /* If the PHY ID is flat 0 we ignore it. There are C45 PHYs > > Agreed on the format. > >> + * that return all 0s for C22 reads (like Aquantia AQR112) and >> + * there are C22 PHYs that return all 0s for C45 reads (like >> + * Atheros AR8035). >> + */ >> + if (phy_id == 0) >> + return NULL; > > As for continue or return, this should probably check that phy_id == 0 > and r == 0, right? Right, in case the read over MDIO returns an error code for the missing PHY we want to continue the loop. I'll fix this. Thank you! Alex > >> + >> /* If the PHY ID is mostly f's, we didn't find anything */ >> if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) { >> is_c45 = (devad == MDIO_DEVAD_NONE) ? false : true; >> -- >> 2.17.1 >> >> _______________________________________________ >> U-Boot mailing list >> U-Boot at lists.denx.de >> https://lists.denx.de/listinfo/u-boot > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > https://lists.denx.de/listinfo/u-boot >