Message ID | 20201020150615.11969-1-kabel@kernel.org |
---|---|
Headers | show |
Series | Support for RollBall 10G copper SFP modules | expand |
> @@ -2006,6 +2040,23 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report) > > sfp->id = id; > > + sfp->phy_addr = SFP_PHY_ADDR; > + > + rollball = ((!memcmp(id.base.vendor_name, "OEM ", 16) || > + !memcmp(id.base.vendor_name, "Turris ", 16)) && > + (!memcmp(id.base.vendor_pn, "SFP-10G-T ", 16) || > + !memcmp(id.base.vendor_pn, "RTSFP-10", 8))); Are you customising the SFP, so that it has your vendor name? Is the generic SFP OEM/SFP-10G-T, and your customized one Turris/ RTSFP-10? Andrew
> 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
On Tue, 20 Oct 2020 17:51:26 +0200 Andrew Lunn <andrew@lunn.ch> wrote: > > @@ -2006,6 +2040,23 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report) > > > > sfp->id = id; > > > > + sfp->phy_addr = SFP_PHY_ADDR; > > + > > + rollball = ((!memcmp(id.base.vendor_name, "OEM ", 16) || > > + !memcmp(id.base.vendor_name, "Turris ", 16)) && > > + (!memcmp(id.base.vendor_pn, "SFP-10G-T ", 16) || > > + !memcmp(id.base.vendor_pn, "RTSFP-10", 8))); > > Are you customising the SFP, so that it has your vendor name? > > Is the generic SFP OEM/SFP-10G-T, and your customized one Turris/ > RTSFP-10? > > Andrew Hilink puts OEM/SFP-10G-T into their modules. RollBall puts OEM/RTSFP-10 and sometimes OEM/RTSFP-10G. They are rebranding these modules for us to Turris/RTSFP-10. Marek
On Tue, 20 Oct 2020 18:00:39 +0200 Andrew Lunn <andrew@lunn.ch> wrote: > > 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. At first I proposed a separate mdio bus driver for RollBall SFPs. But Russell suggested doing this instead, saying that in the future this can be changed. > > > * 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. I can do that... > > Andrew