ER-X-SFP - SFP (eth5) port has link-state (LED = lit), but swconfig says link: port:5 link:down

Hi,

Am trying to replace my FttH fiber-to-copper media convertor with an ER-X-SFP. With stock firmware, this works.
However, with LEDE I find that switch driver MT7530 doesn't have function implemented to set specific link options.

As for SFP auto-negotiate doesn't work, it's required to set eth5 to static speed / duplex settings.

Anybody would like to help out either creating a function in the driver to allow setting link options on the switch for individual ports, or some other way to have eth5 be able to be set to static link setting instead of auto-negotiate?

1 Like

Have you tried with ethtool?

Ethtool won't work; there's one interface eth0, and physical ports are not individually published.
As I mentioned, when I look at the switch driver it shows that there's no implementation for setting link options. There's only ability to read the link options of the switch.

I found perhaps some useful url from MediaTek's 7530 driver author which implements various other options of the MT7530 switch, incl port disable/enable and bridging.
But I think this requires some rewriting the LEDE's version of the driver.

https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+/2ea659a9ef488125eb46da6eb571de5eae5c43f6/drivers/net/dsa/mt7530.c

static void mt7530_adjust_link(struct dsa_switch *ds, int port,
struct phy_device *phydev)

Update, now have 2 ER-X SFP's hooked up together on SFP and finally do get an link-state through auto-nego.
1 ERX SFP is running stock firmware, latest + bootloader 1.8.0 patch.
1 ERX SFP is running LEDE snapshot build (July 2nd), bootloader 1.8.0 patch

Though, I now have a link-state - eth5 LED is lit on both devices - , in LEDE swconfig shows link:down for eth5 (port 5).
Already configured an interface specifically for the SFP, together with vlan config, but... it doesn't show it's connected.

Anybody got an idea what to do??

Dmesg output:

[    0.000000] Linux version 4.4.74 (buildbot@builds) (gcc version 5.4.0 (LEDE GCC 5.4.0 r4446-0406382) ) #0 SMP Sun Jul 2 21:10:06 2017
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is UBNT-ERX-SFP
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 10000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000] free_area_init_node: node 0, pgdat 8048f100, node_mem_map 81000000
[    0.000000]   Normal zone: 512 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] PERCPU: Embedded 10 pages/cpu @8120c000 s8400 r8192 d24368 u40960
[    0.000000] pcpu-alloc: s8400 r8192 d24368 u40960 alloc=10*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Writing ErrCtl register=000542d8
[    0.000000] Readback ErrCtl register=000542d8
[    0.000000] Memory: 254324K/262144K available (3730K kernel code, 206K rwdata, 860K rodata, 248K init, 256K bss, 7820K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:256
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
[    0.010000] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.070000] pid_max: default: 32768 minimum: 301
[    0.070000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.090000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.090000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.090000] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.180000] Synchronize counters for CPU 1: done.
[    0.190000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.190000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.190000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.190000] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.280000] Synchronize counters for CPU 2: done.
[    0.290000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.290000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.290000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.290000] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.380000] Synchronize counters for CPU 3: done.
[    0.390000] Brought up 4 CPUs
[    0.390000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.400000] futex hash table entries: 1024 (order: 3, 32768 bytes)
[    0.410000] pinctrl core: initialized pinctrl subsystem
[    0.420000] NET: Registered protocol family 16
[    0.430000] FPU Affinity set after 11720 emulations
[    0.490000] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.500000] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.510000] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.520000] clocksource: Switched to clocksource GIC
[    0.540000] NET: Registered protocol family 2
[    0.550000] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.560000] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.570000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.580000] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.600000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.610000] NET: Registered protocol family 1
[    0.620000] PCI: CLS 0 bytes, default 32
[    0.620000] Crashlog allocated RAM at address 0x3f00000
[    0.640000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.650000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.670000] io scheduler noop registered
[    0.680000] io scheduler deadline registered (default)
[    0.690000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.700000] console [ttyS0] disabled
[    0.710000] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 33, base_baud = 3125000) is a 16550A
[    0.730000] console [ttyS0] enabled
[    0.740000] bootconsole [early0] disabled
[    0.760000] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    0.770000] Allocate 16 byte aligned buffer: 80524290
[    0.780000] Enable NFI Clock
[    0.790000] # MTK NAND # : Use HW ECC
[    0.800000] Device found in MTK table, ID: 1da, EXT_ID: 909546
[    0.810000] Support this Device in MTK table! 1da
[    0.820000] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
[    0.830000] nand: AMD/Spansion NAND 256MiB 3,3V 8-bit
[    0.840000] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 128
[    0.860000] [NAND]select ecc bit:12, sparesize :112 spare_per_sector=28
[    0.870000] Scanning device for bad blocks
[    1.570000] 6 ofpart partitions found on MTD device MT7621-NAND
[    1.580000] Creating 6 MTD partitions on "MT7621-NAND":
[    1.590000] 0x000000000000-0x000000080000 : "u-boot"
[    1.610000] 0x000000080000-0x0000000e0000 : "u-boot-env"
[    1.620000] 0x0000000e0000-0x000000140000 : "factory"
[    1.630000] 0x000000140000-0x000000440000 : "kernel1"
[    1.640000] 0x000000440000-0x000000740000 : "kernel2"
[    1.650000] 0x000000740000-0x00000ff00000 : "ubi"
[    1.660000] [mtk_nand] probe successfully!
[    1.670000] Signature matched and data read!
[    1.680000] load_fact_bbt success 2047
[    1.690000] netif_napi_add() called with weight 128 on device eth%d
[    1.710000] libphy: mdio: probed
[    3.120000] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    3.130000] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 10
[    3.150000] mt7621_wdt 1e000100.wdt: Initialized
[    3.160000] NET: Registered protocol family 10
[    3.170000] NET: Registered protocol family 17
[    3.180000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    3.200000] 8021q: 802.1Q VLAN Support v1.8
[    3.220000] UBI: auto-attach mtd5
[    3.220000] ubi0: attaching mtd5
[    4.680000] mtk_soc_eth 1e100000.ethernet eth0: port 0 link up
[    4.830000] mtk_soc_eth 1e100000.ethernet eth0: port 1 link up
[    5.660000] ubi0: scanning is finished
[    5.690000] ubi0: attached mtd5 (name "ubi", size 247 MiB)
[    5.700000] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    5.710000] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    5.730000] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    5.740000] ubi0: good PEBs: 1982, bad PEBs: 0, corrupted PEBs: 0
[    5.750000] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    5.770000] ubi0: max/mean erase counter: 5/3, WL threshold: 4096, image sequence number: 1738372349
[    5.790000] ubi0: available PEBs: 0, total reserved PEBs: 1982, PEBs reserved for bad PEB handling: 40
[    5.810000] ubi0: background thread "ubi_bgt0d" started, PID 326
[    5.820000] block ubiblock0_0: created from ubi0:0(rootfs)
[    5.830000] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    5.840000] hctosys: unable to open rtc device (rtc0)
[    5.860000] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    5.870000] Freeing unused kernel memory: 248K (804b2000 - 804f0000)
[    6.530000] init: Console is alive
[    6.540000] init: - watchdog -
[    6.690000] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    6.750000] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    6.780000] init: - preinit -
[    9.190000] random: procd: uninitialized urandom read (4 bytes read, 29 bits of entropy available)
[    9.200000] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 383
[    9.270000] UBIFS (ubi0:1): recovery needed
[    9.440000] UBIFS (ubi0:1): recovery completed
[    9.450000] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[    9.460000] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    9.480000] UBIFS (ubi0:1): FS size: 243032064 bytes (231 MiB, 1914 LEBs), journal size 12189696 bytes (11 MiB, 96 LEBs)
[    9.500000] UBIFS (ubi0:1): reserved for root: 4952683 bytes (4836 KiB)
[    9.520000] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID EE6BF86D-7DA9-49D4-ABD1-74A868919E7D, small LPT model
[    9.550000] mount_root: switching to ubifs overlay
[    9.570000] urandom-seed: Seeding with /etc/urandom.seed
[    9.670000] procd: - early -
[    9.670000] procd: - watchdog -
[   10.330000] procd: - watchdog -
[   10.330000] procd: - ubus -
[   10.390000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.410000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.430000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.440000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.460000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.480000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.500000] random: ubusd: uninitialized urandom read (4 bytes read, 33 bits of entropy available)
[   10.520000] procd: - init -
[   10.710000] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.720000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   10.740000] i2c /dev entries driver
[   10.750000] pca953x 0-0025: interrupt support not compiled in
[   10.760000] i2c-gpio i2c-gpio: using pins 3 (SDA) and 4 (SCL)
[   10.780000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.790000] nf_conntrack version 0.5.0 (3977 buckets, 15908 max)
[   10.830000] xt_time: kernel timezone is -0000
[   10.850000] PPP generic driver version 2.4.2
[   10.860000] NET: Registered protocol family 24
[   10.870000] kmodloader: done loading kernel modules from /etc/modules.d/*
[   12.340000] random: jshn: uninitialized urandom read (4 bytes read, 47 bits of entropy available)
[   12.410000] random: ubusd: uninitialized urandom read (4 bytes read, 47 bits of entropy available)
[   15.440000] device eth0.1 entered promiscuous mode
[   15.450000] device eth0 entered promiscuous mode
[   15.460000] br-lan: port 1(eth0.1) entered forwarding state
[   15.470000] br-lan: port 1(eth0.1) entered forwarding state
[   17.470000] br-lan: port 1(eth0.1) entered forwarding state
[   20.650000] random: nonblocking pool is initialized
  • bump - anybody?

https://lwn.net/Articles/719278/
It says that MT7530 has 4 PHY Ethernet interfaces and two CPU interfaces. So, probably there's another chip responsible for the SFP interface, and the CPU should be able to see it and configure its parameters. I'll have one device in my hands tomorrow, will try to read the chip names on the board.

Thank you, Stanislav!

I also figured this out meanwhile that the SFP is connected through a different chip to the CPU: AR8033-AL1A

It is located next to the console headers on other side of the pcb, not near the SFP cage.

Here’s the datasheet for this IC: https://datasheet.octopart.com/AR8033-AL1A-Qualcomm-datasheet-13029894.pdf

Support for this IC is not by default in the ER-X-SFP profile, not enabled. Tried to enable it, but somehow it compiled without.
Also expect that the dtsi needs changes to accommodate – I think – the SGMII interface for the fiber. Perhaps you could help me out as I don’t fully understand this yet how to integrate support for this type of interface.

Thanks in advance for your help!

Kind regards,

Herman van Drie

Have you got the dts public?
I dont think that driver for the AR803X series is built by default for ramips at all.
Are you sure that it uses SGMII instead of RGMII as MT7621 only has RGMII interface

haha @hvandrie I first opened the box, and then read the forum. I need to enable email notifications :slight_smile:

Indeed, it's AR8033-AL1A, that's what I was going to write :slight_smile:

robimarko, you could be right.

ssinyagin, found pin out design here: https://e2echina.ti.com/cfs-file/__key/telligent-evolution-components-attachments/00-25-01-00-00-28-63-19/AR8031_2D00_33_2D00_REF_2D00_DESIGN_2D00_V1.1.pdf

Am I right when SO P (pin 43) and SO N (pin 42) are not populated, that it is indeed RGMII connected on ER-X-SFP?

Its gotta be as MT7621 has not SGMII interface in the datasheet,only RGMII.
It could be as simple as setting a new RGMII interface and PLL clocks as well as including the driver

Than I don't understand why developer who initially did ER-X-SFP support patches not include these - I think - small(er) changes?
Am I right it's only modification to dts(i) and include AR803x module, plus maybe network script function change to assign port properly?

You dont even need to touch dtsi as non SFP model probably does not have the AR8033 PHY.
That should work(Ideally, I think that there is a PR where you can steal including the AR8216 driver from)

I'll try to fiddle around the build system on the weekend. Hints and links will be appreciated.

Not me, am on holiday until next week. When I saw the post, I couldn't resist to share info that I know in attempt to get some people onboard to help out to get this working.

Just setup your own build system using docs, very simple.
In the folder/file /target/linux/ramips/image/mt7621.mk you'll find the ER-X-SFP profile.

I tried to turn on the AR803x module through "/target/linux/ramips/mt7621/config-4.14" file (4.14 = kernel version) by adding the environment variable in (found in another profile) and attempted to build it, but somehow would not include it.

I can't test anything until 2nd part next week, than I'll have an ER-X-SFP in my hands again.

I would love to help,but I only got the non SFP model of ERX.
You cant simply just set configuration to yes since the driver is custom written and not available in all targets.
Adding this driver is needed to the ramips target

robimarko,

Am a bit new to this. The driver you refer to is in the general Linux target. So, I thought by setting the env variable to YES would include it in my build.
Could you please give few better pointers?
Do I need to copy the driver to ramips target separately?

Hm,it looks like you are right.
AT803X is in generic and CONFIG_AT803X_PHY=y should build it.
But,RGMII interface needs to be configured in order for the PHY to be detected.

You can see how AR8033 is configured for Open Mesh 5 AC v2
https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/dts/qca9558_om5p_ac.dts#L158
Just the mode is SGMII instead of RGMII

1 Like

but the ethernet adapter description in DTI requires an address for the device. How can I find it?