netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <mwalle@kernel.org>
To: "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>,
	"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>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Michael Walle <mwalle@kernel.org>
Subject: [PATCH net-next v2 00/10] net: phy: C45-over-C22 access
Date: Fri, 23 Jun 2023 12:29:09 +0200	[thread overview]
Message-ID: <20230620-feature-c45-over-c22-v2-0-def0ab9ccee2@kernel.org> (raw)

[Sorry for the very late follow-up on this series, I simply haven't had
time to look into it. Should be better now.]

The goal here is to get the GYP215 and LAN8814 running on the Microchip
LAN9668 SoC. The LAN9668 suppports one external bus and unfortunately, the
LAN8814 has a bug which makes it impossible to use C45 on that bus.
Fortunately, it was the intention of the GPY215 driver to be used on a C22
bus. But I think this could have never really worked, because the
phy_get_c45_ids() will always do c45 accesses and thus gpy_probe() will
fail.

Introduce C45-over-C22 support and use it if the MDIO bus doesn't support
C45 in the OF case. We must not use C45-over-C22 if the device being
probed isn't a PHY because it involes register writes to standard PHY
registers, which might not be supported in generic PHY devices.
Therefore, we cannot use it in the generic PHY probing code. In the DT
case, we know we are probing a PHY device and thus we can fall back to
C45-over-C22.

The first patches convert the is_c45 property to a new "enum
phy_access_mode". The former property is then derived from the
access mode.

To support the probing for DT, export the prevent_c45_scan logic and
make it a property of the mii bus. Unfortunately, you'd need to stick to
the following flow in every scanning code:
 (1) add any c22 phys
 (2) scan for broken phys
 (3) add any c45 phys using either c45 or c45-over-c22 access

I couldn't find a way to make that generic and move the flow into the
phy core.

Then, a new access method c45-over-c22 is added for get_phy_device() and
phy_{read,write}_mmd(). It is the callers responsibilty to choose the
correct mode. Esp. the generic probing code isn't using c45-over-c22.

c45-over-c22 is then added for the MaxLinear PHYs if it is probed as a
C22 device, which is always the case if there is no compatible =
"ethernet-phy-ieee802.3-c45" in the device tree. The driver will
automatically "promote" the PHY to a C45 one if probed as C22.

The last two patches will then add c45-over-c22 fallback to the DT PHY
registration code. As described above, the probing is split into the
three phases.

FWIW, this now triggers a bug in mscc-miim. Haven't figured out what's
wrong yet, somehow the status register doesn't return busy/pending.
Currently, working around that with a sleep.

net: phy: add error checks in mmd_phy_indirect() and export it
net: phy: get rid of redundant is_c45 information
net: phy: introduce phy_is_c45()
net: phy: replace is_c45 with phy_accces_mode
net: phy: make the "prevent_c45_scan" a property of the MII bus
net: phy: print an info if a broken C45 bus is found
net: phy: add support for C45-over-C22 transfers
net: phy: introduce phy_promote_to_c45()
net: mdio: add C45-over-C22 fallback to fwnode_mdiobus_register_phy()
net: mdio: scan for broken C22 PHYs when probed via OF

Changes since v1:
 - major rework to address the problem to not use c45-over-c22 on
   bus scanning, see the description above. Except from some preparation
   patches there is little left of the original series. The major
   difference is that there is now a new transport mode argument and the
   c45-over-c22 is not automatically used anymore.
 - Link: https://lore.kernel.org/netdev/20230120224011.796097-1-michael@walle.cc/

Changes since RFC v2:
 - Reased to latest net-next
 - new check_rc argument in mmd_phy_indirect() to retain old behavior
 - determine bus capabilities by bus->read and bus->read_c45
 - always set phydev->c45_over_c22 if PHY is promoted
 - Link: https://lore.kernel.org/netdev/20220325213518.2668832-1-michael@walle.cc/

Changes since RFC v1:
 - use __phy_mmd_indirect() in mdiobus_probe_mmd_read()
 - add new properties has_c45 c45_over_c22 (and remove is_c45)
 - drop MDIOBUS_NO_CAP handling, Andrew is preparing a series to
   add probe_capabilities to mark all C45 capable MDIO bus drivers
 - Link: https://lore.kernel.org/netdev/20220323183419.2278676-1-michael@walle.cc/

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
Michael Walle (10):
      net: phy: add error checks in mmd_phy_indirect() and export it
      net: phy: get rid of redundant is_c45 information
      net: phy: introduce phy_is_c45()
      net: phy: replace is_c45 with phy_accces_mode
      net: phy: make the "prevent_c45_scan" a property of the MII bus
      net: phy: print an info if a broken C45 bus is found
      net: phy: add support for C45-over-C22 transfers
      net: phy: introduce phy_promote_to_c45()
      net: mdio: add C45-over-C22 fallback to fwnode_mdiobus_register_phy()
      net: mdio: support C45-over-C22 when probed via OF

 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c |   8 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c  |   4 +-
 drivers/net/mdio/fwnode_mdio.c                    |  19 ++-
 drivers/net/mdio/of_mdio.c                        |  63 +++++++---
 drivers/net/phy/bcm84881.c                        |   2 +-
 drivers/net/phy/marvell10g.c                      |   2 +-
 drivers/net/phy/mdio_bus.c                        |  33 ++---
 drivers/net/phy/mxl-gpy.c                         |   9 +-
 drivers/net/phy/nxp-tja11xx.c                     |   3 +-
 drivers/net/phy/phy-core.c                        | 105 +++++++++++-----
 drivers/net/phy/phy.c                             |   8 +-
 drivers/net/phy/phy_device.c                      | 139 +++++++++++++++++-----
 drivers/net/phy/phylink.c                         |  10 +-
 drivers/net/phy/sfp.c                             |  12 +-
 include/linux/phy.h                               |  48 ++++++--
 15 files changed, 331 insertions(+), 134 deletions(-)
---
base-commit: 5e218791dc7b2b57c90d5942ab6bae4bc2ab0ead
change-id: 20230620-feature-c45-over-c22-0a2181babd56


             reply	other threads:[~2023-06-23 10:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 10:29 Michael Walle [this message]
2023-06-23 10:29 ` [PATCH net-next v2 01/10] net: phy: add error checks in mmd_phy_indirect() and export it Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 02/10] net: phy: get rid of redundant is_c45 information Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 03/10] net: phy: introduce phy_is_c45() Michael Walle
2023-06-23 17:15   ` Andrew Lunn
2023-06-23 10:29 ` [PATCH net-next v2 04/10] net: phy: replace is_c45 with phy_accces_mode Michael Walle
2023-06-23 17:34   ` Andrew Lunn
2023-06-23 19:54     ` Andrew Lunn
2023-06-26  6:31       ` Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 05/10] net: phy: make the "prevent_c45_scan" a property of the MII bus Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 06/10] net: phy: print an info if a broken C45 bus is found Michael Walle
2023-06-23 17:42   ` Andrew Lunn
2023-06-23 20:35     ` Simon Horman
2023-06-26  6:50       ` Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 07/10] net: phy: add support for C45-over-C22 transfers Michael Walle
2023-06-23 20:43   ` Simon Horman
2023-06-24 20:15   ` Andrew Lunn
2023-06-26  7:14     ` Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 08/10] net: phy: introduce phy_promote_to_c45() Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 09/10] net: mdio: add C45-over-C22 fallback to fwnode_mdiobus_register_phy() Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 10/10] net: mdio: support C45-over-C22 when probed via OF Michael Walle
2023-06-23 20:48   ` Simon Horman
2023-06-26  7:37     ` 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=20230620-feature-c45-over-c22-v2-0-def0ab9ccee2@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=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).