From: Chris Morgan <macromor...@hotmail.com>

Backport fixes for the Potron SFP+ XGSPON ONU stick. These fixes allow
the Potron SFP+ XGSPON ONU stick to work without manual workarounds
to prevent UART activity on pins 2 and 7 to be interpreted as TX_FAULT
or LOS signals on devices with support for these signals (such as the
Banana Pi R4).

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=dfec1c14aece

Signed-off-by: Chris Morgan <macroalph...@gmail.com>
---
 ...net-sfp-Add-quirk-for-SFP-ONU-XGSPON.patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 
target/linux/mediatek/patches-6.12/961-net-sfp-Add-quirk-for-SFP-ONU-XGSPON.patch

diff --git 
a/target/linux/mediatek/patches-6.12/961-net-sfp-Add-quirk-for-SFP-ONU-XGSPON.patch
 
b/target/linux/mediatek/patches-6.12/961-net-sfp-Add-quirk-for-SFP-ONU-XGSPON.patch
new file mode 100644
index 0000000000..d83a91a589
--- /dev/null
+++ 
b/target/linux/mediatek/patches-6.12/961-net-sfp-Add-quirk-for-SFP-ONU-XGSPON.patch
@@ -0,0 +1,66 @@
+From d6899e971a19f525a2efe2d301c859e753462607 Mon Sep 17 00:00:00 2001
+From: Chris Morgan <macromor...@hotmail.com>
+Date: Thu, 5 Jun 2025 14:18:21 -0500
+Subject: [PATCH] net: sfp: add quirk for SFP-ONU-XGSPON module
+
+Add quirk for YV SFP+ONT-XGSPON module.
+
+This device uses pins 2 and 7 for UART communication, so disable
+TX_FAULT and LOS. Additionally as it is an embedded system in an
+SFP+ form factor provide it enough time to fully boot before we
+attempt to use it.
+
+Signed-off-by: Chris Morgan <macromor...@hotmail.com>
+---
+ drivers/net/phy/sfp.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
+index 347c1e0e94d9..7a070808ec46 100644
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -350,6 +350,11 @@ static void sfp_fixup_ignore_tx_fault(struct sfp *sfp)
+       sfp->tx_fault_ignore = true;
+ }
+ 
++static void sfp_fixup_ignore_hw(struct sfp *sfp, unsigned int mask)
++{
++      sfp->state_hw_mask &= ~mask;
++}
++
+ // For 10GBASE-T short-reach modules
+ static void sfp_fixup_10gbaset_30m(struct sfp *sfp)
+ {
+@@ -377,7 +377,19 @@ static void sfp_fixup_halny_gsfp(struct sfp *sfp)
+        * these are possibly used for other purposes on this
+        * module, e.g. a serial port.
+        */
+-      sfp->state_hw_mask &= ~(SFP_F_TX_FAULT | SFP_F_LOS);
++      sfp_fixup_ignore_hw(sfp, (SFP_F_TX_FAULT | SFP_F_LOS));
++}
++
++static void sfp_fixup_potron(struct sfp *sfp)
++{
++      /*
++       * The TX_FAULT and LOS pins on this device are used for serial
++       * communication, so ignore them. Additionally, provide extra
++       * time for this device to fully start up.
++       */
++
++      sfp_fixup_long_startup(sfp);
++      sfp_fixup_ignore_hw(sfp, (SFP_F_TX_FAULT | SFP_F_LOS));
+ }
+ 
+ static void sfp_fixup_rollball(struct sfp *sfp)
+@@ -490,6 +502,8 @@ static const struct sfp_quirk sfp_quirks[] = {
+       SFP_QUIRK("FS", "GPON-ONU-34-20BI", sfp_quirk_2500basex,
+                 sfp_fixup_ignore_tx_fault),
+ 
++      SFP_QUIRK_F("YV", "SFP+ONU-XGSPON", sfp_fixup_potron),
++
+       SFP_QUIRK_F("HALNy", "HL-GSFP", sfp_fixup_halny_gsfp),
+ 
+       // HG MXPD-483II-F 2.5G supports 2500Base-X, but incorrectly reports
+-- 
+2.43.0
+
-- 
2.39.5


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to