XGSPON SFP occasionally won't power up properly and no link detected

I have the [X-ONU-SFPP (SFP+ XGSPON ONU Stick) - PON dot WIKI](https://X-ONU-SFPP SFP+ XGSPON ONU) SFP+ stick plugged into the SFP+ cage on the BPI-R4. When powering on the BPI-R4, chances are that the stick won’t boot properly (even though it’s recognized in Linux) and it stays in disabled state with no link detected, and I need to unplug and re-plug the SFP+ stick in order for it to work properly.

Logs from a boot where it works:

[   13.763775] br-wan: port 2(eth2) entered forwarding state
[   13.755137] br-wan: port 2(eth2) entered blocking state
[   13.750166] mtk_soc_eth 15100000.ethernet eth2: Link is Up - 10Gbps/Full - flow control off
[   13.662742] mtk_soc_eth 15100000.ethernet eth2: entered promiscuous mode
[   13.655734] mtk_soc_eth 15100000.ethernet eth2: entered allmulticast mode
[   13.650470] br-wan: port 2(eth2) entered disabled state
[   13.645164] br-wan: port 2(eth2) entered blocking state
[   13.621630] mtk_soc_eth 15100000.ethernet eth2: configuring for inband/10gbase-r link mode
[   13.604193] mt7530-mmio 15020000.switch wan: entered promiscuous mode
[   13.597365] mt7530-mmio 15020000.switch wan: entered allmulticast mode
[   13.592167] br-wan: port 1(wan) entered disabled state
[   13.586964] br-wan: port 1(wan) entered blocking state
[   13.577675] mt7530-mmio 15020000.switch wan: configuring for phy/internal link mode
[   11.628969] mtk_soc_eth 15100000.ethernet eth2: switched to inband/10gbase-r link mode
[   11.619509] sfp sfp1: module OEM              XGSPONST2001     rev A-01 sn 092142509000169  dc 250902  

and ethtool reports Link detected: yes.

Versus when it doesn’t work correctly:

[   14.047996] mtk_soc_eth 15100000.ethernet eth2: entered promiscuous mode
[   14.041064] mtk_soc_eth 15100000.ethernet eth2: entered allmulticast mode
[   14.035778] br-wan: port 2(eth2) entered disabled state
[   14.030534] br-wan: port 2(eth2) entered blocking state
[   13.998130] mtk_soc_eth 15100000.ethernet eth2: configuring for inband/10gbase-r link mode
[   13.987976] mt7530-mmio 15020000.switch wan: entered promiscuous mode
[   13.981203] mt7530-mmio 15020000.switch wan: entered allmulticast mode
[   13.975979] br-wan: port 1(wan) entered disabled state
[   13.970796] br-wan: port 1(wan) entered blocking state
[   13.962010] mt7530-mmio 15020000.switch wan: configuring for phy/internal link mode
[   11.669379] mtk_soc_eth 15100000.ethernet eth2: switched to inband/10gbase-r link mode
[   11.659856] sfp sfp1: module OEM              XGSPONST2001     rev A-01 sn 092142509000169  dc 250902

and ethtool reports Link detected: no. When I hot plug it the link comes up almost immediately (so it doesn’t need to wait for the stick to boot to recognize that).

I have patched the kernel with the long startup quirk and to ignore TX_FAULT (shares serial console pin).

root@hostname:~# ubus call system board
{
	"kernel": "6.6.119",
	"hostname": "hostname",
	"system": "ARMv8 Processor rev 0",
	"model": "Bananapi BPI-R4",
	"board_name": "bananapi,bpi-r4",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "24.10.5",
		"revision": "r29087-d9c5716d1d",
		"target": "mediatek/filogic",
		"description": "OpenWrt 24.10.5 r29087-d9c5716d1d",
		"builddate": "1766005702"
	}
}

Thanks