Re: [PATCH net-next v4 3/3] net: phy: add a PHY write barrier when disabling interrupts

Andrew Lunn
2026-04-02T18:09:20Z

On Thu, Apr 02, 2026 at 07:03:42PM +0100, Russell King (Oracle) wrote:
> On Thu, Apr 02, 2026 at 03:31:52PM +0200, Andrew Lunn wrote:
> > > +static int phy_write_barrier(struct phy_device *phydev)
> > > +{
> > > + int err;
> > > +
> > > + err = phy_read(phydev, MII_PHYSID1);
> > > + if (err < 0)
> > > + return err;
> >
> > There are a small number of MDIO busses which don't implement C22,
> > only C45. You are likely to get -EIO or maybe ENODEV, -EOPNOTSUPP,
> > -EINVAL for such a read. Returning the error than makes
> > phy_disable_interrupts() fail, etc.
>
> If it returns -EOPNOTSUPP (meaning, at least, that bus->read is not
> implemented), do we want to issue a C45 read instead?

Maybe.

get_phy_c45_ids() first reads MDIO_MMD_PMAPMD : MII_PHYSID1. That
seems like a safe option.

Andrew