diff mbox series

mediatek: backport upstream v6.17 Potron SFP+ XGSPON patches

Message ID 20250624202113.1857334-1-macroalpha82@gmail.com
State Superseded
Delegated to: Hauke Mehrtens
Headers show
Series mediatek: backport upstream v6.17 Potron SFP+ XGSPON patches | expand

Commit Message

Chris Morgan June 24, 2025, 8:21 p.m. UTC
From: Chris Morgan <macromorgan@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 <macroalpha82@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

Comments

Hauke Mehrtens July 12, 2025, 9:36 p.m. UTC | #1
On 6/24/25 22:21, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@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 <macroalpha82@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

If you haven't  done it yet, plese send this patch also to upstream Linux.

Please add it to the target/linux/generic/ folder either in pending or 
backport. If it was accapted in the upstrea maintainer tree it should go 
to backport.

Please run "make target/{clean,refresh} V=99" to refresh the patch too.

Hauke
diff mbox series

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 <macromorgan@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 <macromorgan@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
+