[PATCH 2/2] net: sfp: add quirk for FINISAR FTLF8536P4BCL SFP module

From: Oleksandr Mazur
Date: Tue Sep 13 2022 - 14:40:57 EST


The FINISAR FTLF8536P4BCL reports 25G & 100GBd SR in it's EEPROM,
but supports only 1000base-X and 10000base-SR modes.

Add quirk to clear unsupported modes, and set only the ones that
module actually supports: 1000base-X and 10000base-SR.

EEPROM content of this SFP module is (where XX is serial number):

00: 03 04 07 00 00 00 00 00 00 00 00 06 ff 00 00 00 |................|
10: 02 00 0a 07 46 49 4e 49 53 41 52 20 43 4f 52 50 |....FINISAR CORP|
20: 2e 20 20 20 02 00 90 65 46 54 4c 46 38 35 33 36 |. ...eFTLF8536|
30: 50 34 42 43 4c 20 20 20 41 20 20 20 03 52 00 b8 |P4BCL A .R..|
40: 08 1a 70 00 55 55 XX XX XX XX XX XX XX XX XX XX |..p.UUXXXXXXXXXX|
50: 20 20 20 20 31 36 30 32 31 30 20 20 68 f0 08 62 | 160210 h..b|

Signed-off-by: Oleksandr Mazur <oleksandr.mazur@xxxxxxxxxxx>
Change-Id: I320058dee38724d3564fc2500ae2e3abfe3d47bb
---
drivers/net/phy/sfp-bus.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index c3df85501836..a7799162e3a7 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -61,6 +61,17 @@ static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,
phylink_set(modes, 1000baseX_Full);
}

+static void sfp_quirk_finisar_ftlf8536p4bcl(const struct sfp_eeprom_id *id,
+ unsigned long *modes)
+{
+ /* Finisar FTLF8536P4BCL module claims 25G & 100GBd SR support in it's
+ * EEPROM, but can also support both 1000BaseX and 10000Base-SR modes.
+ * Set additionally supported modes: 1000baseX_Full and 10000baseSR_Full.
+ */
+ phylink_set(modes, 1000baseX_Full);
+ phylink_set(modes, 10000baseSR_Full);
+}
+
static const struct sfp_quirk sfp_quirks[] = {
{
// Alcatel Lucent G-010S-P can operate at 2500base-X, but
@@ -100,6 +111,12 @@ static const struct sfp_quirk sfp_quirks[] = {
.vendor = "FINISAR CORP.",
.part = "FTLX8574D3BCL",
.modes = sfp_quirk_1000basex,
+ }, {
+ // Finisar FTLF8536P4BCL can operate at 1000base-X and 10000base-SR,
+ // but reports 25G & 100GBd SR in it's EEPROM
+ .vendor = "FINISAR CORP.",
+ .part = "FTLF8536P4BCL",
+ .modes = sfp_quirk_finisar_ftlf8536p4bcl,
},
};

--
2.17.1