Re: [PATCH net-next v2 3/9] net: phy: ncn26000: Added PHY loopback and read/write MMD callbacks

From: Andrew Lunn

Date: Mon May 25 2026 - 10:30:56 EST


On Mon, May 25, 2026 at 05:35:55AM +0000, Selvamani Rajagopal wrote:
> > > diff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c
> > > index 68b0e4647..d302e04c8 100644
> > > --- a/drivers/net/phy/ncn26000.c
> > > +++ b/drivers/net/phy/ncn26000.c
> > > @@ -162,6 +162,39 @@ static int ncn26000_config_intr(struct phy_device *phydev)
> > > return 0;
> > > }
> > >
> > > +/* Directly accessing via Clause 45 read avoids the extra
> > > + * SPI accesses required by indirect access.
> > > + */
> > > +static int ncn26000_read_mmd(struct phy_device *phydev, int dev, u16 reg)
> > > +{
> > > + struct mii_bus *bus = phydev->mdio.bus;
> > > + int addr = phydev->mdio.addr;
> > > +
> > > + return __mdiobus_c45_read(bus, addr, dev, reg);
> > > +}
> >
> > This needs more explanation. Maybe you need to look into
> > phydev->is_c45.
>
> Andew,
>

> I spent some time to understand the is_c45 flag. As far as I can
> see, this is the only way. See my reasons below, to see if it makes
> sense.

O.K. Lets keep with it, but please do some refactoring. We have the
same code in microchip_t1s.c, for the same reason. Please pull it out
of that driver, and put it next to genphy_read_mmd_unsupported(),
along with the explanation of why it is needed.

Andrew