netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Michael Walle" <mwalle@kernel.org>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Yisen Zhuang" <yisen.zhuang@huawei.com>,
	"Salil Mehta" <salil.mehta@huawei.com>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Marek Behún" <kabel@kernel.org>, "Xu Liang" <lxu@maxlinear.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Simon Horman" <simon.horman@corigine.com>
Subject: Re: [PATCH net-next v3 02/11] net: phy: introduce phy_has_c45_registers()
Date: Wed, 2 Aug 2023 23:28:01 +0100	[thread overview]
Message-ID: <ZMrYcbY65yOZyaxo@shell.armlinux.org.uk> (raw)
In-Reply-To: <cdd97217-d5e5-429b-bcda-2248f0de12ce@lunn.ch>

On Thu, Aug 03, 2023 at 12:21:03AM +0200, Andrew Lunn wrote:
> On Wed, Aug 02, 2023 at 06:10:27PM +0100, Russell King (Oracle) wrote:
> > On Wed, Aug 02, 2023 at 06:15:19PM +0200, Andrew Lunn wrote:
> > > > I'm confused now. Andrew suggested to split it into four different
> > > > functions:
> > > > 
> > > > phy_has_c22_registers()
> > > > phy_has_c45_registers()
> > > > phy_has_c22_transfers()
> > > > phy_has_c45_transfers()
> > > > 
> > > > Without a functional change. That is, either return phydev->is_c45
> > > > or the inverse.
> > > 
> > > Without a functional change at this step of introducing the four
> > > functions. Then later really implement them to do what the name
> > > implies. Doing it in steps helps with bisect when it breaks something.
> > > 
> > > It could also be that not all four are needed, or not all four are
> > > possible. But the four express the full combinations of transfers and
> > > registers.
> > 
> > I'm left wondering how you think that phy_has_c45_registers() can
> > be implemented in a useful way, because I'm at a total loss...
> 
> get_phy_c22_id() looks at the ID registers, and see if its mostly
> Fs. If so, it says -ENODEV. So phy_has_c22_registers() could be
> get_phy_c22_id() != -ENODEV. And you can extend that with the logic
> you quoted from the standard. get_phy_c45_ids() also returns -ENODEV
> if there are no devices in the package. So phy_has_c45_registers()
> could be get_phy_c45_id() != -ENODEV.

No, this is not correct, because get_phy_c45_id() uses mdiobus c45
reads - if the bus doesn't support c45 transfers, then get_phy_c45_id()
fails.

This doesn't tell us whether the PHY has clause 45 registers at all,
it just tells us that we probed the PHY successfully using clause 45
accesses.

The fact of the matter is that there is no way in the current phylib
code (and probably no way to probe it either) to determine whether a
PHY has clause 45 registers or not. To see why, take for example the
AR8035. This clearly has clause 45 registers, because it has MMDs 3
and 7 implemented. However, these are only accessible through the
indirect access method via clause 22 cycles.

So, does it make sense for AR8035 to return false from
phy_has_c45_registers() ? No it doesn't, because it clearly does have
clause 45 registers!

The same can be said about Marvell 88e151x PHYs. And probably many
other clause 22 PHYs.

Hence why I disagree with your suggestion.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2023-08-02 22:28 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 15:07 [PATCH net-next v3 00/11] net: phy: C45-over-C22 access Michael Walle
2023-07-12 15:07 ` [PATCH net-next v3 01/11] net: phy: get rid of redundant is_c45 information Michael Walle
2023-07-18 17:25   ` Andrew Lunn
2023-07-12 15:07 ` [PATCH net-next v3 02/11] net: phy: introduce phy_has_c45_registers() Michael Walle
2023-07-18 17:26   ` Andrew Lunn
2023-07-18 20:07   ` Andrew Lunn
2023-07-19  7:11     ` Michael Walle
2023-08-01 14:47       ` Michael Walle
2023-08-01 14:57         ` Russell King (Oracle)
2023-08-01 15:20           ` Michael Walle
2023-08-01 15:57             ` Russell King (Oracle)
2023-08-02 15:33               ` Michael Walle
2023-08-02 16:06                 ` Russell King (Oracle)
2023-08-02 17:11                   ` Michael Walle
2023-08-02 23:00                     ` Russell King (Oracle)
2023-08-02 16:15                 ` Andrew Lunn
2023-08-02 17:10                   ` Russell King (Oracle)
2023-08-02 22:21                     ` Andrew Lunn
2023-08-02 22:28                       ` Russell King (Oracle) [this message]
2023-09-05  8:22                         ` Michael Walle
2023-07-12 15:07 ` [PATCH net-next v3 03/11] net: phy: replace is_c45 with phy_accces_mode Michael Walle
2023-07-18 17:40   ` Andrew Lunn
2023-07-18 17:52     ` Russell King (Oracle)
2023-07-18 19:18       ` Andrew Lunn
2023-07-18 21:46         ` Russell King (Oracle)
2023-07-18 23:30           ` Andrew Lunn
2023-07-18 19:53     ` Michael Walle
2023-07-18 20:16       ` Andrew Lunn
2023-07-12 15:07 ` [PATCH net-next v3 04/11] net: phy: make the "prevent_c45_scan" a property of the MII bus Michael Walle
2023-07-18 23:31   ` Andrew Lunn
2023-07-12 15:07 ` [PATCH net-next v3 05/11] net: phy: print an info if a broken C45 bus is found Michael Walle
2023-07-18 23:32   ` Andrew Lunn
2023-07-12 15:07 ` [PATCH net-next v3 06/11] net: phy: add error checks in mmd_phy_indirect() Michael Walle
2023-07-18 23:34   ` Andrew Lunn
2023-07-12 15:07 ` [PATCH net-next v3 07/11] net: phy: introduce phy_mdiobus_read_mmd() Michael Walle
2023-07-18 23:54   ` Andrew Lunn
2023-07-19  7:21     ` Michael Walle
2023-07-12 15:07 ` [PATCH net-next v3 08/11] net: phy: add support for C45-over-C22 transfers Michael Walle
2023-07-13  8:56   ` Simon Horman
2023-07-13  9:00     ` Michael Walle
2023-07-13  9:19       ` Simon Horman
2023-07-12 15:07 ` [PATCH net-next v3 09/11] net: phy: introduce phy_promote_to_c45() Michael Walle
2023-07-13  8:56   ` Simon Horman
2023-07-12 15:07 ` [PATCH net-next v3 10/11] net: mdio: add C45-over-C22 fallback to fwnode_mdiobus_register_phy() Michael Walle
2023-07-19  0:03   ` Andrew Lunn
2023-07-19  7:32     ` Michael Walle
2023-07-12 15:07 ` [PATCH net-next v3 11/11] net: mdio: support C45-over-C22 when probed via OF Michael Walle

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=ZMrYcbY65yOZyaxo@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lxu@maxlinear.com \
    --cc=mwalle@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=simon.horman@corigine.com \
    --cc=yisen.zhuang@huawei.com \
    /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).