Subject: Re: [PATCH net-next v4 1/4] net: phy: mdio-i2c: support I2C MDIO protocol for RollBall SFP modules

From: Russell King - ARM Linux admin <[email-masked]>
Date: Mon, 18 Jan 2021 15:45:09 +0000

On Mon, Jan 18, 2021 at 01:13:38PM +0100, Pali Rohár wrote:
> On Tuesday 12 January 2021 19:22:33 Russell King - ARM Linux admin wrote:
> > On Tue, Jan 12, 2021 at 09:42:56AM +0100, Heiner Kallweit wrote:
> > > On 11.01.2021 06:00, Marek Behún wrote:
> > > > Some multigig SFPs from RollBall and Hilink do not expose functional
> > > > MDIO access to the internal PHY of the SFP via I2C address 0x56
> > > > (although there seems to be read-only clause 22 access on this address).
> > > > 
> > > > Instead these SFPs PHY can be accessed via I2C via the SFP Enhanced
> > > > Digital Diagnostic Interface - I2C address 0x51. The SFP_PAGE has to be
> > > > selected to 3 and the password must be filled with 0xff bytes for this
> > > > PHY communication to work.
> > > > 
> > > > This extends the mdio-i2c driver to support this protocol by adding a
> > > > special parameter to mdio_i2c_alloc function via which this RollBall
> > > > protocol can be selected.
> > > > 
> > > I'd think that mdio-i2c.c is for generic code. When adding a
> > > vendor-specific protocol, wouldn't it make sense to use a dedicated
> > > source file for it?
> > 
> > There is nothing in the SFP MSAs about how to access an on-board PHY
> > on a SFP. This is something that vendors choose to do (or in some
> > cases, not do.)
> > 
> > mdio-i2c currently implements the access protocol for Marvell 88E1111
> > PHYs which have an I2C mode. It was extended to support the DM7052
> > module which has a Broadcom Clause 45 PHY and either a microcontroller
> > or FPGA to convert I2C cycles to MDIO cycles - and sensibly performs
> > clock stretching.
> 
> Just to note that there is also another Marvell way how to access Clause
> 45 registers via existing Marvell PHY Clause 22 I2C mode:
> 
> https://www.ieee802.org/3/efm/public/nov02/oam/pannell_oam_1_1102.pdf
> 
> Clause 45 registers are accessed via Clause 22 regs 13 and 14.

Only if the Clause 45 PHY supports the Clause 22 interface. Not all do.

However, which access method really only depends on the SFP module,
and how they interface the PHY to the I2C bus. As I've previously
mentioned, using a wrong access method will be misinterpreted by
the SFP.

Even if the PHY supports both Clause 22 and Clause 45 accesses,
if the I2C-to-MDIO layer in the SFP only supports Clause 45, then
Clause 22 accesses will not work. As I've previously said, a
Clause 45 read access is indistinguishable from a Clause 22 write
access on the I2C bus.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!