summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-07-28 00:30:12 +0200
committerDaniel Golle <daniel@makrotopia.org>2022-08-26 22:32:47 +0100
commit09b086eecaa545cf7f30bc7e394a32751e25db65 (patch)
treecb12c64c0bfff843d953ff9cef4de874deae481b
parent1f84d45e181ff526c82d86d3e0810aeb2da35580 (diff)
downloadopenwrt-09b086eecaa545cf7f30bc7e394a32751e25db65.tar.gz
openwrt-09b086eecaa545cf7f30bc7e394a32751e25db65.tar.bz2
openwrt-09b086eecaa545cf7f30bc7e394a32751e25db65.zip
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@makrotopia.org>
-rw-r--r--target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch47
1 files changed, 47 insertions, 0 deletions
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))