SFP OEM SFP-2.5G-T kernel PHY?

To make the RTL8221B work on systems where the PHY is on-board rather than inside an SFP module (like GL-iNet MT-6000 or TP-LINK XDR608x) I still have to either patch phylink to enable in-band-status on the MAC/PCS side anyway (rather than relying only on out-of-band status which seems to be what Linux usually does) or configure the PHY to not use in-band-status as in this patch:

(it may need some love to conditionally enable/disable SGMII in-band-status)

Yep, solving the inband status/an issue is something that I would like to have also. But because the standard for it came very late, now all hardware handles it in different ways, and it now cannot be solved easily.

To get this patch-set to be accepted, I’ll leave the entire inband issue out of this patch-set, same as Marek’s patch-set.

If you still need 8221B’s datasheet…

Also, how did they make it to access phy registers using i2c….? 8221B doesn’t support i2c at all.

They used a mcu with RollBall protocol.

1 Like

@ericwoud Can you also add SFP-2.5G-T-R-RM to your fixup patch series? It seems completely same with SFP-2.5G-T.

root@OpenWrt:~# ethtool -m sfp2
        Identifier                                : 0x03 (SFP)
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
        Connector                                 : 0x07 (LC)
        Transceiver codes                         : 0x00 0x01 0x00 0x00 0x00 0x00 0x02 0x00 0x00
        Transceiver type                          : SONET: OC-48, short reach
        Encoding                                  : 0x05 (SONET Scrambled)
        BR, Nominal                               : 2500MBd
        Rate identifier                           : 0x00 (unspecified)
        Length (SMF,km)                           : 0km
        Length (SMF)                              : 0m
        Length (50um)                             : 300m
        Length (62.5um)                           : 200m
        Length (Copper)                           : 0m
        Length (OM3)                              : 0m
        Laser wavelength                          : 850nm
        Vendor name                               : OEM
        Vendor OUI                                : 00:00:00
        Vendor PN                                 : SFP-2.5G-T-R-RM
        Vendor rev                                : 1.0
        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                                 : 2401050130
        Date code                                 : 240105
        Optical diagnostics support               : Yes
        Laser bias current                        : 6.000 mA
        Laser output power                        : 0.5000 mW / -3.01 dBm
        Receiver signal average optical power     : 0.4000 mW / -3.98 dBm
        Module temperature                        : 42.25 degrees C / 108.05 degrees F
        Module voltage                            : 3.3505 V
        Alarm/warning flags implemented           : Yes
        Laser bias current high alarm             : Off
        Laser bias current low alarm              : Off
        Laser bias current high warning           : Off
        Laser bias current low warning            : Off
        Laser output power high alarm             : Off
        Laser output power low alarm              : Off
        Laser output power high warning           : Off
        Laser output power low warning            : Off
        Module temperature high alarm             : Off
        Module temperature low alarm              : Off
        Module temperature high warning           : Off
        Module temperature low warning            : Off
        Module voltage high alarm                 : Off
        Module voltage low alarm                  : Off
        Module voltage high warning               : Off
        Module voltage low warning                : Off
        Laser rx power high alarm                 : Off
        Laser rx power low alarm                  : Off
        Laser rx power high warning               : Off
        Laser rx power low warning                : Off
        Laser bias current high alarm threshold   : 15.000 mA
        Laser bias current low alarm threshold    : 1.000 mA
        Laser bias current high warning threshold : 13.000 mA
        Laser bias current low warning threshold  : 2.000 mA
        Laser output power high alarm threshold   : 1.9952 mW / 3.00 dBm
        Laser output power low alarm threshold    : 0.1584 mW / -8.00 dBm
        Laser output power high warning threshold : 1.5848 mW / 2.00 dBm
        Laser output power low warning threshold  : 0.1778 mW / -7.50 dBm
        Module temperature high alarm threshold   : 95.00 degrees C / 203.00 degrees F
        Module temperature low alarm threshold    : -50.00 degrees C / -58.00 degrees F
        Module temperature high warning threshold : 90.00 degrees C / 194.00 degrees F
        Module temperature low warning threshold  : -45.00 degrees C / -49.00 degrees F
        Module voltage high alarm threshold       : 3.6000 V
        Module voltage low alarm threshold        : 3.0000 V
        Module voltage high warning threshold     : 3.5000 V
        Module voltage low warning threshold      : 3.1000 V
        Laser rx power high alarm threshold       : 1.1220 mW / 0.50 dBm
        Laser rx power low alarm threshold        : 0.0199 mW / -17.01 dBm
        Laser rx power high warning threshold     : 1.0000 mW / 0.00 dBm
        Laser rx power low warning threshold      : 0.0223 mW / -16.52 dBm
root@OpenWrt:~# i2cdump -y 2 0x56
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 20 58 00 06 00 1c c8 49 20 70 00 8a 80 00 00 30     X.?.??I p.??..0
10: 82 00 00 00 00 00 41 a0 00 00 00 00 00 1c c8 49    ?.....A?.....??I
20: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00    ...........?....
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

Thanks, but could you first try it first? You could just replace the string in sfp.c

Does it have any brand name on the label? Or does it come from a particular store or have any other marking that this module can be recognized?

Edit: Anyway net-next is closed until 25 march, so we still have some time for it…

No brand name, and same label design as SFP-2.5G-T. I bought that from BPI’s official taobao store. And photos in the store page are also using SFP-2.5G-T rather than SFP-2.5G-T-R-RM.

Besides, how do you test your patches? I have no clue about how to backport your patches to openwrt’s 5.15…

Isn’t this patch already in openwrt for the BPI-R3 / R4?

Seems not… I didn’t find that.

If I prepare a linux image, can you use that? Btw, I use ArchlinuxArm…

Yes, I can test that. I’m using bpi-r3

Ok, but these days I’m quite busy, but within a couple of days I’ll have one ready. Will let you know here.

I’ve added the patch here:

Add another module, SFP-2.5G-T-R-RM (BPI store) · ericwoud/linux@f259247 (github.com)

1 Like

@Stat_headcrabed @clo :

New images are generated here:

https://www.woudstra.mywire.org/images

Or if you only want the kernel:

https://www.woudstra.mywire.org/repo/aarch64

linux-bpir64-git-6.7.9.bpi.xxxxxxxxxxx.aarch64.pkg.tar.xz file. It is an archlinux package, but also a simple archive you can extract the linux image and modules from.

1 Like

Seems working correctly:

[  259.254593] sfp sfp-2: module OEM              SFP-2.5G-T-R-RM  rev 1.0  sn 2401050130       dc 240105  
[  259.303890] hwmon hwmon1: temp1_input not attached to any thermal zone
[  264.200000] mt7530-mdio mdio-bus:1f lan4: switched to phy/2500base-x link mode
[  265.369926] mt7530-mdio mdio-bus:1f lan4: PHY [i2c:sfp-2:11] driver [RTL8221B-VB-CG 2.5Gbps PHY (C45)] (irq=POLL)
[  272.759918] mt7530-mdio mdio-bus:1f lan4: No phy led trigger registered for speed(100)
[  272.860118] mt7530-mdio mdio-bus:1f lan4: Link is Up - 100Mbps/Full - flow control rx/tx
[  272.868285] brlan: port 6(lan4) entered blocking state
[  272.873418] brlan: port 6(lan4) entered forwarding state
[  296.599435] mt7530-mdio mdio-bus:1f lan4: Link is Down
[  296.604701] brlan: port 6(lan4) entered disabled state
[  315.159919] mt7530-mdio mdio-bus:1f lan4: No phy led trigger registered for speed(1000)
[  315.260114] mt7530-mdio mdio-bus:1f lan4: Link is Up - 1Gbps/Full - flow control rx/tx
[  315.268103] brlan: port 6(lan4) entered blocking state
[  315.273235] brlan: port 6(lan4) entered forwarding state
[  347.007322] mt7530-mdio mdio-bus:1f lan4: Link is Down
[  347.012707] brlan: port 6(lan4) entered disabled state
[  366.119920] mt7530-mdio mdio-bus:1f lan4: No phy led trigger registered for speed(1000)
[  366.220108] mt7530-mdio mdio-bus:1f lan4: Link is Up - 1Gbps/Full - flow control rx/tx
[  366.228097] brlan: port 6(lan4) entered blocking state
[  366.233232] brlan: port 6(lan4) entered forwarding state
[  413.478011] mt7530-mdio mdio-bus:1f lan4: Link is Down
[  413.639945] brlan: port 6(lan4) entered disabled state
[  417.559916] mt7530-mdio mdio-bus:1f lan4: No phy led trigger registered for speed(2500)
[  417.670114] mt7530-mdio mdio-bus:1f lan4: Link is Up - 2.5Gbps/Full - flow control rx/tx
[  417.678274] brlan: port 6(lan4) entered blocking state
[  417.683410] brlan: port 6(lan4) entered forwarding state

And if you want a tested-by:

Tested-by: Shengyu Qu <[email protected]>

Thanks!

Could you try changing advertisement to 1000mbps and lower 0x28 I believe, with ethtool?

Check if interface switching also works…

Well your image didn’t include ethtool… and I’m not sure how to configure to use pppoe to connect to the internet :joy:

Connect wan port to your router.

pacman -Sy ethtool

Where wan is either wan port or eth1, depending which image you used.

cat /etc/systems/network/*.nft
1 Like

Well, the problem is your image doesn’t include ppp package so that I cannot connect to internet…

You do not need to replace your router. You can cascade the routers.

Connect the wan port of the R3 to a lan port of your active router that uses PPP to connect to the internet.

Image bpir3-sdmmc-rtnosfp.img has wan port as wan, bpir3-sdmmc-rt.img has eth1 sfp port as wan.

It uses DHCP to get an IP from your active router and then the R3 will have internet access. Just like connecting any other client on a lan port