Subject: Re: [net-next PATCH v2 4/4] net: phy: add support for PHY package MMD read/write

From: Christian Marangi <[email-masked]>
Date: Tue, 28 Nov 2023 13:12:10 +0100

On Tue, Nov 28, 2023 at 01:51:05AM +0100, Andrew Lunn wrote:
> On Mon, Nov 27, 2023 at 12:51:41AM +0100, Christian Marangi wrote:
> > Some PHY in PHY package may require to read/write MMD regs to correctly
> > configure the PHY package.
> > 
> > Add support for these additional required function in both lock and no
> > lock variant.
> > 
> > It's possible to set is_c45 bool for phy_package_read/write to true to
> > access mmd regs for accessing C45 PHY in PHY package for global
> > configuration.
> 
> I would just use phydev->is_c45. I would be very surprised if you have
> a package with some PHYs being only C22 and some C45.
>

Was being more careful about this. Ok will base everything on phydev.
Maybe will add a comment that we assume the entire package is C22 or
C45.

> > 
> > Signed-off-by: Christian Marangi <[email-masked]>
> > ---
> > Changes v2:
> > - Rework to use newly introduced helper
> > - Add common check for regnum and devad
> > 
> >  include/linux/phy.h | 78 +++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 78 insertions(+)
> > 
> > diff --git a/include/linux/phy.h b/include/linux/phy.h
> > index 96f6f34be051..3e507bd2c3b4 100644
> > --- a/include/linux/phy.h
> > +++ b/include/linux/phy.h
> > @@ -2085,6 +2085,84 @@ static inline int __phy_package_write(struct phy_device *phydev,
> >  	return __mdiobus_write(phydev->mdio.bus, addr, regnum, val);
> >  }
> >  
> > +static inline int phy_package_read_mmd(struct phy_device *phydev,
> > +				       unsigned int addr_offset, bool is_c45,
> > +				       int devad, u32 regnum)
> > +{
> 
> I also don't know why this should be in the header file?
> 
>   Andrew

-- 
	Ansuel