Subject: Re: [PATCH russell-kings-net-queue v2 1/3] net: phy: mdio-i2c: support I2C MDIO protocol for RollBall SFP modules

From: Andrew Lunn <[email-masked]>
Date: Tue, 20 Oct 2020 18:00:39 +0200

> This extends the mdio-i2c driver so that when SFP PHY address 17 is used
> (which in mdio-i2c terms corresponds to I2C address 0x51), then this
> different protocol is used for MDIO access.

Hi Marek

I don't see that being very scalable. What happens when the next SFP
comes along which has a different protocol at address 0x51. Since you
can identify the SFP via the EEPROM information, i would prefer you
explicitly tell it to use the rollball protocol when instantiating the
MDIO bus.

>   * I2C bus addresses 0x50 and 0x51 are normally an EEPROM, which is
>   * specified to be present in SFP modules.  These correspond with PHY
> - * addresses 16 and 17.  Disallow access to these "phy" addresses.
> + * addresses 16 and 17.  Disallow access to 0x50 "phy" address.
> + * Use RollBall protocol when accessing via the 0x51 address.
>   */
>  static bool i2c_mii_valid_phy_id(int phy_id)
>  {
> -	return phy_id != 0x10 && phy_id != 0x11;
> +	return phy_id != 0x10;
> +}

I'm not sure that is safe. It means that we will scan address 0x11 to
see if there is a PHY there. And if the SFP does have diagnostics
registers, that might be enough that phylib thinks there is a PHY
there.

I think you only need to allow access to 0x11 if rollball protocol has
been enabled.

     Andrew