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 E25D5606A32C for ; Fri, 4 Dec 2026 11:07:35 +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=QqI1WxmG; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=TLTZKgXX 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: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:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=2E0s/HxsrMhLBwZAibFEQ2//Wyh8mHVot/nuWXTaOr4=; b=QqI1WxmGHGUyfEllDjqqYsmG1t E5sGLD1WKduzh70y1J6vel3CfAM8V8SC+ZdxuqzQbHTwr/8yw9TOKyZOqSWR39qv9ckhsFbsbpSxh wzTn03Zr71eunzrMMdpGu4Lp2B2hbwrch/1QXAZfKCOWxxAmpximruREwfcNdWy/Yv34mb9RJzzBl dUIRbI9oIe0jsKeIHVatqv4T0zQtpavlM03/6xWeeUdcWXN4l6wlRS8+Un1W8R6hrRZbu94TCj2d/ uMcyYfoUYr+n2KeylUOAEJHdS/oc/8uCNXSubGck7hEIZVQooIRPryjxYSyJreKW2IhjrBLGNIYd5 AjvpaOwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZR86-000000004EQ-0pNJ; Fri, 04 Dec 2026 11:07:10 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZR7z-000000004D3-2cVO for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 11:07:01 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id AD2D01A1949; Fri, 4 Dec 2026 11:06:47 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6C58F6088A; Fri, 4 Dec 2026 11:06:47 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E2E6E11EA187F; Fri, 04 Dec 2026 12:06:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796382402; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=2E0s/HxsrMhLBwZAibFEQ2//Wyh8mHVot/nuWXTaOr4=; b=TLTZKgXXcoNSgz5RbGb/U6chjY3o3ksJx5heHbDtmQ8CtCx768MpYr0yYPnt1SB/9KDfSC KXwOpd09JPSTCHlTmu788Qmxe1nUYnVZkRGGMtn4m5F5uOG1ugVMytxMg03HbIO8olXWbh Ljp2AEif3KcMTp3Kb/uV/vr8I3nZFcQ01PDBOJTkfPuQcyJz9Vf0X2nBg3IuaGqiQ41yU7 XSn2HjZltvy54f4wiP3rSYN1x5NfB4FZgtfT6j6kTpN7bTSCy2U2hw9hI0h20hti1eUIaY fNjkP9gAuAUOoI89An8gosJcU0jVUIxAmc1guUlTL97kEODHlx6HiFdTjhg2nA== 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 00/12] net: phy: Introduce MII multiplexers Date: Fri, 4 Dec 2026 12:06:09 +0100 Message-ID: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.56.1 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_136091_E637ECC4 X-CRM114-Status: GOOD ( 17.00 ) 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=-14.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_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 Hi everyone, 3 years after pitching the idea at Netdevconf Vancouver, this is V1 of a framework to deal with multiplexed MII interfaces. - What we want to do: The end-goal is to support multi-port ethernet interfaces. There are multiple use-cases for that, the most common one is combo-port: /-- RJ45 MAC ---X \-- SFP To achieve this, we can use several HW designs: 1 : Use a physical switch on the MII path: PHY xMII / MAC --- Mux \ SFP This is what we find on Turris Omnia for instance. Here, the switch is driven directly by the onboard electronics, it's connected to the SFP's mod_def0 signal, and we can't switch it at all from Linux. 2 : Use a multiplexer in the SoC: /-- xMII -- PHY MAC -- MUX \-- xMII -- SFP This is what we have on Banana Pi R4 I believe. 3 : Use a PHY that contains a Mux: xMII /---SFP MAC ---- PHY \-- RJ45 This is what we have on Machhiatobin for example. - What we do here: To make this "digestable" (well, it's already 12 patches, here goes my netdev budget), this series adds the easiest case: The first one. This allows adding the core mux infrastructure, the bindings, a small driver and demonstrating that on upstream supported HW. Because the HW does the switching, this series does NOT include the logic to drive a mux from userspace. This will come later. With this series, we can now use both WAN ports on omnia :) - What we don't do here, but will do next: Next step is to add some uAPI path to drive that, this will be done with the phy_port API. end users don't care about the HW design, they want to select the port to use, and phy_port represents them already. The example for that will be mcbin. Finally, we'll add driveable MII muxes (for bpi r4 and others). This was tested on Omnia. Note that patch 12 should likely go through the mvebu tree. Thanks, Maxime Maxime Chevallier (12): dt-bindings: net: Add Ethernet MII multiplexers net: phy: Introduce phy_mux, a MII multiplexer representation net: phy: Don't create the sysfs links for PHYs behind a mux net: phy: phy_mux: Allow attaching a mux to a net_device net: phy: phy_mux: Add port selection logic net: phy: phy_mux: Support SFP cage ports net: phylink: Factor out phylink_clear_phydev() net: phy: phy_mux: Add phy_mux_set_mac_managed_pm() net: phylink: Support PHYs reached through a phy_mux net: phylink: Support an SFP cage behind a phy_mux net: phy: mux: Add the mii-mux-auto driver ARM: dts: turris-omnia: Describe the WAN port multiplexer .../bindings/net/ethernet-controller.yaml | 6 + .../devicetree/bindings/net/mii-mux-auto.yaml | 89 +++ .../devicetree/bindings/net/mii-mux.yaml | 74 ++ MAINTAINERS | 9 + .../dts/marvell/armada-385-turris-omnia.dts | 29 +- drivers/net/phy/Kconfig | 10 + drivers/net/phy/Makefile | 2 + drivers/net/phy/mux/Kconfig | 18 + drivers/net/phy/mux/Makefile | 3 + drivers/net/phy/mux/mii_mux_auto.c | 99 +++ drivers/net/phy/phy_device.c | 3 +- drivers/net/phy/phy_mux.c | 698 ++++++++++++++++++ drivers/net/phy/phylink.c | 264 ++++++- include/linux/phy.h | 3 + include/linux/phy_mux.h | 147 ++++ 15 files changed, 1423 insertions(+), 31 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/mii-mux-auto.yaml create mode 100644 Documentation/devicetree/bindings/net/mii-mux.yaml create mode 100644 drivers/net/phy/mux/Kconfig create mode 100644 drivers/net/phy/mux/Makefile create mode 100644 drivers/net/phy/mux/mii_mux_auto.c create mode 100644 drivers/net/phy/phy_mux.c create mode 100644 include/linux/phy_mux.h -- 2.56.1