From: Christian Marangi <ansuelsmth@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Vladimir Oltean <olteanv@gmail.com>,
David Epping <david.epping@missinglinkelectronics.com>,
Harini Katakam <harini.katakam@amd.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH 3/3] net: phy: add support for PHY package MMD read/write
Date: Sun, 26 Nov 2023 01:54:35 +0100 [thread overview]
Message-ID: <6562974e.df0a0220.242f6.337e@mx.google.com> (raw)
In-Reply-To: <637891aa-19fa-4f13-9ed2-f2e14a4b1ee2@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2023-11-26 0:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-26 0:37 [net-next PATCH 1/3] net: phy: extend PHY package API to support multiple global address Christian Marangi
2023-11-26 0:37 ` [net-next PATCH 2/3] net: phy: move mmd_phy_indirect to generic header Christian Marangi
2023-11-26 0:37 ` [net-next PATCH 3/3] net: phy: add support for PHY package MMD read/write Christian Marangi
2023-11-26 0:52 ` Florian Fainelli
2023-11-26 0:54 ` Christian Marangi [this message]
2023-11-26 1:00 ` Florian Fainelli
2023-11-26 18:14 ` Andrew Lunn
2023-11-26 18:24 ` Christian Marangi
2023-11-26 18:04 ` [net-next PATCH 1/3] net: phy: extend PHY package API to support multiple global address Andrew Lunn
2023-11-26 18:07 ` Christian Marangi
2023-11-26 18:19 ` Andrew Lunn
2023-11-26 18:23 ` Christian Marangi
2023-11-26 19:39 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6562974e.df0a0220.242f6.337e@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=david.epping@missinglinkelectronics.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=harini.katakam@amd.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).