From: Daniel Golle Date: Wed, 27 Jul 2022 22:30:12 +0000 (+0200) Subject: kernel: add quirk for Huawei-compatible OEM SFP GE-T X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=09b086eecaa545cf7f30bc7e394a32751e25db65;p=openwrt%2Fstaging%2Fwigyori.git 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 --- 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))