From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: davem@davemloft.net, "Andrew Lunn" <andrew@lunn.ch>,
"Jakub Kicinski" <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Köry Maincent" <kory.maincent@bootlin.com>,
"Simon Horman" <horms@kernel.org>,
"Romain Gantois" <romain.gantois@bootlin.com>,
"Antoine Tenart" <atenart@kernel.org>,
"Marek Behún" <kabel@kernel.org>
Subject: Re: [PATCH net-next 0/2] net: phy: sfp: Add single-byte SMBus SFP access
Date: Mon, 24 Feb 2025 10:38:14 +0100 [thread overview]
Message-ID: <20250224103814.7d60bfbd@fedora> (raw)
In-Reply-To: <87r03otsmm.fsf@miraculix.mork.no>
Hi Bjørn,
On Sun, 23 Feb 2025 19:37:05 +0100
Bjørn Mork <bjorn@mork.no> wrote:
> Maxime Chevallier <maxime.chevallier@bootlin.com> writes:
>
> > Hi everyone,
> >
> > Some PHYs such as the VSC8552 have embedded "Two-wire Interfaces" designed to
> > access SFP modules downstream. These controllers are actually SMBus controllers
> > that can only perform single-byte accesses for read and write.
> >
> > This series adds support for accessing SFP modules through single-byte SMBus,
> > which could be relevant for other setups.
> >
> > The first patch deals with the SFP module access by itself, for addresses 0x50
> > and 0x51.
> >
> > The second patch allows accessing embedded PHYs within the module with single-byte
> > SMBus, adding this in the mdio-i2c driver.
> >
> > As raw i2c transfers are always more efficient, we make sure that the smbus accesses
> > are only used if we really have no other choices.
> >
> > This has been tested with the following modules (as reported upon module insertion)
> >
> > Fiber modules :
> >
> > UBNT UF-MM-1G rev sn FT20051201212 dc 200512
> > PROLABS SFP-1GSXLC-T-C rev A1 sn PR2109CA1080 dc 220607
> > CISCOSOLIDOPTICS CWDM-SFP-1490 rev 1.0 sn SOSC49U0891 dc 181008
> > CISCOSOLIDOPTICS CWDM-SFP-1470 rev 1.0 sn SOSC47U1175 dc 190620
> > OEM SFP-10G-SR rev 02 sn CSSSRIC3174 dc 181201
> > FINISAR CORP. FTLF1217P2BTL-HA rev A sn PA3A0L6 dc 230716
> > OEM ES8512-3LCD05 rev 10 sn ESC22SX296055 dc 220722
> > SOURCEPHOTONICS SPP10ESRCDFF rev 10 sn E8G2017450 dc 140715
> > CXR SFP-STM1-MM-850 rev 0000 sn K719017031 dc 200720
> >
> > Copper modules
> >
> > OEM SFT-7000-RJ45-AL rev 11.0 sn EB1902240862 dc 190313
> > FINISAR CORP. FCLF8521P2BTL rev A sn P1KBAPD dc 190508
> > CHAMPION ONE 1000SFPT rev - sn GBC59750 dc 19110401
> >
> > DAC :
> >
> > OEM SFP-H10GB-CU1M rev R sn CSC200803140115 dc 200827
> >
> > In all cases, read/write operations happened without errors, and the internal
> > PHY (if any) was always properly detected and accessible
> >
> > I haven't tested with any RollBall SFPs though, as I don't have any, and I don't
> > have Copper modules with anything else than a Marvell 88e1111 inside. The support
> > for the VSC8552 SMBus may follow at some point.
> >
> > Thanks,
> >
> > Maxime
> >
> > Maxime Chevallier (2):
> > net: phy: sfp: Add support for SMBus module access
> > net: mdio: mdio-i2c: Add support for single-byte SMBus operations
> >
> > drivers/net/mdio/mdio-i2c.c | 79 ++++++++++++++++++++++++++++++++++++-
> > drivers/net/phy/sfp.c | 65 +++++++++++++++++++++++++++---
> > 2 files changed, 138 insertions(+), 6 deletions(-)
>
> Nice! Don't know if you're aware, but OpenWrt have had patches for
> SMBus access to SFPs for some time:
>
> https://github.com/openwrt/openwrt/blob/main/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch
> https://github.com/openwrt/openwrt/blob/main/target/linux/realtek/patches-6.6/712-net-phy-add-an-MDIO-SMBus-library.patch
>
> The reason they carry these is that they support Realtek rtl930x based
> switches. The rtl930x SoCs include an 8 channel SMBus host which is
> typically connected to any SFP+ slots on the switch.
>
> There has been work going on for a while to bring the support for these
> SoCs to mainline, and the SMBus host driver is already here:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/i2c/busses/i2c-rtl9300.c?id=c366be720235301fdadf67e6f1ea6ff32669c074
>
> I assume DSA and ethernet eventually will follow, making SMBus SFP
> support necessary for this platform too.
>
> So thanks for doing this!
Good to know this is useful to you ! So there's at least 2 different
classes of products out there with SMBus that advertise that it's
"designed for SFP" ._.
> FWIW, I don't think the OpenWrt mdio patch works at all. I've recently
> been playing with an 8 SFP+ port switch based on rtl9303, and have tried
> to fixup both the clause 22 support and add RollBall and clause 45.
> This is still a somewhat untested hack, and I was not planning on
> presenting it here as such, but since this discussion is open:
> https://github.com/openwrt/openwrt/pull/17950/commits/c40387104af62a065797bc3e23dfb9f36e03851b
>
> Sorry for the format. This is a patch for the patch already present in
> OpenWrt. Let me know if you want me to post the complete patched
> mdio-smbus.c for easier reading.
>
> The main point I wanted to make is that we also need RollBall and clause
> 45 over SMBus. Maybe not today, but at some point. Ideally, the code
> should be shared with the i2c implementation, but I found that very hard
> to do as it is.
I don't have anything to test that, and yeah that can be considered as
a second step, however I don't even know if this can work at all with
single byte accesses :(
Thanks,
Maxime
next prev parent reply other threads:[~2025-02-24 9:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-23 17:28 [PATCH net-next 0/2] net: phy: sfp: Add single-byte SMBus SFP access Maxime Chevallier
2025-02-23 17:28 ` [PATCH net-next 1/2] net: phy: sfp: Add support for SMBus module access Maxime Chevallier
2025-02-23 17:28 ` [PATCH net-next 2/2] net: mdio: mdio-i2c: Add support for single-byte SMBus operations Maxime Chevallier
2025-02-24 3:36 ` Andrew Lunn
2025-02-24 10:03 ` Maxime Chevallier
2025-02-23 17:40 ` [PATCH net-next 0/2] net: phy: sfp: Add single-byte SMBus SFP access Russell King (Oracle)
2025-02-23 17:48 ` Maxime Chevallier
2025-02-25 12:38 ` Bjørn Mork
2025-02-25 13:06 ` Maxime Chevallier
2025-02-25 13:29 ` Andrew Lunn
2025-02-25 17:15 ` Russell King (Oracle)
2025-02-25 18:07 ` Bjørn Mork
2025-02-25 18:40 ` Russell King (Oracle)
2025-02-23 18:37 ` Bjørn Mork
2025-02-23 20:31 ` Russell King (Oracle)
2025-02-24 3:32 ` Andrew Lunn
2025-02-24 7:13 ` Bjørn Mork
2025-02-24 8:47 ` Russell King (Oracle)
2025-02-24 9:35 ` Maxime Chevallier
2025-02-24 13:31 ` Andrew Lunn
2025-02-24 13:48 ` Russell King (Oracle)
2025-02-24 14:18 ` Andrew Lunn
2025-02-24 14:32 ` Marek Behún
2025-02-24 14:38 ` Russell King (Oracle)
2025-02-24 16:24 ` Maxime Chevallier
2025-02-25 8:08 ` Maxime Chevallier
2025-02-24 9:38 ` Maxime Chevallier [this message]
2025-02-24 10:36 ` Marek Behún
2025-02-24 16:30 ` Sean Anderson
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=20250224103814.7d60bfbd@fedora \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=atenart@kernel.org \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kabel@kernel.org \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=romain.gantois@bootlin.com \
--cc=thomas.petazzoni@bootlin.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).