Bpi-R3 access ssh sfp gpon onu without plugging fiber

Hy :slight_smile:

I use a sfp gpon onu brand fs. I can access by ssh into the module sfp. But i need to plug fiber with signal.

I would like to access without beeing obliged to plug fiber.

I began by modifying the DTS :

sfp1: sfp-1 {
compatible = "sff,sfp";
i2c-bus = <&i2c_sfp1>;
los-gpios = <&pio 46 GPIO_ACTIVE_HIGH>;
mod-def0-gpios = <&pio 49 GPIO_ACTIVE_LOW>;
tx-disable-gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
    maximum-power-milliwatt = <3000>;
};

los-gpios = <&pio 46 GPIO_ACTIVE_HIGH> ====> <&pio 46 GPIO_ACTIVE_LOW>

It works. But when i plug the fiber, i lost the connexion ssh.

Is it possible to bypass or block the los gpios to low? Or any ideas :slight_smile:

you could add an dt overlay which you can load when config is needed without fiber connected and leave it when not

1 Like

Choose a gpio pin on the gpio header and set/clear it with a jumper …

1 Like

Hy. Thank you to answer me :slight_smile:

I think the problem will stay. if i keep the original number gpio, when i insert a fiber with signal, the state of the gpio change.

Hy, i tried to select a pin from the gpio header for each And change the pin in the DTS. but no jumper on the header. For example : los-gpios = <&pio 8 GPIO_ACTIVE_LOW> .

Sometine, the sfp lan works but not the sfp wan. Another time, it’s the sfp wan it works and not the sfp lan. I will try with all free pins :slight_smile:

Yes that is the purpose of the los gpio,it indicates loss of signal…if there is a los signal the interface goes down.

So los needs to be off to get interface itself working.

i change the pin for the gpio los :

 	sfp1: sfp-1 {
  		compatible = "sff,sfp";
  		i2c-bus = <&i2c_sfp1>;
 -		los-gpios = <&pio 46 GPIO_ACTIVE_HIGH>;
 +		los-gpios = <&pio 8 GPIO_ACTIVE_HIGH>;
  		mod-def0-gpios = <&pio 49 GPIO_ACTIVE_LOW>;
  		tx-disable-gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
  		tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
 @@ -126,7 +126,7 @@
  	sfp2: sfp-2 {
  		compatible = "sff,sfp";
  		i2c-bus = <&i2c_sfp2>;
 -		los-gpios = <&pio 31 GPIO_ACTIVE_HIGH>;
 +		los-gpios = <&pio 63 GPIO_ACTIVE_HIGH>;
  		mod-def0-gpios = <&pio 47 GPIO_ACTIVE_LOW>;
  		tx-disable-gpios = <&pio 15 GPIO_ACTIVE_HIGH>;
  		tx-fault-gpios = <&pio 48 GPIO_ACTIVE_HIGH>;

It seems to work. I continue to test and see in the long term

have you tried simply disable the los-gpios (commenting out via //)? or adding a quirk for ignoring the los gpio…but then of course the tx is always enabled which is not the best way…but mapping los-gpio to another gpio not associated with the sfp results in same wrong behaviour

1 Like

Hy. I tried to comment the los gpios line, but it wasn’t good :frowning:

I change to use gpio pin free i won’t use and it works.

I will see in long term if everything go on working.

Thank you again

i tried to do same on R4 with an ODI GPON-SFP

+++ b/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi
@@ -86,7 +86,9 @@ sfp1: sfp1 {
                i2c-bus = <&i2c_sfp1>;
                maximum-power-milliwatt = <3000>;
 
-               los-gpios = <&pio 54 GPIO_ACTIVE_HIGH>;
+               //los-gpios = <&pio 54 GPIO_ACTIVE_HIGH>;
+               los-gpios = <&pio 52 GPIO_ACTIVE_LOW>; //pin 26 to be connected to gnd to be active
                mod-def0-gpios = <&pio 82 GPIO_ACTIVE_LOW>;
                rate-select0-gpios = <&pio 21 GPIO_ACTIVE_LOW>;
                tx-disable-gpios = <&pio 70 GPIO_ACTIVE_HIGH>;

ethtool itself looks good, but i cannot access the system on the stick

root@bpi-r4-v11:~
# dmesg | grep -i sfp                                                                                                                                                      
[    0.000000] Machine model: Banana Pi BPI-R4 (2x SFP+)
[    1.302580] sfp sfp1: Host maximum power 3.0W
[    1.303418] sfp sfp2: Host maximum power 3.0W
[    1.622789] sfp sfp1: module ODI              DFP-34G-2C2      rev      sn GPON25101036     dc 251018  
[    1.634117] sfp sfp2: module CISCO-FINISAR    FTLX8571D3BCL-C2 rev A    sn S2209167650      dc 220916  
root@bpi-r4-v11:~
# ethtool eth2                                                                                                                                                          
Settings for eth2:
        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
        Speed: Unknown!
        Duplex: Unknown! (255)
        Auto-negotiation: on
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: no
root@bpi-r4-v11:~
# ethtool -m eth2                                                                                                                                           
        Identifier                                : 0x03 (SFP)
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
        Connector                                 : 0x01 (SC)
        Transceiver codes                         : 0x00 0x00 0x00 0x02 0x22 0x00 0x01 0x00 0x00
        Transceiver type                          : Ethernet: 1000BASE-LX
        Transceiver type                          : FC: intermediate distance (I)
        Transceiver type                          : FC: Longwave laser (LC)
        Transceiver type                          : FC: Single Mode (SM)
        Encoding                                  : 0x01 (8B/10B)
        BR, Nominal                               : 1300MBd
        Rate identifier                           : 0x00 (unspecified)
        Length (SMF,km)                           : 20km
        Length (SMF)                              : 20000m
        Length (50um)                             : 0m
        Length (62.5um)                           : 0m
        Length (Copper)                           : 0m
        Length (OM3)                              : 0m
        Laser wavelength                          : 1310nm
        Vendor name                               : ODI
        Vendor OUI                                : 00:00:00
        Vendor PN                                 : DFP-34G-2C2
        Vendor rev                                : 
        Option values                             : 0x00 0x1a
        Option                                    : RX_LOS implemented
        Option                                    : TX_FAULT implemented
        Option                                    : TX_DISABLE implemented
        BR margin, max                            : 0%
        BR margin, min                            : 0%
        Vendor SN                                 : GPON25101036
        Date code                                 : 251018
root@bpi-r4-v11:~
# ip a s eth2
5: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 9e:93:3f:bd:42:da brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/24 scope global eth2
       valid_lft forever preferred_lft forever
root@bpi-r4-v11:~
# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.5 icmp_seq=1 Destination Host Unreachable
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 0 received, +1 errors, 100% packet loss, time 3146ms
pipe 4

Los active low, so to fake a link detected the GPIO needs to be high?

yes you are right, but unfortunately it does not matter as interface does not get logical up.

# ip a s eth2                                                                                                                             
5: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000                                         
    link/ether be:2b:95:ce:44:fd brd ff:ff:ff:ff:ff:ff                                                                                    
    inet 192.168.1.5/24 scope global eth2                                                                                                 
       valid_lft forever preferred_lft forever                                                                                            
root@bpi-r4-v11:~                                                                                                                         
# ethtool eth2                                                                                                                            
Settings for eth2:                                                                                                                        
        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                                                                                                
        Speed: Unknown!                                                                                                                   
        Duplex: Unknown! (255)                                                                                                            
        Auto-negotiation: on                                                                                                              
        Port: FIBRE                                                                                                                       
        PHYAD: 0                                                                                                                          
        Transceiver: internal                                                                                                             
        Current message level: 0x000000ff (255)                                                                                           
                               drv probe link timer ifdown ifup rx_err tx_err                                                             
        Link detected: no                                                                                                                 
root@bpi-r4-v11:~                                                                                                                         
# ethtool -m eth2                                                                                                                         
        Identifier                                : 0x03 (SFP)                                                                            
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)                                        
        Connector                                 : 0x01 (SC)                                                                             
        Transceiver codes                         : 0x00 0x00 0x00 0x02 0x22 0x00 0x01 0x00 0x00                                          
        Transceiver type                          : Ethernet: 1000BASE-LX                                                                 
        Transceiver type                          : FC: intermediate distance (I)                                                         
        Transceiver type                          : FC: Longwave laser (LC)                                                               
        Transceiver type                          : FC: Single Mode (SM)                                                                  
        Encoding                                  : 0x01 (8B/10B)                                                                         
        BR, Nominal                               : 1300MBd                                                                               
        Rate identifier                           : 0x00 (unspecified)                                                                    
        Length (SMF,km)                           : 20km                                                                                  
        Length (SMF)                              : 20000m                                                                                
        Length (50um)                             : 0m                                                                                    
        Length (62.5um)                           : 0m                                                                                    
        Length (Copper)                           : 0m                                                                                    
        Length (OM3)                              : 0m                                                                                    
        Laser wavelength                          : 1310nm                                                                                
        Vendor name                               : ODI                                                                                   
        Vendor OUI                                : 00:00:00                                                                              
        Vendor PN                                 : DFP-34G-2C2                                                                           
        Vendor rev                                :                                                                                       
        Option values                             : 0x00 0x1a                                                                             
        Option                                    : RX_LOS implemented                                                                    
        Option                                    : TX_FAULT implemented                                                                  
        Option                                    : TX_DISABLE implemented                                                                
        BR margin, max                            : 0%                                                                                    
        BR margin, min                            : 0%                                                                                    
        Vendor SN                                 : GPON25101036                                                                          
        Date code                                 : 251018