From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>, "Andrew Lunn" <andrew@lunn.ch>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Luiz Angelo Daros de Luca" <luizluca@gmail.com>,
"Alvin Šipraga" <alsi@bang-olufsen.dk>,
"Madhuri Sripada" <madhuri.sripada@microchip.com>,
"Marcin Wojtas" <mw@semihalf.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Tobias Waldekranz" <tobias@waldekranz.com>,
"Arun Ramadoss" <arun.ramadoss@microchip.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"Jonathan Corbet" <corbet@lwn.net>
Subject: [PATCH net 3/4] docs: net: dsa: update user MDIO bus documentation
Date: Fri, 8 Dec 2023 21:35:17 +0200 [thread overview]
Message-ID: <20231208193518.2018114-4-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20231208193518.2018114-1-vladimir.oltean@nxp.com>
There are people who are trying to push the ds->user_mii_bus feature
past its sell-by date. I think part of the problem is the fact that the
documentation presents it as this great functionality.
Adapt it to 2023, where we have phy-handle to render it useless, at
least with OF.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Documentation/networking/dsa/dsa.rst | 36 ++++++++++++++++++++++------
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/Documentation/networking/dsa/dsa.rst b/Documentation/networking/dsa/dsa.rst
index 676c92136a0e..2cd91358421e 100644
--- a/Documentation/networking/dsa/dsa.rst
+++ b/Documentation/networking/dsa/dsa.rst
@@ -397,19 +397,41 @@ perspective::
User MDIO bus
-------------
-In order to be able to read to/from a switch PHY built into it, DSA creates an
-user MDIO bus which allows a specific switch driver to divert and intercept
-MDIO reads/writes towards specific PHY addresses. In most MDIO-connected
-switches, these functions would utilize direct or indirect PHY addressing mode
-to return standard MII registers from the switch builtin PHYs, allowing the PHY
-library and/or to return link status, link partner pages, auto-negotiation
-results, etc.
+The framework creates an MDIO bus for user ports (``ds->user_mii_bus``) when
+both methods ``ds->ops->phy_read()`` and ``ds->ops->phy_write()`` are present.
+However, this pointer may also be populated by the switch driver during the
+``ds->ops->setup()`` method, with an MDIO bus managed by the driver.
+
+Its role is to permit user ports to connect to a PHY (usually internal) when
+the more general ``phy-handle`` property is unavailable (either because the
+MDIO bus is missing from the OF description, or because probing uses
+``platform_data``).
+
+In most MDIO-connected switches, these functions would utilize direct or
+indirect PHY addressing mode to return standard MII registers from the switch
+builtin PHYs, allowing the PHY library and/or to return link status, link
+partner pages, auto-negotiation results, etc.
For Ethernet switches which have both external and internal MDIO buses, the
user MII bus can be utilized to mux/demux MDIO reads and writes towards either
internal or external MDIO devices this switch might be connected to: internal
PHYs, external PHYs, or even external switches.
+When using OF, the ``ds->user_mii_bus`` can be seen as a legacy feature, rather
+than core functionality. Since 2014, the DSA OF bindings support the
+``phy-handle`` property, which is a universal mechanism to reference a PHY,
+be it internal or external.
+
+New switch drivers are encouraged to require the more universal ``phy-handle``
+property even for user ports with internal PHYs. This allows device trees to
+interoperate with simpler variants of the drivers such as those from U-Boot,
+which do not have the (redundant) fallback logic for ``ds->user_mii_bus``.
+
+The only use case for ``ds->user_mii_bus`` in new drivers would be for probing
+on non-OF through ``platform_data``. In the distant future where this will be
+possible through software nodes, there will be no need for ``ds->user_mii_bus``
+in new drivers at all.
+
Data structures
---------------
--
2.34.1
next prev parent reply other threads:[~2023-12-08 19:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 19:35 [PATCH net 0/4] Add some history to the DSA documentation Vladimir Oltean
2023-12-08 19:35 ` [PATCH net 1/4] docs: net: dsa: document the tagger-owned storage mechanism Vladimir Oltean
2023-12-08 22:15 ` Linus Walleij
2023-12-08 22:32 ` Florian Fainelli
2023-12-10 13:37 ` Alvin Šipraga
2023-12-08 19:35 ` [PATCH net 2/4] docs: net: dsa: update platform_data documentation Vladimir Oltean
2023-12-08 22:19 ` Linus Walleij
2023-12-09 0:52 ` Vladimir Oltean
2023-12-08 22:33 ` Florian Fainelli
2023-12-10 13:37 ` Alvin Šipraga
2023-12-08 19:35 ` Vladimir Oltean [this message]
2023-12-08 22:22 ` [PATCH net 3/4] docs: net: dsa: update user MDIO bus documentation Linus Walleij
2023-12-08 22:36 ` Florian Fainelli
2023-12-09 1:22 ` Vladimir Oltean
2023-12-09 21:49 ` Linus Walleij
2023-12-10 13:48 ` Alvin Šipraga
2023-12-11 14:35 ` Vladimir Oltean
2023-12-13 5:30 ` Luiz Angelo Daros de Luca
2023-12-13 12:06 ` Vladimir Oltean
2023-12-08 19:35 ` [PATCH net 4/4] docs: net: dsa: replace TODO section with info about history and devel ideas Vladimir Oltean
2023-12-08 22:40 ` Linus Walleij
2023-12-08 23:03 ` Florian Fainelli
2023-12-09 1:58 ` Vladimir Oltean
2023-12-11 17:29 ` Florian Fainelli
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=20231208193518.2018114-4-vladimir.oltean@nxp.com \
--to=vladimir.oltean@nxp.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=luizluca@gmail.com \
--cc=madhuri.sripada@microchip.com \
--cc=mw@semihalf.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=tobias@waldekranz.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