openwrt/target/linux/generic/hack-5.15/790-SFP-GE-T-ignore-TX_FAULT.patch

48 lines
1.5 KiB
Diff
Raw Normal View History

--- 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))