Help adjusting dts for ZBT WE826 (mt7620a + mt7612e)

I have MT7612E 5GHz AC mPCIE board which is not recognized in ZBT WE826.
Initially I thought that this a limitation of the board hardware, MT7612E not detected on WE826

After reading some posts, especially this one Help completing dts for ZyXEL WRE6505 (mt7620a + mt7610e), I started thinking that changing the board .dts might help me.

I've tried to simply add some code as suggested by @systemcrash here Help completing dts for ZyXEL WRE6505 (mt7620a + mt7610e)

&pcie0 {
        mt76@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                ieee80211-freq-limit = <5000000 6000000>;
                mtd-mac-address = <&factory 0x8004>;
                //mtd-mac-address-increment = <(-1)>;
        };
};

but that didn't help. I recall it was a compilation error related to 0 in "&pcie0".
Can someone help with this please?

As the error suggests, you are wrong with pcie0.
The main dtsi file for mt7620a does only have pcie, so use pcie instead of pcie0 for your reference.
I'm not sure if it's the only adoption needed, but give it a try...

Fixed my .dts and built the image without errors. Still no luck:

[    0.607113] mt7620-pci 10140000.pcie: PCIE0 no card, disable it(RST&CLK)
[    0.613613] mt7620-pci: probe of 10140000.pcie failed with error -1

Sorry for my wrong info... The mt7620a.dtsi does have pcie0 label inside the pcie node...
I might have overseen this on my tiny mobile screen.

Take a look here:

I don't know why you had a compilation error with the used label pcie0...?

Could you post the content of modified dts file which you have used before with the unformatted text function?

Juppi, you're referring to master while I was using 18.06.4 where this file is slightly different.
Now I switched to master, this is the code I'm using at the moment:

&pcie0 {
	mt76@0,0 {
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;
		mtd-mac-address = <&factory 0x8004>;
		//mtd-mac-address-increment = <(-1)>;
        };
};

Result is the same as it was before.

As far as i can see the main difference on master is another file name and the spi part look a bit different...

I´ve seen your code before, but to understand why the compilation error occurs i wanna see the full code of the file and which file you have modified...

Do you have the above code snipped appended to ZBT-WE826-16M.dts, ZBT-WE826-32M.dts or ZBT-WE826.dtsi? Or to mt7620a.dtsi?

There is no compilation error anymore, the card simply not recognized, my log output is still the same as I posted earlier here Help adjusting dts for ZBT WE826 (mt7620a + mt7612e)

I'm changing mt7620a_zbtlink_zbt-we826-16m.dts only
Complete file https://pastebin.com/dAL6aCcB

Just to be on a safe side - is it OK to just re-run make after changing my .dts ?

Do you have the needed drivers installed in your image?
I think you would need kmod-mt76x2...

Looks good so far, you could add a compatible property to your mt76@0,0 node like (not sure if it´s necessary):

&pcie0 {
    mt76@0,0 {
        compatible = "mediatek,mt76";
        ...
    };
};

Added the line as suggested, still no changes.
Driver is there:

root@OpenWrt:~# lsmod | grep mt76
cfg80211              253049  5 rt2x00lib,mt76x02_lib,mt7603e,mt76,mac80211
mac80211              481953  9 rt2800lib,mt76x0e,mt76x0_common,rt2x00soc,rt2x00lib,mt76x2e,mt76x02_lib,mt7603e,mt76
mt76                   27951  6 mt76x0e,mt76x0_common,mt76x2e,mt76x2_common,mt76x02_lib,mt7603e
mt7603e                37310  0 
mt76x0_common          29749  1 mt76x0e
mt76x02_lib            40721  4 mt76x0e,mt76x0_common,mt76x2e,mt76x2_common
mt76x0e                 3633  0 
mt76x2_common          11560  1 mt76x2e
mt76x2e                10545  0 

The above regards address 10140000 for PCIe0. You are quite certain your device is 7620a based? Please paste a kernel log from bootup here... (not on pastebin thanks)

It seems you have not yet provided the correct DTS portion or PCI address to access the 7612e device. Check other 7612e based devices what they have exposed to see what you need to add. 7612e is a SoC, so it's quite likely the device addresses will be identical to that of other devices.

7620 = 2.4GHz, while 7612e = 5GHz only.

The DTS file target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi in the tree for your device contains:

&pcie {
        status = "okay";
};

It just so happens that my 7610e device is chained to PCIe. That may or may not be the case with your device. I checked the 7612e datasheet, and it seems very PCIe capable...

You could try building the kernel and modules to include the lspci tool.

make menuconfig --> Utilities -> check pciutils

then once booted, lspci -vvk

Yes, this is a 7620a based device. According to this page it can work with mt7612e:

Note : Original device is coming with empty mpci-e slot but can be supplied with MT7612E

[    0.000000] Linux version 4.14.141 (andrewz@zbox) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r10975-681acdcc54)) #0 Mon Sep 9 07:38:55 2019
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is ZBT-WE826 (16M)
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000] free_area_init_node: node 0, pgdat 804e14f0, node_mem_map 81000040
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a0 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0001b025
[    0.000000] Readback ErrCtl register=0001b025
[    0.000000] Memory: 123268K/131072K available (3916K kernel code, 191K rwdata, 892K rodata, 1200K init, 213K bss, 7804K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007589] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.073553] pid_max: default: 32768 minimum: 301
[    0.078317] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084692] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.098453] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.108011] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.114030] pinctrl core: initialized pinctrl subsystem
[    0.119647] NET: Registered protocol family 16
[    0.608249] mt7620-pci 10140000.pcie: PCIE0 no card, disable it(RST&CLK)
[    0.614755] mt7620-pci: probe of 10140000.pcie failed with error -1
[    0.640343] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.645805] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.652130] rt2880_gpio 10000638.gpio: registering 16 gpios
[    0.657553] rt2880_gpio 10000638.gpio: registering 16 irq handlers
[    0.663834] rt2880_gpio 10000688.gpio: registering 1 gpios
[    0.669165] rt2880_gpio 10000688.gpio: registering 1 irq handlers
[    0.680244] clocksource: Switched to clocksource systick
[    0.686715] NET: Registered protocol family 2
[    0.691831] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.698557] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.704784] TCP: Hash tables configured (established 1024 bind 1024)
[    0.711090] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.716717] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.723192] NET: Registered protocol family 1
[    0.727388] PCI: CLS 0 bytes, default 32
[    0.730476] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.737230] Crashlog allocated RAM at address 0x3f00000
[    0.744267] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.757740] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.763402] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.785790] io scheduler noop registered
[    0.789539] io scheduler deadline registered (default)
[    0.795456] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.802787] console [ttyS0] disabled
[    0.806245] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.815926] console [ttyS0] enabled
[    0.822958] bootconsole [early0] disabled
[    0.837118] spi spi0.0: force spi mode3
[    0.850629] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.855482] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.861988] Creating 4 MTD partitions on "spi0.0":
[    0.866888] 0x000000000000-0x000000030000 : "u-boot"
[    0.872975] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.879264] 0x000000040000-0x000000050000 : "factory"
[    0.885413] 0x000000050000-0x000001000000 : "firmware"
[    0.894874] 2 uimage-fw partitions found on MTD device firmware
[    0.900994] Creating 2 MTD partitions on "firmware":
[    0.906073] 0x000000000000-0x000000197944 : "kernel"
[    0.912120] 0x000000197944-0x000000fb0000 : "rootfs"
[    0.917994] mtd: device 5 (rootfs) set to be root filesystem
[    0.925577] 1 squashfs-split partitions found on MTD device rootfs
[    0.931969] 0x00000044f000-0x000000fb0000 : "rootfs_data"
[    0.939282] libphy: Fixed MDIO Bus: probed
[    0.953020] gsw: setting port4 to ephy mode
[    0.957341] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 0 link up (100Mbps/Full duplex)
[    0.966966] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    0.973753] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.982774] rt2880_wdt 10000120.watchdog: Initialized
[    0.989305] NET: Registered protocol family 10
[    0.998132] Segment Routing with IPv6
[    1.002070] NET: Registered protocol family 17
[    1.006681] 8021q: 802.1Q VLAN Support v1.8
[    1.027121] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    1.041087] Freeing unused kernel memory: 1200K
[    1.045711] This architecture does not have kernel memory protection.
[    2.670198] random: fast init done
[    2.819839] init: Console is alive
[    2.823736] init: - watchdog -
[    5.160541] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.429452] usbcore: registered new interface driver usbfs
[    5.435215] usbcore: registered new interface driver hub
[    5.440800] usbcore: registered new device driver usb
[    5.452393] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.461105] ehci-platform: EHCI generic platform driver
[    5.476834] phy phy-usbphy.0: remote usb device wakeup disabled
[    5.482907] phy phy-usbphy.0: UTMI 16bit 30MHz
[    5.487460] ehci-platform 101c0000.ehci: EHCI Host Controller
[    5.493376] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    5.501594] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    5.515767] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    5.523211] hub 1-0:1.0: USB hub found
[    5.527616] hub 1-0:1.0: 1 port detected
[    5.534939] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.543130] ohci-platform: OHCI generic platform driver
[    5.548868] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    5.555882] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    5.564073] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    5.597834] hub 2-0:1.0: USB hub found
[    5.602208] hub 2-0:1.0: 1 port detected
[    5.643322] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    5.654949] init: - preinit -
[    6.440223] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    6.810444] hub 1-1:1.0: USB hub found
[    6.822493] hub 1-1:1.0: 4 ports detected
[    6.976747] random: procd: uninitialized urandom read (4 bytes read)
[    7.595291] 8021q: adding VLAN 0 to HW filter on device eth0
[   10.487605] jffs2: notice: (413) jffs2_build_xattr_subsystem: complete building xattr subsystem, 3 of xdatum (1 unchecked, 1 orphan) and 4 of xref (1 dead, 0 orphan) found.
[   10.506443] mount_root: switching to jffs2 overlay
[   10.545173] overlayfs: upper fs does not support tmpfile.
[   10.562819] urandom-seed: Seeding with /etc/urandom.seed
[   10.678109] procd: - early -
[   10.682101] procd: - watchdog -
[   11.155868] procd: - watchdog -
[   11.159430] procd: - ubus -
[   11.485435] random: ubusd: uninitialized urandom read (4 bytes read)
[   11.494993] random: ubusd: uninitialized urandom read (4 bytes read)
[   11.503077] random: ubusd: uninitialized urandom read (4 bytes read)
[   11.511097] procd: - init -
[   12.572555] kmodloader: loading kernel modules from /etc/modules.d/*
[   12.603605] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   12.634892] Loading modules backported from Linux version v5.3-rc4-0-gd45331b00ddb
[   12.642702] Backport generated by backports.git v5.3-rc4-1-0-g4ec72687
[   12.659936] urngd: jent-rng init failed, err: 2
[   12.668319] ip_tables: (C) 2000-2006 Netfilter Core Team
[   12.683798] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[   12.761966] xt_time: kernel timezone is -0000
[   12.932254] PPP generic driver version 2.4.2
[   12.940126] NET: Registered protocol family 24
[   12.984176] rt2800_wmac 10180000.wmac: loaded eeprom from mtd device "factory"
[   12.991636] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[   12.999575] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[   13.007313] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   13.025979] kmodloader: done loading kernel modules from /etc/modules.d/*
[   22.283195] 8021q: adding VLAN 0 to HW filter on device eth0
[   22.310131] br-lan: port 1(eth0.1) entered blocking state
[   22.315911] br-lan: port 1(eth0.1) entered disabled state
[   22.321803] device eth0.1 entered promiscuous mode
[   22.326760] device eth0 entered promiscuous mode
[   22.346450] br-lan: port 1(eth0.1) entered blocking state
[   22.351976] br-lan: port 1(eth0.1) entered forwarding state
[   22.357957] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   23.326269] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

I spent hours checking .dts files for the similar devices without success.
I have this card working in u7628 router (mt7628 based) without any tricks or modifications, here is the corresponding .dtsi
Another similar device seems to be WE1026-5G, it uses exactly the same 5GHz card. PCI configuration is in this .dtsi

I already have pciutils included:

# lspci -vvk
{nothing}

Boot the OEM firmware, see what it spits out on boot-up. And see if the 5GHz card functions there. Perhaps it needs to be re-seated?

OK, sorted out. Some important data lines on PCB have resistors missing, i.e. they are not connected.
You can see some empty pads above the connector. They are related to the following signals:
11 REFCLK-
13 REFCLK+
23 PERn0
25 PERp0
31 PETn0
33 PETp0

Many thanks for all who provided their assistance.

1 Like