[PATCH net-next 0/6] net: sfp: Add support for SGMII to 100FX modules

Maxime Chevallier posted 6 patches 3 weeks, 2 days ago
drivers/net/mdio/mdio-i2c.c   | 12 +++--
drivers/net/phy/broadcom.c    | 94 +++++++++++++++++++++++++++++++++++
drivers/net/phy/phy-caps.h    |  5 ++
drivers/net/phy/phy_caps.c    | 47 ++++++++++++++++++
drivers/net/phy/phylink.c     | 24 +++------
drivers/net/phy/sfp-bus.c     | 11 ++++
drivers/net/phy/sfp.c         | 31 +++++++++++-
include/linux/mdio/mdio-i2c.h |  1 +
include/linux/phy.h           |  4 ++
9 files changed, 207 insertions(+), 22 deletions(-)
[PATCH net-next 0/6] net: sfp: Add support for SGMII to 100FX modules
Posted by Maxime Chevallier 3 weeks, 2 days ago
Hi everyone,

This series is an attempt to add support for _some_ SGMII to 100BaseFX
SFP modules. Getting these to work was a bit challenging, and none of that
could have been done without the precious help from Florian [1].

[1] : https://lore.kernel.org/netdev/20250624233922.45089b95@fedora.home/

Thanks again :)

These modules are quite useful, as some MACs can output SGMII and 1000BaseX,
but can't do 100BaseFX. Should anyone want to connect such a device to a
100FX link-partner, they need to either use an external media-converter,
or an SFP module that has a built-in PHY for that.

SGMII can convey 100M link, but the clock speed stays at 1.25GHz. A
100FX link is clocked at 125MHz, hence the media-converter in the
middle.

As this is something I had to get working, I got my hands on 4 such SFP
modules :

 - A "Cisco-compatible" Prolabs module : "CISCO-PROLABS GLC-GE-100FX-C"
 - A "Generic" Prolabs module : "PROLABS SFP-GE-100FX-C"
 - A FS module : "FS SFP-GE-100FX"
 - A Phoenix Contact module : "PHOENIX CONTACT 2891081"

Out of these, the 2 Prolabs and the FS module contain a Broadcom BCM5461
PHY. Out-of-the-box, they don't work, but thanks to Florian's help I was
able to get the Cisco-Prolabs and the FS one to work.

I couldn't get the Generic Prolabs to work, even though the PHY is
detected and accessible. As for the Phoenix Contact one, I don't know
which PHY it contains, and I couldn't get anything out of it.

This series therefore brings support for the "Cisco-compatible" Prolabs, and the
FS one.

Some oddities were discovered along the way. Some modules are missing
the 100_fx bit in their EEPROM. Even stranger, trying to access the
BCM5461 PHY with regular mdio-i2c accesses causes the PHY to freeze and
get the i2c bus in an unrecoverable stuck state. However, accessing them
in single-byte mdio-i2c accesses does work !

Another thing that needed to be addressed is the SFP interface
selection, that expected that 100FX modules would be using the
PHY_INTERFACE_MODE_100BASEX mode. That's addressed by patch 2, and I'd
really like some feedback from Russell there, I may be breaking things
:(

All in all, this series contains a lot of hacks, but for such peculiar
modules one could expect that this wouldn't fit the current model.

This was tested on 3 different MACs :
 - The KSZ9477's SGMII port (old version of xpcs)
 - The Macchiatobin's eth3 port (mvpp2 + Marvell PCS)
 - A Cyclone V Socfpga device (stmmac + Lynx PCS)

Thank you,

Maxime

Maxime Chevallier (6):
  net: sfp: Add support for SGMII to 100FX modules
  net: phylink: Allow more interfaces in SFP interface selection
  net: phy: Store module caps for PHYs embedded in SFP
  net: phy: broadcom: Support SGMII to 100FX on BCM5461
  net: mdio: mdio-i2c: Add single-byte C22 MDIO protocol
  net: sfp: Add support for some BCM5461-based SGMII to 100FX modules

 drivers/net/mdio/mdio-i2c.c   | 12 +++--
 drivers/net/phy/broadcom.c    | 94 +++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy-caps.h    |  5 ++
 drivers/net/phy/phy_caps.c    | 47 ++++++++++++++++++
 drivers/net/phy/phylink.c     | 24 +++------
 drivers/net/phy/sfp-bus.c     | 11 ++++
 drivers/net/phy/sfp.c         | 31 +++++++++++-
 include/linux/mdio/mdio-i2c.h |  1 +
 include/linux/phy.h           |  4 ++
 9 files changed, 207 insertions(+), 22 deletions(-)

-- 
2.49.0