[BPI-R4] and SFP

You either seem to lack kmod-phy-realtek package or the SFP doesn’t expose the PHY.

I’m using TP-LINK TL-SM410U, ONTi ONT-C2GE-R10 and some other TP-LINK and ONTi modules. I had the same problem with Openwrt going from kernel 6.1 to 6.6 on R3. Everything was working fine before, but after the update:

[   15.141286] sfp sfp-2: module                                   rev 1.0  sn 2208180027       dc 220818
[   15.150776] mt7530-mdio mdio-bus:1f sfp2: unsupported SFP module: no common interface modes
[   15.206232] sfp sfp-1: module TP-LINK          TL-SM410U        rev 2.0  sn 12260M4000737    dc 220621
[   15.208117] hwmon hwmon1: temp1_input not attached to any thermal zone
[   15.215705] mtk_soc_eth 15100000.ethernet eth1: unsupported SFP module: no common interface modes

Then I did a sfp-bus.c diff from kernel 6.9.1 and put the patch in target/linux/mediatek/patches-6.6

--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -151,10 +151,6 @@
        unsigned int br_min, br_nom, br_max;
        __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };

-       phylink_set(modes, Autoneg);
-       phylink_set(modes, Pause);
-       phylink_set(modes, Asym_Pause);
-
        /* Decode the bitrate information to MBd */
        br_min = br_nom = br_max = 0;
        if (id->base.br_nominal) {
@@ -328,7 +324,7 @@
         * modules use 2500Mbaud rather than 3100 or 3200Mbaud for
         * 2500BASE-X, so we allow some slack here.
         */
-       if (bitmap_empty(modes, __ETHTOOL_LINK_MODE_MASK_NBITS) && br_nom) {
+       if (linkmode_empty(modes) && br_nom) {
                if (br_min <= 1300 && br_max >= 1200) {
                        phylink_set(modes, 1000baseX_Full);
                        __set_bit(PHY_INTERFACE_MODE_1000BASEX, interfaces);
@@ -339,6 +335,10 @@
                }
        }

+       phylink_set(modes, Autoneg);
+       phylink_set(modes, Pause);
+       phylink_set(modes, Asym_Pause);
+
        if (bus->sfp_quirk && bus->sfp_quirk->modes)
                bus->sfp_quirk->modes(id, modes, interfaces);

And It seems to be working fine again

[   15.391245] sfp sfp-2: module                                   rev 1.0  sn 2208180027       dc 220818
[   15.442338] sfp sfp-1: module TP-LINK          TL-SM410U        rev 2.0  sn 12260M4000737    dc 220621
[   15.452578] hwmon hwmon1: temp1_input not attached to any thermal zone
[   15.643208] mt798x-wmac 18000000.wifi: HW/SW Version: 0x8a108a10, Build Time: 20221012174743a

Sorry if it is a noob-question…

I am using trunk OpenWrt (version 6.6.30) and have a GPON-ONU-34-20BI module. The module is detected at boot and link is also detected.

[   58.082859] sfp sfp2: module FS               GPON-ONU-34-20BI rev 01   sn G2410075131      dc 240301 
Settings for eth1:
	Supported ports: [ FIBRE ]
	Supported link modes:   2500baseX/Full 
	                        1000baseX/Full 
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  2500baseX/Full 
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: No
	Advertised FEC modes: Not reported
	Speed: 2500Mb/s
	Duplex: Full
	Port: FIBRE
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: off
	Current message level: 0x000000ff (255)
			       drv probe link timer ifdown ifup rx_err tx_err
	Link detected: yes

However the speed is 2500Mb and I have to change it to 1000Mb (ethtool speed) does not work so I have to log into the module. The IP address according to HackGPON is 192.168.1.10, but I cannot connect to it. Am I missing something…?

Ok, found the solution… that works.

Now I am trying to set the speed to 1000.

fw_setenv sgmii_mode 4

After reading the sgmii mode, link_status (onu lanpsg 0) is still unchanged (5). Or do I need to unlock the bootloader?

Hello @wvdakker

I have the same sfp receiver, and my R4 détective it in dmesg.

However the link is not detected in ethtool since I haven’t Connect the fiber in it since I have to configure the ont before.

But I’m not able to connect to 192.168.1.10 how did you do it please ?

Hi, Be sure your bpi has ip 192.168.1.1

then

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss [email protected]

And you are in. (note: after filling in your password) https://hack-gpon.org/ont-fs-com-gpon-onu-stick-with-mac/

I noticed you have to have a link before you can log in.

My BPI has the ip 192.168.1.1

I have connect the ONT on sfp lan and it is detected

Thu May 30 09:49:46 2024 kern.info kernel: [  105.202018] sfp sfp2: module FS               GPON-ONU-34-20BI rev 01   sn G2410318799      dc 240327
Thu May 30 09:49:46 2024 kern.info kernel: [  105.211440] mtk_soc_eth 15100000.ethernet eth1: switched to inband/2500base-x link mode

With ethtool I can see it has negotiated the speed

root@OpenWrt:~# ethtool eth1
Settings for eth1:
	Supported ports: [ FIBRE ]
	Supported link modes:   2500baseX/Full 
	                        1000baseX/Full 
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  2500baseX/Full 
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: 2500Mb/s
	Duplex: Full
	Port: FIBRE
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	Current message level: 0x000000ff (255)
			       drv probe link timer ifdown ifup rx_err tx_err
	Link detected: no

But I cannot ping nor ssh from the BPI or a device connected on LAN.

I have to connect the fiber even if I haven’t configure anything on ONT if I understand ?

Most ont need link up to access their webinterface/internal ip

I noticed I only can ping/ssh the sfp if there is a link. If I remove the link I cannot access the sfp. Inserting, then I can.

There is somewhere on this forum a discussion to modify the source so you can also access it without a link. I think it was in the BPIR3-SFP forum.

You use an devicetree-overlay to change the los-gpio so that you can simulate a link-up without having fibre connected.

it looks like @dangowrt did a nice job with openwrt’s commits for the past few days … the sfp module works without any hacks and right from the start. Thank you @dangowrt !

1 Like

Yes I confirm that after the fiber is in the ONT the link is detected and that works perfectly. My R4 is now my router instead of the ISP one, thank you !

Ok found my problem. The ISP doesnt use GPON but AON. Therefor the TX didnt match and not came up. Switching to FS fiber module SFP-GE-BX (be sure to install the right one) works out of the box and the link came up directly.

Settings for eth1:
	Supported ports: [ FIBRE ]
	Supported link modes:   1000baseX/Full 
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  1000baseX/Full 
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  1000baseX/Full 
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Port: FIBRE
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
Cannot get wake-on-lan settings: Operation not permitted
	Current message level: 0x000000ff (255)
			       drv probe link timer ifdown ifup rx_err tx_err
	Link detected: yes

This module can be added to the ones which work with the bpi-r4 SFP filber module

sfp sfp2: module FS               GPON-ONU-34-20BI rev 01   sn G2410075131      dc 240301 

This one?

No that is the older one I used.

This one works for my ISP:

sfp sfp1: module FS               SFP-GE-BX        rev A0   sn F2130219083      dc 220922 

I have this one and it works with the R4 btw

THANK YOU for writing about AON fiber networks! As I remember you are the first one who wrote about it.

In the next months I also get a new AON FFTH activated. It’s a new installed Network → AON lives …

I also decided for the SFP-GE-BX.

My problem:

FS delivers by default LC PC or UPC.

But after calling Service, they deliver a LC APC to me.

The behavoiur “work out of the box” looks normal for AON and was also described in the commends of the SFP modul.

Got 2 of them in my BPI-R4. One to the ISP and one uplink to the internal switch. Works ok.

1 Like

I have LEOX LXT-010S-H and BPP-R4 and I have the same problem as bqbq had: the led is blinking when inserting/removing the module. There are no logs in dmesg, I have checked both leox (on a mikrotik router) and Banana PI (with other SFP+ device) and they are working there so its not a hardware issue. It seems to be the same problem as Vasya described. Did anyone managed to get it to work?

What is the problem? Just use a patch cable from UPC to APC?