From: Daniel Golle <daniel@makrotopia.org>
To: Bo-Cun Chen <bc-bocun.chen@mediatek.com>,
Chad Monroe <chad.monroe@adtran.com>,
John Crispin <john@phrozen.org>,
maxime.chevallier@bootlin.com,
"Russell King (Oracle)" <linux@armlinux.org.uk>,
Vladimir Oltean <olteanv@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"Chester A. Unal" <chester.a.unal@arinc9.com>,
Daniel Golle <daniel@makrotopia.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>,
netdev@vger.kernel.org
Subject: upstream Linux support for Ethernet combo ports via external mux
Date: Mon, 10 Feb 2025 23:11:07 +0000 [thread overview]
Message-ID: <Z6qHi1bQZEnYUDp7@makrotopia.org> (raw)
Hi,
Looking for ways to support a passive SerDes mux in vanilla Linux I
found Maxime's slides "Multi-port and Multi-PHY Ethernet interfaces"[1].
The case I want to support is probably quite common nowadays but isn't
covered there nor implemented in Linux.
+----------------------------+
| SoC |
| +-----------------+ |
| | MAC | |
| +----+-------+----+ |
| | PCS | +------+
| +---=---+ | GPIO |
+-------------=-------+---=--+
| |
+---=---+ |
| Mux <-------+
+-=---=-+
| |
/ \
+-----=-+ +-=-----+
| PHY | | SFP |
+-------+ +-------+
So other than it was when SoCs didn't have built-in PCSs, now the SFP is
not connected to the PHY, but there is an additional mux IC controlled
by the SoC to connect the serialized MII either to the PHY (in case no
SFP is inserted) or to the SFP (in case a module is inserted).
MediaTek came up with a vendor-specific solution[2] for that which works
well -- but obviously it would be much nicer to have generic, vendor-
agnostic support for such setups in phylink, ideally based on the
existing gpio-mux driver.
So I imagine something like a generic phylink-mux, controlled by hooking
to the module_insert and module_remove remove SFP ops (assuming the
moddef0 signal is connected...).
Before I get my hands dirty, please join my line of thought for one
moment, so we can agree on a sketch:
Does everyone agree that phylink would be the right place to do this?
DT bindings could look like this (option A):
...
mux: mux-controller {
compatible = "gpio-mux";
#mux-control-cells = <0>;
mux-gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
};
mux0: mii-mux {
compatible = "mii-mux";
mux-controls = <&mux>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
sfp = <&sfp0>;
managed = "in-band-status";
module-presence-controls-mux;
};
channel@1 {
reg = <1>;
phy-handle = <&phy0>;
phy-connection-type = "sgmii";
};
};
};
soc {
ethernet@12340000 {
mii-mux = <&mux0>;
};
};
or like this (option B):
...
mux: mux-controller {
compatible = "gpio-mux";
#mux-control-cells = <0>;
mux-gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
};
};
soc {
ethernet@12340000 {
sfp = <&sfp0>;
phy = <&phy0>;
phy-connection-type = "sgmii";
mux-controls = <&mux>;
};
};
Obviously option A is more expressive, but also more complex, and I'm
not 100% sure if all that complexity is really needed in practise.
However, for "better safe than sorry" reasons I'd opt for option A,
unless anyone comes up with a better idea.
Let me know what you think.
Cheers
Daniel
[1]: https://netdevconf.org/0x17/docs/netdev-0x17-paper2-talk-slides/multi-port-multi-phy-interfaces.pdf
[2]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/refs/heads/master/autobuild/unified/global/24.10/files/target/linux/mediatek/patches-6.6/999-2708-net-ethernet-mtk_eth_soc-support-ethernet-passive-mu.patch
next reply other threads:[~2025-02-10 23:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 23:11 Daniel Golle [this message]
2025-02-10 23:43 ` upstream Linux support for Ethernet combo ports via external mux Andrew Lunn
2025-02-11 8:15 ` 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=Z6qHi1bQZEnYUDp7@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bc-bocun.chen@mediatek.com \
--cc=chad.monroe@adtran.com \
--cc=chester.a.unal@arinc9.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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;
as well as URLs for NNTP newsgroup(s).