From: Michael Walle <mwalle@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "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>,
"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, 19 Jul 2023 09:11:44 +0200 [thread overview]
Message-ID: <867ae3cc05439599d63e4712bca79e27@kernel.org> (raw)
In-Reply-To: <7be8b305-f287-4e99-bddd-55646285c427@lunn.ch>
>> diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
>> index a64186dc53f8..686a57d56885 100644
>> --- a/drivers/net/phy/phy-core.c
>> +++ b/drivers/net/phy/phy-core.c
>> @@ -556,7 +556,7 @@ int __phy_read_mmd(struct phy_device *phydev, int
>> devad, u32 regnum)
>>
>> if (phydev->drv && phydev->drv->read_mmd) {
>> val = phydev->drv->read_mmd(phydev, devad, regnum);
>> - } else if (phydev->is_c45) {
>> + } else if (phy_has_c45_registers(phydev)) {
>
> This i would say should be
>
> phy_has_c45_transfers(phydev). This is about, can we do C45 transfers
> on the bus, and if not, fall back to C45 over C22.
Shouldn't this then be a bus property? I.e. mdiobus_has_c45_transfers().
I've have a similar helper introduced in 9/11:
static inline bool mdiobus_supports_c45(struct mii_bus *bus)
{
return bus->read_c45 && !bus->prevent_c45_access;
}
>> static int phylink_sfp_connect_phy(void *upstream, struct phy_device
>> *phy)
>> diff --git a/include/linux/phy.h b/include/linux/phy.h
>> index 11c1e91563d4..fdb3774e99fc 100644
>> --- a/include/linux/phy.h
>> +++ b/include/linux/phy.h
>> @@ -766,6 +766,11 @@ static inline struct phy_device
>> *to_phy_device(const struct device *dev)
>> return container_of(to_mdio_device(dev), struct phy_device, mdio);
>> }
>>
>> +static inline bool phy_has_c45_registers(struct phy_device *phydev)
>> +{
>> + return phydev->is_c45;
>> +}
>
> And this is where it gets interesting. I think as a first step, you
> should implement the four functions:
>
> phy_has_c22_registers()
> phy_has_c45_registers()
> phy_has_c22_transfers()
> phy_has_c45_transfers()
>
> based on this. So there is initially no functional change.
>
>
> You can then change the implementation of _transfers() based on what
> the MDIO bus can do, plus the quirk for if a FUBAR microchip PHY has
> been found.
See above. Shouldn't it be mdiobus_...() then?
> Then change the implementation of _registers() based on the results of
> probing for the ID registers.
So this is where I cannot follow. Right now there is
(1) probing via bus scan
(2) probing via DT (or maybe also ACPI)
With (1) you we have scan_c22(), so if successful,
phy_has_c22_registers()
will return true, right? But it's not that clear for
phy_has_c45_registers(), because sometimes we prevent that scan. So
the PHY might have c45 but we don't know.
For (2) we don't even do a c22 scan if we know if its a C45 PHY (or the
other way around). I'm not sure we can reliably tell (at the end of this
series) if a phy has c22 register, c45 registers or both.
-michael
> That should give us a basis for a clean separation between register
> spaces and bus transaction, and then adding C45 over C22 should be
> more obviously correct.
>
> Andrew
next prev parent reply other threads:[~2023-07-19 7:11 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 [this message]
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)
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=867ae3cc05439599d63e4712bca79e27@kernel.org \
--to=mwalle@kernel.org \
--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=linux@armlinux.org.uk \
--cc=lxu@maxlinear.com \
--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).