[PATCH net-next 01/12] dt-bindings: net: Add Ethernet MII multiplexers

From: Maxime Chevallier

Date: Fri Dec 04 2026 - 06:07:10 EST


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@xxxxxxxxxxx>
---
.../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@xxxxxxxxxxx>
+
+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@xxxxxxxxxxx>
+
+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@xxxxxxxxxxx>
+L: netdev@xxxxxxxxxxxxxxx
+S: Maintained
+F: Documentation/devicetree/bindings/net/mii-mux*.yaml
+
EXEC & BINFMT API, ELF
M: Kees Cook <kees@xxxxxxxxxx>
L: linux-mm@xxxxxxxxx
--
2.56.1