[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8alV6FUKsN2x2XZ@lunn.ch>
Date: Tue, 17 Jan 2023 14:40:39 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Lars-Peter Clausen <lars@...afoo.de>
Cc: Pierluigi Passaro <pierluigi.passaro@...il.com>,
hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
eran.m@...iscite.com, nate.d@...iscite.com,
francesco.f@...iscite.com, pierluigi.p@...iscite.com
Subject: Re: [PATCH] net: mdio: force deassert MDIO reset signal
> > So compatible "ethernet-phy-ieee802.3-c45" results in is_c45 being set
> > true. The if (is_c45 || is then true, so it does not need to call
> > fwnode_get_phy_id(child, &phy_id) so ignores whatever ID is in DT and
> > asks the PHY.
> >
> > Try this, totally untested:
> >
> > diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
> > index b782c35c4ac1..13be23f8ac97 100644
> > --- a/drivers/net/mdio/fwnode_mdio.c
> > +++ b/drivers/net/mdio/fwnode_mdio.c
> > @@ -134,10 +134,10 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
> > if (rc >= 0)
> > is_c45 = true;
> > - if (is_c45 || fwnode_get_phy_id(child, &phy_id))
> > + if (fwnode_get_phy_id (child, &phy_id))
> > phy = get_phy_device(bus, addr, is_c45);
> > else
> > - phy = phy_device_create(bus, addr, phy_id, 0, NULL);
> > + phy = phy_device_create(bus, addr, phy_id, is_c45, NULL);
> > if (IS_ERR(phy)) {
> > rc = PTR_ERR(phy);
> > goto clean_mii_ts;
> >
> I think part of the problem is that for C45 there are a few other fields
> that get populated by the ID detection, such as devices_in_package and
> mmds_present. Is this something we can do after running the PHY drivers
> probe function? Or is it too late at that point?
As i hinted, it needs somebody to actually debug this and figure out
why it does not work.
I think what i did above is part of the solution. You need to actually
read the ID from the DT, which if you never call fwnode_get_phy_id()
you never do.
You then need to look at phy_bus_match() and probably remove the
return 0;
} else {
so that C22 style ID matching is performed if matching via
c45_ids.device_ids fails.
Andrew
Powered by blists - more mailing lists