[openwrt/openwrt] kernel: add quirk for Huawei-compatible OEM SFP GE-T

LEDE Commits lede-commits at lists.infradead.org
Fri Aug 26 14:33:34 PDT 2022


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/09b086eecaa545cf7f30bc7e394a32751e25db65

commit 09b086eecaa545cf7f30bc7e394a32751e25db65
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu Jul 28 00:30:12 2022 +0200

    kernel: add quirk for Huawei-compatible OEM SFP GE-T
    
    Ignore TX_FAULT signal on certain cheap copper/TP gigabit Ethernet SFP
    modules.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch   | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch
new file mode 100644
index 0000000000..bfb32d5381
--- /dev/null
+++ b/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch
@@ -0,0 +1,47 @@
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -1803,6 +1803,7 @@ static int sfp_sm_mod_probe(struct sfp *
+ 	struct sfp_eeprom_id id;
+ 	bool cotsworks_sfbg;
+ 	bool cotsworks;
++	bool oem_ge_t;
+ 	u8 check;
+ 	int ret;
+ 
+@@ -1851,6 +1852,10 @@ static int sfp_sm_mod_probe(struct sfp *
+ 		}
+ 	}
+ 
++	/* Some cheap SFP-GE-T modules always indicate TX fault */
++	oem_ge_t = !memcmp(id.base.vendor_name, "OEM             ", 16) &&
++		   !memcmp(id.base.vendor_pn, "SFP-GE-T    ", 12);
++
+ 	/* Cotsworks do not seem to update the checksums when they
+ 	 * do the final programming with the final module part number,
+ 	 * serial number and date code.
+@@ -1946,8 +1951,8 @@ static int sfp_sm_mod_probe(struct sfp *
+ 	else
+ 		sfp->module_t_start_up = T_START_UP;
+ 
+-	if (!memcmp(id.base.vendor_name, "HUAWEI          ", 16) &&
+-	    !memcmp(id.base.vendor_pn, "MA5671A         ", 16))
++	if ((!memcmp(id.base.vendor_name, "HUAWEI          ", 16) &&
++	    !memcmp(id.base.vendor_pn, "MA5671A         ", 16)) || oem_ge_t)
+ 		sfp->tx_fault_ignore = true;
+ 	else
+ 		sfp->tx_fault_ignore = false;
+@@ -2404,10 +2409,12 @@ static void sfp_check_state(struct sfp *
+ 	mutex_lock(&sfp->st_mutex);
+ 	state = sfp_get_state(sfp);
+ 	changed = state ^ sfp->state;
+-	if (sfp->tx_fault_ignore)
++	if (sfp->tx_fault_ignore) {
+ 		changed &= SFP_F_PRESENT | SFP_F_LOS;
+-	else
++		state &= ~SFP_F_TX_FAULT;
++	} else {
+ 		changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
++	}
+ 
+ 	for (i = 0; i < GPIO_MAX; i++)
+ 		if (changed & BIT(i))




More information about the lede-commits mailing list