[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6562974e.df0a0220.242f6.337e@mx.google.com>
Date: Sun, 26 Nov 2023 01:54:35 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Vladimir Oltean <olteanv@...il.com>,
David Epping <david.epping@...singlinkelectronics.com>,
Harini Katakam <harini.katakam@....com>,
"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH 3/3] net: phy: add support for PHY package MMD
read/write
On Sat, Nov 25, 2023 at 04:52:19PM -0800, Florian Fainelli wrote:
>
>
> On 11/25/2023 4:37 PM, 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.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> > ---
> > include/linux/phy.h | 74 +++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 74 insertions(+)
> >
> > diff --git a/include/linux/phy.h b/include/linux/phy.h
> > index 984bca9a82f4..1799133c8387 100644
> > --- a/include/linux/phy.h
> > +++ b/include/linux/phy.h
> > @@ -2067,6 +2067,80 @@ 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, int devad,
> > + u32 regnum)
> > +{
> > + struct phy_package_shared *shared = phydev->shared;
> > + struct mii_bus *bus = phydev->mdio.bus;
> > + int addr, val;
> > +
> > + if (!shared || shared->base_addr + addr_offset > PHY_MAX_ADDR)
> > + return -EIO;
>
> You might be off by one here, should not that >= PHY_MAX_ADDR here and
> below?
Thanks for the review. Yes PHY_MAX_ADDR is 32 so I should use >=.
(interesting choice to use 32 instead of 31 as MAX, guess an old mistake)
--
Ansuel
Powered by blists - more mailing lists