From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D6D81606A32C for ; Fri, 4 Dec 2026 11:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fbHGK6zO; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=UnGDnKBu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=4v77PpMHNu8ey0T6UM8aK6oo6Od9m9h6DniRCHvxLXQ=; b=fbHGK6zOujcEVK IjTB9/2PdgQn0asMcexl9OpiY9qToj2Gtj3/bqxuf0IyIaFwCxNMONkw50AzUMzClUlX6QATC8Nuh 9t4utQDTBYG46UfShLO3+3+PcxtyAK6vJ/aT6FjUJdMaAbA95p9IO8E+gK36g2E9wI4WpKB5AZUmQ N4rv6flGSbxItlVg/FU4mX3nACulKoLm2B7D1h+YulIkaxy1g4nIRmzBNmXUFZbJ2pK+cFKA/2Xkk WCzeX1s3VzmyaBTO4Jg5ux9FFL++kIKKeHBd63hOLwlb/Omc5kvXZh94cNugvEF7LasZ7liDfuL3p e5dn79pcGnW7oj9FC5Wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZR8J-000000004Fg-34vm; Fri, 04 Dec 2026 11:07:19 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZR7z-000000004D7-2dVY for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 11:07:02 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4E8BA4E4185D; Fri, 4 Dec 2026 11:06:55 +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-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_030700_104641_7BDA7872 X-CRM114-Status: GOOD ( 20.84 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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