Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net, "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Willem de Bruijn" <willemb@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Marek Behún" <kabel@kernel.org>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	thomas.petazzoni@bootlin.com, devicetree@vger.kernel.org,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Herve Codina" <herve.codina@bootlin.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Köry Maincent" <kory.maincent@bootlin.com>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Nicolò Veronese" <nicveronese@gmail.com>,
	"Simon Horman" <horms@kernel.org>,
	marcin.s.wojtas@gmail.com, "Daniel Golle" <daniel@makrotopia.org>,
	"Dimitri Fedrau" <dimitri.fedrau@liebherr.com>,
	"Frank Wunderlich" <frank.wunderlich@linux.dev>,
	"Pietro Ameruoso" <p.ameruoso@live.it>,
	"Aleksei Sviridkin" <f@lex.la>
Subject: [PATCH net-next 01/12] dt-bindings: net: Add Ethernet MII multiplexers
Date: Fri,  4 Dec 2026 12:06:10 +0100	[thread overview]
Message-ID: <20261204110622.1106492-2-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20261204110622.1106492-1-maxime.chevallier@bootlin.com>

It's not unusual for network equipment to have some flavors of "combo
ports", where multiple physical connectors are available for one single
network interface.

Usually it's for SFP and RJ45 ports and in such a case, only one port
can be used at any point in time.

There are numerous ways to implement this in hardware. It can be a
gpio-driven multiplexer, a small glue in the SoC, inside an ethernet
PHY, etc.

The simplest form of that multiplexer lets the hardware select the
port in use, without any software way to control it. This is the case
on the Turris Omnia, where the mux is controlled by a GPIO directly
connected to the SFP cage's mod_def0 signal. When a module is inserted,
the mux automatically switches to the SFP cage.

Introduce a binding for MII muxes, for now only for the automatic
muxes. The Ethernet controller has a mii-mux-handle property, pointing
to the new mux node.

This node has a compatible, as it may use dedicated drivers to control
it, and lists all the ports of the mux.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 .../bindings/net/ethernet-controller.yaml     |  6 ++
 .../devicetree/bindings/net/mii-mux-auto.yaml | 89 +++++++++++++++++++
 .../devicetree/bindings/net/mii-mux.yaml      | 74 +++++++++++++++
 MAINTAINERS                                   |  6 ++
 4 files changed, 175 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mii-mux-auto.yaml
 create mode 100644 Documentation/devicetree/bindings/net/mii-mux.yaml

diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index 30b2a335116e..e2836351cd7a 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -100,6 +100,12 @@ properties:
     description:
       Specifies a reference to a node representing a PHY device.
 
+  mii-mux-handle:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Specifies a reference to a node representing an Ethernet MII
+      multiplexer.
+
   phy:
     $ref: "#/properties/phy-handle"
     deprecated: true
diff --git a/Documentation/devicetree/bindings/net/mii-mux-auto.yaml b/Documentation/devicetree/bindings/net/mii-mux-auto.yaml
new file mode 100644
index 000000000000..7a965f6e8dcc
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mii-mux-auto.yaml
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/mii-mux-auto.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ethernet MII multiplexer switched by the hardware
+
+maintainers:
+  - Maxime Chevallier <maxime.chevallier@bootlin.com>
+
+description:
+  A two-port Ethernet MII multiplexer that the hardware switches by itself,
+  without any software control.
+
+allOf:
+  - $ref: mii-mux.yaml#
+
+properties:
+  compatible:
+    const: mii-mux-auto
+
+patternProperties:
+  "^port@[0-9a-f]+$":
+    $ref: mii-mux.yaml#/$defs/port
+    unevaluatedProperties: false
+
+    properties:
+      takes-precedence:
+        type: boolean
+        description:
+          The multiplexer switches to this port by itself as soon as the
+          port gets active, whatever the state of the other port.
+
+required:
+  - compatible
+  - port@0
+  - port@1
+
+oneOf:
+  - properties:
+      port@0:
+        required:
+          - takes-precedence
+  - properties:
+      port@1:
+        required:
+          - takes-precedence
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    ethernet {
+        phy-mode = "sgmii";
+        mii-mux-handle = <&mii_mux>;
+
+        mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            phy0: ethernet-phy@0 {
+                reg = <0>;
+            };
+        };
+    };
+
+    mii_mux: mii-mux {
+        compatible = "mii-mux-auto";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@0 {
+            reg = <0>;
+            sfp = <&sfp0>;
+            takes-precedence;
+        };
+
+        port@1 {
+            reg = <1>;
+            phy-handle = <&phy0>;
+            phy-mode = "sgmii";
+        };
+    };
+
+    sfp0: sfp {
+        compatible = "sff,sfp";
+        i2c-bus = <&i2c0>;
+    };
diff --git a/Documentation/devicetree/bindings/net/mii-mux.yaml b/Documentation/devicetree/bindings/net/mii-mux.yaml
new file mode 100644
index 000000000000..cbd99251f460
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mii-mux.yaml
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/mii-mux.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ethernet MII multiplexer
+
+maintainers:
+  - Maxime Chevallier <maxime.chevallier@bootlin.com>
+
+description: |
+  An Ethernet MII multiplexer sits between one Ethernet MAC and several
+  Ethernet PHYs or SFP cages that share the MAC's MII, only one of them
+  being usable at a time.
+
+select: false
+
+properties:
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^port@[0-9a-f]+$":
+    $ref: "#/$defs/port"
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: true
+
+$defs:
+  port:
+    type: object
+
+    properties:
+      reg:
+        maxItems: 1
+        description:
+          The port number.
+
+      phy-handle:
+        $ref: /schemas/types.yaml#/definitions/phandle
+        description:
+          The Ethernet PHY reached through this port.
+
+      phy-mode:
+        $ref: ethernet-controller.yaml#/properties/phy-connection-type
+        description:
+          The MII mode used between the MAC and this PHY.
+
+      sfp:
+        $ref: /schemas/types.yaml#/definitions/phandle
+        description:
+          The SFP cage reached through this port.
+
+    required:
+      - reg
+
+    oneOf:
+      - required:
+          - phy-handle
+          - phy-mode
+        properties:
+          sfp: false
+      - required:
+          - sfp
+        properties:
+          phy-handle: false
+          phy-mode: false
diff --git a/MAINTAINERS b/MAINTAINERS
index bfa5a7248973..8685ed44840a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10081,6 +10081,12 @@ S:	Maintained
 F:	rust/kernel/net/phy.rs
 F:	rust/kernel/net/phy/reg.rs
 
+ETHERNET PHY MUX
+M:	Maxime Chevallier <maxime.chevallier@bootlin.com>
+L:	netdev@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/mii-mux*.yaml
+
 EXEC & BINFMT API, ELF
 M:	Kees Cook <kees@kernel.org>
 L:	linux-mm@kvack.org
-- 
2.56.1



  reply	other threads:[~2026-12-04 11:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:06 [PATCH net-next 00/12] net: phy: Introduce MII multiplexers Maxime Chevallier
2026-12-04 11:06 ` Maxime Chevallier [this message]
2026-12-04 11:06 ` [PATCH net-next 02/12] net: phy: Introduce phy_mux, a MII multiplexer representation Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 03/12] net: phy: Don't create the sysfs links for PHYs behind a mux Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 04/12] net: phy: phy_mux: Allow attaching a mux to a net_device Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 05/12] net: phy: phy_mux: Add port selection logic Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 06/12] net: phy: phy_mux: Support SFP cage ports Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 07/12] net: phylink: Factor out phylink_clear_phydev() Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 08/12] net: phy: phy_mux: Add phy_mux_set_mac_managed_pm() Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 09/12] net: phylink: Support PHYs reached through a phy_mux Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 10/12] net: phylink: Support an SFP cage behind " Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 11/12] net: phy: mux: Add the mii-mux-auto driver Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 12/12] ARM: dts: turris-omnia: Describe the WAN port multiplexer Maxime Chevallier

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=20261204110622.1106492-2-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dimitri.fedrau@liebherr.com \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=f@lex.la \
    --cc=frank.wunderlich@linux.dev \
    --cc=gregory.clement@bootlin.com \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kabel@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicveronese@gmail.com \
    --cc=o.rempel@pengutronix.de \
    --cc=p.ameruoso@live.it \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=willemb@google.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