netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sfp: add fixup for tplink 2.5gbase-t rj45 modules
@ 2024-01-06 16:29 Josua Mayer
  2024-01-07 16:10 ` Russell King (Oracle)
  0 siblings, 1 reply; 3+ messages in thread
From: Josua Mayer @ 2024-01-06 16:29 UTC (permalink / raw)
  To: Russell King, Andrew Lunn, Heiner Kallweit, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Josua Mayer

TP-Link TL-SM410U modules are single-rate 2.5GBase-T RJ45 SFP modules.
The EEPROM data is lying about connector and extended cc,
reporting 25Gbps fiber.

Add fixup for these specific modules forcing RJ45 @ 2.5Gbase-T.

For reference original eeprom data dump from ethtool:

Identifier                : 0x03 (SFP)
Extended identifier       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
Connector                 : 0x07 (LC)
Transceiver codes         : 0x00 0x00 0x00 0x00 0x00 0x00 0x40 0x00 0x00
Transceiver type          : FC: Twisted Pair (TP)
Encoding                  : 0x01 (8B/10B)
BR, Nominal               : 3100MBd
Rate identifier           : 0x00 (unspecified)
Length (SMF,km)           : 0km
Length (SMF)              : 0m
Length (50um)             : 0m
Length (62.5um)           : 0m
Length (Copper)           : 0m
Length (OM3)              : 0m
Laser wavelength          : 0nm
Vendor name               : TP-LINK
Vendor OUI                : 00:00:00
Vendor PN                 : TL-SM410U
Vendor rev                : 1.0
Option values             : 0x00 0x18
Option                    : TX_FAULT implemented
Option                    : TX_DISABLE implemented
BR margin, max            : 0%
BR margin, min            : 0%
Vendor SN                 : 12154J6001608
Date code                 : 210611

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 drivers/net/phy/sfp.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 5468bd209fab..a5bb9d569381 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -340,6 +340,12 @@ static const struct of_device_id sfp_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, sfp_of_match);
 
+static void sfp_fixup_2500baset(struct sfp *sfp)
+{
+	sfp->id.base.connector = SFF8024_CONNECTOR_RJ45;
+	sfp->id.base.extended_cc = SFF8024_ECC_2_5GBASE_T;
+}
+
 static void sfp_fixup_long_startup(struct sfp *sfp)
 {
 	sfp->module_t_start_up = T_START_UP_BAD_GPON;
@@ -503,6 +509,10 @@ static const struct sfp_quirk sfp_quirks[] = {
 	SFP_QUIRK_F("OEM", "RTSFP-10G", sfp_fixup_rollball_cc),
 	SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball),
 	SFP_QUIRK_F("Turris", "RTSFP-10G", sfp_fixup_rollball),
+
+	// tp-link 2.5Gbase-T modules wrongly report 25Gbps fiber connector
+	// in their EEPROM
+	SFP_QUIRK_F("TP-LINK", "TL-SM410U", sfp_fixup_2500baset),
 };
 
 static size_t sfp_strlen(const char *str, size_t maxlen)

---
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
change-id: 20240106-tplink-25gbaset-sfp-fixup-0eca2f8f7530

Sincerely,
-- 
Josua Mayer <josua@solid-run.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-08 17:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-06 16:29 [PATCH] net: sfp: add fixup for tplink 2.5gbase-t rj45 modules Josua Mayer
2024-01-07 16:10 ` Russell King (Oracle)
2024-01-08 17:03   ` Josua Mayer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).