AsiaRF MT7916 on Pi CM4

Hi!

I'm trying to use a MT7916 from AsiaRF on a Raspberry Pi CM4 IO-Board with a PCIe to mPCIe adapter. I've exhausted all ideas I've had so far, where I'm always getting stuck at is this dmesg output:

[    4.893376] mt7915e 0000:01:00.0: enabling device (0140 -> 0142)
[    4.982712] page_pool_create() gave up with errno -22
[    4.987914] mt7915e: probe of 0000:01:00.0 failed with error -22

What Ive done is flashing the latest development snapshot firmware (also tried stable in 32 and 64bit) and installed the kmod-mt7916-firmware and all dependencies that come with it (includes mt76).
I've also checked that there's enough current capabilities on the board.
The only thing left I can think of is the missing usb wiring on my adapter. Is a usb port needed for those cards?

If you can try another pci wifi card - intel or any other you have around (from a laptop maybe) or try pluging the card in another board (if available- laptop maybe)

No.

I do know that those cards draw heavily on the 3.3v line. They require 3-3.5 amps at 3.3v. Many PCIe -> mPCIe adapters don't have 3.3v rails that will supply nearly that.

Can you share a good photo of your adapter?

That's good to know, I was wondering because the pinout of the card shows usb 2.0 pins, but my adapter doesn't route those out like some others do. That'ts the one:


The AMS1117 ldo on the left converts 3.3V from the pcie slot to 1.5V, but looking again at the pinout shows that the mt7916 card doesn't use it. The adapter is otherwise completely passive, so 3.3V comes from the IO-Board. According to the datasheet it is compliant with regular PCIe and does 3.3A on the 3.3V rail. From what I gather those currents are only relevant when transmitting full throttle, so shouldn't interfere with initialization in any case.

Yes, you're right, at the very least there should be enough there to bring up the card.

I've used these cards in several adapters, PCIe -> mPCIe, and m.2 -> mPCIe with no issues. Others, though, have had issues with MediaTek chipset cards on the CM4:

I just found an ancient artheros 802.11g card in my stash. Shows up and works..

Oh great find, after I switched from stable to dev snapshot the error changed from -12 to -22, so it might be the same issue.
Theres at least one instance where it seemed to work: https://twitter.com/will_whang/status/1599637385477705729 (Scroll up for the thread)
I should try to get in touch

How sure are you that usb is not needed for initialization? Looking at the board in the twitter link, usb seems to be wired up and the card physically has the usb pins connected on the mPCIe connector. Might be worth a try as that really is the only difference electrically I can make out.

Interestingly enough, my Wi-Fi 6 MediaTek MT7921K M.2 Card now works fine, both as AP and STA in a CM4 carrier board. At least since OpenWrt 22.03.5 release. I now get:

root@gateway2:~# dmesg | grep mt
[    7.809556] mt7921e 0000:06:00.0: enabling device (0000 -> 0002)
[    7.831994] mt7921e 0000:06:00.0: ASIC revision: 79610010
[    7.937876] mt7921e 0000:06:00.0: HW/SW Version: 0x8a108a10, Build Time: 20220311230842a
[    8.215731] mt7921e 0000:06:00.0: WM Firmware Version: ____010000, Build Time: 20220311230931

Much better.

Tried with another adapter and the card doesn't even show up in lsusb. So I guess usb isn't actually wired up unlike the pinout on the asiaRF site suggests.

Now it's back to error -12 with the latest snapshot :confused:

Still -12 with kernel 6.1 :confused:
Heres every pci related dmesg line:

...
[    0.175411] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[    0.175446] brcm-pcie fd500000.pcie:   No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[    0.175526] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x063fffffff -> 0x00c0000000
[    0.175572] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00ffffffff -> 0x0400000000
[    0.176255] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
[    0.176278] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.176299] pci_bus 0000:00: root bus resource [mem 0x600000000-0x63fffffff] (bus address [0xc0000000-0xffffffff])
[    0.176350] pci 0000:00:00.0: [14e4:2711] type 01 class 0x060400
[    0.176432] pci 0000:00:00.0: PME# supported from D0 D3hot
[    0.179949] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.180076] pci_bus 0000:01: supply vpcie3v3 not found, using dummy regulator
[    0.180203] pci_bus 0000:01: supply vpcie3v3aux not found, using dummy regulator
[    0.180257] pci_bus 0000:01: supply vpcie12v not found, using dummy regulator
[    0.237564] brcm-pcie fd500000.pcie: link up, 5.0 GT/s PCIe x1 (SSC)
[    0.237628] pci 0000:01:00.0: [14c3:7906] type 00 class 0x028000
[    0.237678] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit pref]
[    0.237719] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00007fff 64bit]
[    0.237755] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit pref]
[    0.237896] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    0.237977] pci 0000:01:00.0: 4.000 Gb/s available PCIe bandwidth, limited by 5.0 GT/s PCIe x1 link at 0000:00:00.0 (capable of 8.000 Gb/s with 5.0 GT/s PCIe x2 link)
[    0.238219] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.238260] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff]
[    0.238283] pci 0000:00:00.0: BAR 9: assigned [mem 0x600100000-0x6002fffff 64bit pref]
[    0.238308] pci 0000:01:00.0: BAR 0: assigned [mem 0x600100000-0x6001fffff 64bit pref]
[    0.238344] pci 0000:01:00.0: BAR 2: assigned [mem 0x600000000-0x600007fff 64bit]
[    0.238377] pci 0000:01:00.0: BAR 4: assigned [mem 0x600200000-0x600200fff 64bit pref]
[    0.238411] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.238428] pci 0000:00:00.0:   bridge window [mem 0x600000000-0x6000fffff]
[    0.238445] pci 0000:00:00.0:   bridge window [mem 0x600100000-0x6002fffff 64bit pref]
[    0.238615] pcieport 0000:00:00.0: enabling device (0000 -> 0002)
[    0.238757] pcieport 0000:00:00.0: PME: Signaling with IRQ 26
[    0.238985] pcieport 0000:00:00.0: AER: enabled with IRQ 26
...
[    5.060671] mt7915e 0000:01:00.0: enabling device (0000 -> 0002)
[    5.166050] mt7915e: probe of 0000:01:00.0 failed with error -12
...

And lspci -v:

01:00.0 Network controller: MEDIATEK Corp. Device 7906
	Subsystem: MEDIATEK Corp. Device 7906
	Flags: fast devsel, IRQ 26
	Memory at 600100000 (64-bit, prefetchable) [size=1M]
	Memory at 600000000 (64-bit, non-prefetchable) [size=32K]
	Memory at 600200000 (64-bit, prefetchable) [size=4K]
	Capabilities: [80] Express Endpoint, MSI 00
	Capabilities: [e0] MSI: Enable- Count=1/32 Maskable+ 64bit+
	Capabilities: [f8] Power Management version 3
	Capabilities: [100] Vendor Specific Information: ID=1556 Rev=1 Len=008 <?>
	Capabilities: [108] Latency Tolerance Reporting
	Capabilities: [110] L1 PM Substates
	Capabilities: [200] Advanced Error Reporting

Anyone got an idea where to continue digging?

Have you asked the vendor/oem?

No, though I created a github issue: https://github.com/openwrt/mt76/issues/790

12 is ENOMEM. There are probably a number of reasons that could happen. For example in mt7915_mmio_probe() which is called at about the right time to match that log (right after enabling the PCI device). But the problem could also be somewhere else.

Unfortunately there isn't much debug output to collect from the driver. Personally I'd sprinkle a few extra debug printk's around the point in the probe where it fails to try to locate the exact point where it fails.

The solution is to set dtoverlay=pcie-32bit-dma in /boot/config.txt
Finally I can play around with how well a CM4 works as a wireless AP :smiley:
Thanks to will127534 in the github issue!

1 Like

Maybe you can reply here in the next 10 days (before thread closes) or open a new one with some feedback about your setup (perf/stability). Thanks

1 Like

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