Mt7621 and reading sfp eeprom

Trying to make working SFP in SNR CPE-ME2-SFP.
PR: https://github.com/openwrt/openwrt/pull/12036

SFP supply is working and GPIOs looks like to be correct (eject works), also SFP module's info is printed to dmesg correctly, but I am getting error -22 while its initialization.

Thank you for any help.

Installing kmod-phy-realtek might resolve this. If so you should also add it to the default package set for this device. If not please install mdio-utils and see if the RealTek PHY is actually present on address 7 on the bus.

Thanks for the reply.

Unfortunately, it did not help. And I cannot see any id's using mdio:

root@OpenWrt:~# mdio
fixed-0
i2c:sfp1
mdio-bus
mt7530-0
root@OpenWrt:~# mdio *
 DEV      PHY-ID  LINK
root@OpenWrt:~# mdio i2c:sfp1
ERROR: Unable to read status (-145)

Try with: mdio mdio-bus and mdio mt7530-0

Thanks! It was wrong id (set to 0 and it worked).

I don't know is it supposed to be so or not.

Reading EEPROM of sfp module is not working. Manufacture's firmware does not support it too, but kernel driver sfp reads module info. Is is possible to get it working?

root@OpenWrt:~# ethtool -i sfp
driver: mtk_soc_eth
version: 5.15.93
firmware-version: 
expansion-rom-version: 
bus-info: 1e100000.ethernet
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
root@OpenWrt:~# ethtool sfp
Settings for sfp:
        Supported ports: [ TP    AUI     MII     FIBRE   BNC     Backplane ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
                                1000baseX/Full
                                100baseT1/Full
                                1000baseT1/Full
                                100baseFX/Half 100baseFX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Half
        Auto-negotiation: off
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: no
root@OpenWrt:~# ethtool -m sfp
netlink error: Not supported
root@OpenWrt:~# 

Line from dmesg:

[   10.057209] sfp sfp1: module FANG HANG        FH-SB3512CDS3    rev A0   sn FS12##0908#####  dc 1###20

Driver does not support reading EEPROM. Closing.

1 Like

Since the port is reported as MII, it has not been switched to SFP (FIBRE) in the kernel's perception. It looks like the device is trying to read on a MTK NIC that doesn't support eeprom reading.

Note: on the realtek target device, ethtool -i <port> reports supports-eeprom-access: no but eeprom on SFP module can be read via i2c

root@OpenWrt:/# ethtool -m lan17
        Identifier                                : 0x03 (SFP)
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
        Connector                                 : 0x07 (LC)
        Transceiver codes                         : 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00
        Transceiver type                          : Ethernet: 1000BASE-SX
        Encoding                                  : 0x01 (8B/10B)
        BR, Nominal                               : 1300MBd
        Rate identifier                           : 0x00 (unspecified)
        Length (SMF,km)                           : 0km
        Length (SMF)                              : 0m
        Length (50um)                             : 550m
        Length (62.5um)                           : 270m
        Length (Copper)                           : 0m
        Length (OM3)                              : 0m
        Laser wavelength                          : 850nm
        Vendor name                               : CISCO-FINISAR
        Vendor OUI                                : 00:90:65
        Vendor PN                                 : FTLF8519P2BCL-CS
        Vendor rev                                : 0000
        Option values                             : 0x00 0x12
        Option                                    : RX_LOS implemented
        Option                                    : TX_DISABLE implemented
        BR margin, max                            : 0%
        BR margin, min                            : 0%
        Vendor SN                                 : FNSxxxxxxxx
        Date code                                 : 070630

As I pointed out in the issue, it's simply as SFP support in at803x was not backported to OpenWrt so it's not actually attaching the SFP bus at all, and thus ethtool cannot access it.

1 Like

It is true, but only for rb760igs with AR8033 PHY. SNR CPE-ME2-SFP uses other PHY - RTL8211FS. It is used by realtek driver. Latest kernel does not seem to support SFP too.

But I asked explicitly what is the PHY that SFP is hooked up to and I got the reply that its AR8033.
If its Realtek, then support needs to be added, its rather simple to add it

It's actually packaged as a kernel module in kmod-phy-realtek and installing this package should be sufficient. There is no need to have this driver built-into the kernel unless this is the only Ethernet port the device offers (in such case we do want it built-in for failsafe mode to work before any modules have been loaded).

I meant, SFP support needs to be added to the Realtek PHY driver, not the driver to OpenWrt.
As it does not register sfp_upstream_ops which would actually attach the SFP bus that is set in the DTS.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.