phylink and an unusual PHY/SFP setup
Subsystems (2)
Hi,
I have a board with a rather unusual network link setup:
MAC/PCS (fman) <-SerDes-> PHY (M88E1112) <-SerDes-> SFP
or even
MAC/PCS (fman) <-SerDes-> PHY (M88E1112) <-SerDes-> Copper SFP with PHY
Does phylink support such a configuration? I suspect adding support for such a configuration isn't straight forward.
FWIW, the M88E1112 PHY driver seems to be completely broken in upstream. It looks like it was assumed, that it's like the M88E1111. But that one only has 1 SerDes and one parallel interface. The 1112 has two SerDes interfaces and thus a completely different register map. I'm not sure it ever worked, except maybe by accident for the SGMII-to-Copper case.
-michael
Quoted 9 lines · Michael Walle
Hi,
I have a board with a rather unusual network link setup:
MAC/PCS (fman) <-SerDes-> PHY (M88E1112) <-SerDes-> SFP
or even
MAC/PCS (fman) <-SerDes-> PHY (M88E1112) <-SerDes-> Copper SFP with PHY
Such setups do exist already, but with a different PHY. The Marvel 10G PHY is sometimes placed in the middle like this. And there are other PHYs.
Take a look at
commit 35d1a5464b476aa98b7b76ce41bb4de748cebfc2
Author: Maxime Chevallier <[email protected]> Date: Thu Jan 8 09:00:35 2026 +0100
net: phy: marvell10g: Support SFP through phy_port
Convert the Marvell10G driver to use the generic SFP handling, through a dedicated .attach_port() handler to populate the port's supported interfaces.
As the 88x3310 supports multiple MDI, the .attach_port() logic handles both SFP attach with 10GBaseR support, and support for the "regular" port that usually is a BaseT port.
Also, marvell-88x2222.c.
Andrew
Hi Andrew,
Quoted 27 lines · Andrew Lunn
Quoted 9 lines · Michael Walle
Hi,
I have a board with a rather unusual network link setup:
MAC/PCS (fman) <-SerDes-> PHY (M88E1112) <-SerDes-> SFP
or even
MAC/PCS (fman) <-SerDes-> PHY (M88E1112) <-SerDes-> Copper SFP with PHY
Such setups do exist already, but with a different PHY. The Marvel 10G PHY is sometimes placed in the middle like this. And there are other PHYs.
Take a look at
commit
35d1a5464b476aa98b7b76ce41bb4de748cebfc2Author: Maxime Chevallier <[email protected]> Date: Thu Jan 8 09:00:35 2026 +0100net: phy: marvell10g: Support SFP through
phy_portConvert the Marvell10G driver to use the generic SFP handling, through a dedicated .attach_port() handler to populate the port's supported interfaces.
Quoted 7 lines
As the 88x3310 supports multiple MDI, the .attach_port() logic handles both SFP attach with 10GBaseR support, and support for the "regular" port that usually is a BaseT port.
Also,
marvell-88x2222.c.Andrew
Thanks for the pointer. It looks like this can be used to support both the Base-T port and the SerDes port of this PHY.
But I'm still trying to wrap my head around the SerDes links and it's configuration. Basically, phylink tries to match both ends of the link and will configure the PCS and the PHY accordingly. But in my case, the link between the MAC/PCS and the PHY is always SGMII (at least that's what the Marvell datasheet says). The line side of the PHY is then either Base-T if using the copper port or 1000Base-X, 100Base-FX or SGMII on the fiber port.
If I add these modes to the possible_interfaces property, the PCS might be configured wrong, that is, in 1000Base-X mode for example. But it really should only be ever in SGMII mode.
-michael
Quoted 11 lines
Thanks for the pointer. It looks like this can be used to support both the Base-T port and the SerDes port of this PHY.
But I'm still trying to wrap my head around the SerDes links and it's configuration. Basically, phylink tries to match both ends of the link and will configure the PCS and the PHY accordingly. But in my case, the link between the MAC/PCS and the PHY is always SGMII (at least that's what the Marvell datasheet says). The line side of the PHY is then either Base-T if using the copper port or 1000Base-X, 100Base-FX or SGMII on the fiber port.
Quoted 3 lines
If I add these modes to the
possible_interfacesproperty, the PCS might be configured wrong, that is, in 1000Base-X mode for example. But it really should only be ever in SGMII mode.
You have something like rate adaptation for the PCS-PHY link.
This is something you sometimes see for multigigi PHYs, where the MAC-PHY can uses a fixed mode, e.g. 10GBaseR, independent of what the media does. Pause frames are then used to slow down the MAC to the media speed. So it might be you can abuse rate adaptation to do what you need.
What could play a role here is, if the media is running at 100Mbps does the MAC need to know to use SGMII at 100Mbps? This is different to rate adaptation, where the MAC is fixed. Also, if it is using 100Base-FX, does it want the SGMII to run a 100Mbps?
So rate adaptation might not help. But the phylink code around rate adaption might give you some ideas how you can handle this.
Andrew