Re: PHY issue with SJA1105Q/DP84849I Design

From: Vladimir Oltean
Date: Tue Dec 26 2023 - 12:05:25 EST


On Tue, Dec 26, 2023 at 06:00:17PM +0100, Andrew Lunn wrote:
> > The code which should have prevented this from happening is in
> > phy_attach_direct():
> >
> > if (phydev->attached_dev) {
> > dev_err(&dev->dev, "PHY already attached\n");
> > err = -EBUSY;
> > goto error;
> > }
>
> The problem might be dsa_shared_port_phylink_register():
>
> err = phylink_of_phy_connect(dp->pl, port_dn, 0);
> if (err && err != -ENODEV) {
> pr_err("could not attach to PHY: %d\n", err);
> goto err_phy_connect;
> }
>
> return 0;
>
> Since it is not -ENODEV, it just keep going.
>
> Andrew

"Shared" ports are DSA and CPU ports, the report is on a user port.
There, if phylink_of_phy_connect() fails, we try dsa_user_phy_connect(),
but only if the driver provides a ds->user_mii_bus, which sja1105 does not.
So the failure should be nice and clean. It might be worth posting a
full boot log though, since this is really strange.