From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.171.202.116 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382418; b=5Gi4k2pHdMx/qTlZN7k6QUx1DnBxMMP7QJRl8Ce2p++OQS9KkpnwbL5DhJ7EcRRNSgLd sDh94tbRniK/GCeO5Hb2+9cn2LSKkR+Aod1qmmFHo3e2+OJkzEC1VGo0/zdFGngnchcqi usFzdOdv2l13Jih4AFPpZLVfuObViymuyk+kyuVWLqdVSwRnMujA3pDWvQNzvFyeoR1Jy 0z+cvPsuyRl2Y+hW408+a7RBy4e88ROqzS/PO9A4xcH5qcdLoCcLpMU3J8A/qijmC65lh Ive4JXu1LCQv0AdHj/vhMxEc5n7kO+gM5fi/zxEuApSw25n6dG4km1EJrVH7aab+Hgw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382418; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=4v77PpMHNu8ey0T6UM8aK6oo6Od9m9h6DniRCHvxLXQ=; b=0n8OVeEHBHdD56zWQF26GvaqOl9v0YSRXz/bDgA2jV+nKDjY1twaUbON8ZzOY0MCHyRV 6/Bc3fRvDItSBYYXpH0INU6WG88S488K3DgyJ5PGT6+wcR/cwc7WlEiSV52wWvc0uLkIV MTnkR/9595iBq2r3VRmOPZu2oZ+lfdFvrdydcTxnLSNWZT9dxS/RmYtrcLNCUdJiMH2Zp l5YHO/ZUd02zQOdfrig7pICBl0+oEwEtOO99rKWGTofdMsyo+GwQd991H0tPe+r0TDFQb FMfEoR5kso0aI3CXziNfleUibnHxjV4+j2t/fRi9V/eJiaiu/RU+mfOhwttgktT1t9g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=UnGDnKBu; arc=none smtp.remote-ip=185.171.202.116 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB6C3606A32F for ; Fri, 4 Dec 2026 11:06:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CB6C3606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=UnGDnKBu Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id EB267C026D7; Fri, 4 Dec 2026 11:07:06 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1D474603C4; Fri, 4 Dec 2026 11:06:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 488CC11EA18ED; Fri, 04 Dec 2026 12:06:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796382411; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=4v77PpMHNu8ey0T6UM8aK6oo6Od9m9h6DniRCHvxLXQ=; b=UnGDnKBuKGrL95AxrjGYPC96wEyo6BiRR1tb63YJZv8XyExQjCIC2sNcnoEvNT6bPejAE4 d8UZiuEUq0BFpAJ/oBZofk0i25Qz2rG9bRFNsUMGrguVC0zFEYaUbQoxgpqOHmkUUD35rg ywf7yq7kFU6jZ9gGf6eBBvqe+4okv6vcknGhZWA1DAjiAw6hL29WjACEUCQ/9qzAFO0liM ICPPWZLP765qF+xCraLp0b1Q382iCHxlyyFb3+l8UGTxi+6kK1n5OcKpbbyJfN7sgZzsTy FxCpTXzE8rJKswX8u8ZCgbgcVPAPV3UjBkn8tfHiH7iU+ZJcFb8SUTT5X8Dyvg== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Willem de Bruijn , Paolo Abeni , Russell King , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Sebastian Hesselbarth , Gregory Clement , Heiner Kallweit Cc: Maxime Chevallier , 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 , Krzysztof Kozlowski , Rob Herring , Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , marcin.s.wojtas@gmail.com, Daniel Golle , Dimitri Fedrau , Frank Wunderlich , Pietro Ameruoso , Aleksei Sviridkin Subject: [PATCH net-next 01/12] dt-bindings: net: Add Ethernet MII multiplexers Date: Fri, 4 Dec 2026 12:06:10 +0100 Message-ID: <20261204110622.1106492-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> References: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 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 --- .../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 + +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 + +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 +L: netdev@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/net/mii-mux*.yaml + EXEC & BINFMT API, ELF M: Kees Cook L: linux-mm@kvack.org -- 2.56.1