From 09b086eecaa545cf7f30bc7e394a32751e25db65 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 28 Jul 2022 00:30:12 +0200 Subject: 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 --- .../hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch (limited to 'target/linux') 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)) -- cgit v1.2.3