From 09bbedac72d5a9267088c15d1a71c8c3a8fb47e7 Mon Sep 17 00:00:00 2001 From: Marek BehĂșn Date: Fri, 30 Sep 2022 16:21:09 +0200 Subject: net: phy: mdio-i2c: support I2C MDIO protocol for RollBall SFP modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Marek BehĂșn Cc: Andrew Lunn Cc: Russell King Signed-off-by: David S. Miller --- drivers/net/phy/sfp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/net/phy') diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index ccd7710685f2..20f48464a06a 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -546,7 +546,7 @@ static int sfp_i2c_mdiobus_create(struct sfp *sfp) struct mii_bus *i2c_mii; int ret; - i2c_mii = mdio_i2c_alloc(sfp->dev, sfp->i2c); + i2c_mii = mdio_i2c_alloc(sfp->dev, sfp->i2c, sfp->mdio_protocol); if (IS_ERR(i2c_mii)) return PTR_ERR(i2c_mii); @@ -1720,6 +1720,10 @@ static int sfp_sm_probe_for_phy(struct sfp *sfp) case MDIO_I2C_C45: err = sfp_sm_probe_phy(sfp, true); break; + + case MDIO_I2C_ROLLBALL: + err = -EOPNOTSUPP; + break; } return err; -- cgit v1.2.3