[Banana BPI-R4] how to WNC7851/NCM865

lspci:
0001:01:00.0 Network controller: Qualcomm Technologies, Inc WCN785x Wi-Fi 7(802.11be) 320MHz 2x2 [FastConnect 7800] (rev 01)

root@BPI-R4:/# dmesg |grep -i firm
[ 0.000000] psci: PSCIv1.1 detected in firmware.
[ 12.838198] mt7921e 0000:01:00.0: WM Firmware Version: ____000000, Build Time: 20231120183441
root@BPI-R4:/# dmesg |grep -i ath
root@BPI-R4:/#

root@BPI-R4:/# lsmod |grep ath
ath11k 450560 1 ath11k_pci
ath11k_pci 16384 0
cfg80211 307200 14 mt7921_common,iwlmvm,iwldvm,ath11k,mt7996e,mt76x2_common,mt76x02_usb,mt76x02_lib,mt7615_common,mt7603e,mt76_connac_lib,mt76,mac80211,iwlwifi
compat 12288 6 iwlmvm,iwldvm,ath11k_pci,mac80211,iwlwifi,cfg80211
mac80211 598016 15 mt7921_common,iwlmvm,iwldvm,ath11k,mt7996e,mt792x_lib,mt76x2u,mt76x2e,mt76x02_usb,mt76x02_lib,mt7615e,mt7615_common,mt7603e,mt76_connac_lib,mt76
mhi 61440 2 ath11k_pci,qrtr_mhi
qmi_helpers 16384 1 ath11k

root@BPI-R4:/# cd /lib/firmware/ath11k/
root@BPI-R4:/lib/firmware/ath11k# ls -ltr
drwxr-xr-x 3 root root 28 May 7 10:56 QCN9074
drwxr-xr-x 3 root root 3488 May 7 11:55 WCN7850

but Im not able to get it working....

@daniel is it possible to add support here for:

kmod-ath12k & kmod-ath12k_pci & ath12k-firmware-wcn7850

please use the </> when you paste cli output.

read what @slh wrote about ath12k a month ago, in OpenWRT on Xiaomi BE7000 - #6 by slh

I rather saw that

they mention kernel 6.7 and 6.8, next openwrt release is going to use 6.6.
you do the math.

nor do they say if the card was set up as an AP or a client.

true they point to kernel 6.8 in openwrt we have 6.6 on which Im working but I dont think it could be a big problem.
The topic here is to perform tests :slight_smile:
If kmod-ath12k & kmod-ath12k_pci & ath12k-firmware-wcn7850 dont help here we can just wait for kernel 6.8.

that's probably two releases away, unless someone back ports it.

Good think is that device is recognized as before for BE200 OpenWrt wasn't able to discover the NIC card...

as I can find ath12k is supported in 6.3 and 6.6

There is no support for ath12k in OpenWrt so far.
As this is a volunteers project, feel free to open a PR on github to add kmod-ath12k package and the related firmware.

1 Like

I have forked from openwrt. I made some changes and I was able to compile ath12k.
Problem is that lsmod doesnt show it
root@BPI-R4:/lib/firmware/ath12k/WCN7850/hw2.0# opkg list-installed |grep ath12k
kmod-ath12k - 6.6.30.6.6.15-r1
root@BPI-R4:/lib/firmware/ath12k/WCN7850/hw2.0# lsmod |grep -i ath12
root@BPI-R4:/lib/firmware/ath12k/WCN7850/hw2.0#
for me some backports 6.6.15 are conflicting here...??
I will do that in another way....

Is the module even loaded?
What happens if you modprobe the module manually?

not good:

root@OpenWrt:/# lsmod |grep ath12k
root@OpenWrt:/# modprobe ath12k
[ 52.474105] ath12k_pci 0001:01:00.0: assign IRQ: got 0
[ 52.479422] ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0x38200000-0x383fffff 64bit]
[ 52.487420] ath12k_pci 0001:01:00.0: enabling device (0000 -> 0002)
[ 52.493702] ath12k_pci 0001:01:00.0: enabling bus mastering
[ 52.499535] mtk-pcie-gen3 11310000.pcie: msi#0x10 address_hi 0x0 address_lo 0x11310c00 data 16
[ 52.508164] mtk-pcie-gen3 11310000.pcie: msi#0x11 address_hi 0x0 address_lo 0x11310c00 data 17
[ 52.516775] mtk-pcie-gen3 11310000.pcie: msi#0x12 address_hi 0x0 address_lo 0x11310c00 data 18
[ 52.525381] mtk-pcie-gen3 11310000.pcie: msi#0x13 address_hi 0x0 address_lo 0x11310c00 data 19
[ 52.533987] mtk-pcie-gen3 11310000.pcie: msi#0x14 address_hi 0x0 address_lo 0x11310c00 data 20
[ 52.542591] mtk-pcie-gen3 11310000.pcie: msi#0x15 address_hi 0x0 address_lo 0x11310c00 data 21
[ 52.551189] mtk-pcie-gen3 11310000.pcie: msi#0x16 address_hi 0x0 address_lo 0x11310c00 data 22
[ 52.559795] mtk-pcie-gen3 11310000.pcie: msi#0x17 address_hi 0x0 address_lo 0x11310c00 data 23
[ 52.568399] mtk-pcie-gen3 11310000.pcie: msi#0x18 address_hi 0x0 address_lo 0x11310c00 data 24
[ 52.577003] mtk-pcie-gen3 11310000.pcie: msi#0x19 address_hi 0x0 address_lo 0x11310c00 data 25
[ 52.585615] mtk-pcie-gen3 11310000.pcie: msi#0x1a address_hi 0x0 address_lo 0x11310c00 data 26
[ 52.594220] mtk-pcie-gen3 11310000.pcie: msi#0x1b address_hi 0x0 address_lo 0x11310c00 data 27
[ 52.602824] mtk-pcie-gen3 11310000.pcie: msi#0x1c address_hi 0x0 address_lo 0x11310c00 data 28
[ 52.611421] mtk-pcie-gen3 11310000.pcie: msi#0x1d address_hi 0x0 address_lo 0x11310c00 data 29
[ 52.620026] mtk-pcie-gen3 11310000.pcie: msi#0x1e address_hi 0x0 address_lo 0x11310c00 data 30
[ 52.628630] mtk-pcie-gen3 11310000.pcie: msi#0x1f address_hi 0x0 address_lo 0x11310c00 data 31
[ 52.637271] ath12k_pci 0001:01:00.0: Hardware name: wcn7850 hw2.0
[ 52.643961] SError Interrupt on CPU0, code 0x00000000bf000000 -- SError
[ 52.643971] CPU: 0 PID: 4437 Comm: modprobe Tainted: G O 6.6.30 #0
[ 52.643976] Hardware name: Bananapi BPI-R4 (DT)
[ 52.643978] pstate: 40400005 (nZcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 52.643983] pc : __local_bh_enable_ip+0x50/0x8c
[ 52.643993] lr : ath12k_pci_read32+0x22c/0xabc [ath12k]
[ 52.644014] sp : ffffffc0859ab7b0
[ 52.644015] x29: ffffffc0859ab7b0 x28: ffffff80cee530f8 x27: 000000000000000e
[ 52.644022] x26: ffffff80cee52e08 x25: ffffff80cee53194 x24: 0000000000000000
[ 52.644027] x23: ffffff80cee50000 x22: ffffffc0793f353c x21: ffffff80cee40000
[ 52.644032] x20: 000000009340eef3 x19: 0000000001e38338 x18: 0000000000000002
[ 52.644037] x17: 0000000000a44d38 x16: 01b8040001b80000 x15: 0000000000000000
[ 52.644042] x14: 00000000000003f8 x13: 0000000000000000 x12: 0000010100000045
[ 52.644046] x11: 0000000000000040 x10: ffffffc080b57470 x9 : ffffffc080b57468
[ 52.644050] x8 : ffffff80c0400700 x7 : 0000000000000000 x6 : 000000000642b2eb
[ 52.644055] x5 : 0000000001000000 x4 : 000000004000003c x3 : 0000000000000000
[ 52.644059] x2 : ffffff80ca679700 x1 : 0000000000000200 x0 : 0000000000000001
[ 52.644064] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 52.644067] SMP: stopping secondary CPUs
[ 52.644071] Kernel Offset: disabled
[ 52.644072] CPU features: 0x0,00000000,20000000,1000400b
[ 52.644076] Memory Limit: none
[ 52.651395] pstore: backend (ramoops) writing error (-28)
PANIC at PC : 0x00000000430048a8

Im not sure if all dependencies are met. maybe some packages are still mising to full config for ath12k??


Error stack trace:

Issue reported in drivers/net/wireless/ath/ath12k/pci.c

lr : ath12k_pci_read32 -> ath12k/pci.c:1049

Code:
if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) &&
offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->release &&
!ret)
ab_pci->pci_ops->release(ab);
return val;

================================
I took also ath12k directories directlly from kernel 6.9 and compiled.
The result is the same - kernel panic at

[ 35.012230] ath12k_pci 0▒01:01:00.0: Hardware name: wcn7850 hw2.0
[ 35.018859] SError Interrupt on CPU3, code 0x00000000bf000000 -- SError
[ 35.018865] CPU: 3 PID: 4430 Comm: modprobe Tainted: G O 6.6.30 #0
[ 35.018870] Hardware name: Bananapi BPI-R4 (DT)
[ 35.018872] pstate: 40400005 (nZcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 35.018877] pc : __local_bh_enable_ip+0x78/0x8c
[ 35.018887] lr : ath12k_pci_read32+0x22c/0xabc▒[ath12k]
[ 35.018906] sp : ffffffc08588▒7a0

Hardwere related? Maybe some clocks on pcie3 or problem with pci bus commands/registries?

My steps:

I Part kernel driver:

make clean git openwrt installation (or fork from the orginal) +feeds

copy files (Makefile/ath.mk/qca_ath12k.mk) from my repo to:
package/kernel/mac80211/Makefile
package/kernel/mac80211/ath.mk
package/firmware/linux-firmware/qca_ath12k.mk

rm -rf tmp
make menuconfig
Kernel modules -> Wireless drivers
check ath12k

II Part firmware:

Firmware
check ath12k-firmware-wcn7850

and compile
make -j $(nproc)

===========================================================================
Part firmware (manual)

Based on https://wireless.wiki.kernel.org/en/users/drivers/ath12k 1

opkg install make
opkg install python3

git clone https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware
cd ath12k-firmware
wget https://github.com/qca/qca-swiss-army-knife/raw/master/tools/scripts/ath12k/ath12k-fw-repo

chmod 755 ath12k-fw-repo

cp ath12k-fw-repo /bin

make install

cd /lib/firmware/ath12k/WCN7850/hw2.0

wget https://github.com/kvalo/ath11k-firmware/raw/master/ath12k-testing/WCN7850/hw2.0/board.bin
wget https://github.com/kvalo/ath11k-firmware/raw/master/ath12k-testing/WCN7850/hw2.0/regdb.bin

reboot

I have installed BPI-Router-Linux (frank-w), Debian GNU/Linux 12 bpi-r4, kernel 6.9.

[ 16.707420] ath12k_pci 0001:01:00.0: MSI vectors: 16
[ 16.712416] ath12k_pci 0001:01:00.0: Hardware name: wcn7850 hw2.0

root@bpi-r4:~# lsmod |grep -i ath12
ath12k 372736 1
mhi 94208 1 ath12k
qmi_helpers 24576 1 ath12k
mac80211 811008 4 mt76,ath12k,mt7915e,mt76_connac_lib

But after some moments I see that:

[ 79.936061] NET: Registered PF_QIPCRTR protocol family
[ 79.941958] SError Interrupt on CPU0, code 0x00000000bf000000 -- SError
[ 79.941970] CPU: 0 PID: 3104 Comm: (udev-worker) Not tainted 6.9.0-bpi-r4-main #1
[ 79.941977] Hardware name: Banana Pi BPI-R4 (DT)
[ 79.941979] pstate: 40400005 (nZcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 79.941984] pc : __local_bh_enable_ip+0x80/0x94
[ 79.941998] lr : ath12k_pci_read32+0x23c/0x298 [ath12k]
[ 79.942046] sp : ffffffc08532b6c0
[ 79.942048] x29: ffffffc08532b6c0 x28: 0000000000002cf8 x27: 000000000000008f
[ 79.942055] x26: ffffff800abf2fe8 x25: ffffff800abf33fc x24: 0000000000000000
[ 79.942060] x23: ffffff800abf0000 x22: ffffffc079bd8e34 x21: ffffff800abe0000
[ 79.942065] x20: 00000000e3caa0ed x19: 0000000001e38338 x18: ffffffc0825a3c28
[ 79.942070] x17: 0000000000000000 x16: ffffffc080f726d8 x15: 0000000000000000
[ 79.942074] x14: 0000000000000030 x13: 0000000000000000 x12: 0000010100000045
[ 79.942079] x11: 0000000000000001 x10: ffffffc081198000 x9 : 0000000000000000
[ 79.942084] x8 : 0000000003000000 x7 : 0000000000000000 x6 : 00000000057c7649
[ 79.942088] x5 : 000000004000003c x4 : ffffff800abe0000 x3 : 0000000000000000
[ 79.942093] x2 : ffffff800b001000 x1 : ffffff800b001000 x0 : 0000000000000000
[ 79.942098] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 79.942101] CPU: 0 PID: 3104 Comm: (udev-worker) Not tainted 6.9.0-bpi-r4-main #1
[ 79.942105] Hardware name: Banana Pi BPI-R4 (DT)
[ 79.942107] Call trace:
[ 79.942109] dump_backtrace+0x94/0x114
[ 79.942115] show_stack+0x18/0x24
[ 79.942118] dump_stack_lvl+0x34/0x8c
[ 79.942124] dump_stack+0x18/0x24
[ 79.942126] panic+0x380/0x394
[ 79.942132] nmi_panic+0x48/0x94
[ 79.942137] arm64_serror_panic+0x6c/0x78
[ 79.942141] do_serror+0x28/0x68
[ 79.942145] el1h_64_error_handler+0x30/0x48
[ 79.942151] el1h_64_error+0x68/0x6c
[ 79.942154] __local_bh_enable_ip+0x80/0x94
[ 79.942159] ath12k_pci_read32+0x23c/0x298 [ath12k]
[ 79.942195] ath12k_pci_power_up+0xf0/0x410 [ath12k]
[ 79.942229] ath12k_core_init+0x2c/0xa8 [ath12k]
[ 79.942264] ath12k_pci_probe+0x904/0xb50 [ath12k]
[ 79.942298] pci_device_probe+0xa4/0x168
[ 79.942304] really_probe+0xc0/0x390
[ 79.942312] __driver_probe_device+0x7c/0x15c
[ 79.942316] driver_probe_device+0x3c/0x110
[ 79.942321] __driver_attach+0xf0/0x1f8
[ 79.942326] bus_for_each_dev+0x78/0xd8
[ 79.942330] driver_attach+0x24/0x30
[ 79.942334] bus_add_driver+0x114/0x224
[ 79.942338] driver_register+0x5c/0x124
[ 79.942343] __pci_register_driver+0x4c/0x58
[ 79.942346] ath12k_pci_init+0x2c/0x6c [ath12k]
[ 79.942381] do_one_initcall+0x44/0x260
[ 79.942384] do_init_module+0x60/0x21c
[ 79.942391] load_module+0x1f20/0x2050
[ 79.942395] init_module_from_file+0x88/0xcc
[ 79.942400] __arm64_sys_finit_module+0x1a0/0x384
[ 79.942406] invoke_syscall+0x48/0x114
[ 79.942412] el0_svc_common.constprop.0+0xc0/0xe0
[ 79.942417] do_el0_svc+0x1c/0x28
[ 79.942422] el0_svc+0x34/0xd8
[ 79.942425] el0t_64_sync_handler+0x120/0x12c
[ 79.942429] el0t_64_sync+0x194/0x198
[ 79.942433] SMP: stopping secondary CPUs
[ 79.942439] Kernel Offset: disabled
[ 79.942441] CPU features: 0x0,00000081,00100000,4200420b
[ 79.942445] Memory Limit: 3072 MB
[ 79.945026] pstore: backend (ramoops) writing error (-28)

Strange is that it is without firmware in /lib/firmware and once installed hw drivers
the results is the same. Is it problem with firmware as I cant see typical info like for MT7916:

[ 16.144382] mt7915e 0000:01:00.0: WM Firmware Version: ____000000, Build Time: 20230202145005
[ 16.199288] mt7915e 0000:01:00.0: WA Firmware Version: DEV_000000, Build Time: 20230202143332

I have built kernel 6.9 Debian trixie BPI-Router-Linux (frank-w) and the result is the same...
Not loading firmware to the kernel...
modprobe resulting the kernel panic could be the result of that.

Just to check, did you do the firmware download ok ?

I noticed that they are in a different place now:

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath12k/WCN7850/hw2.0

I also found some instructions(for ubuntu):

sudo mkdir -p /lib/firmware/ath12k
cd ath12k-firmware/
sudo cp -r * /lib/firmware/ath12k/

Create links to amss.bin and m3.bin.
'
cd /lib/firmware/ath12k/WCN7850/hw2.0
sudo ln -s WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3/amss.bin amss.bin
sudo ln -s WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3/m3.bin m3.bin

Edit: sorry, i realise now that this was probably a newbie post from me since im not that bewandered in kernels and drivers.

I saw that and also tested that :slight_smile:
Results are still the same

1 Like

Tests on debian trixie 6.10 show still the same issue:

[ 79.863341] SError Interrupt on CPU2, code 0x00000000bf000000 -- SError
[ 79.863355] CPU: 2 PID: 3067 Comm: (udev-worker) Not tainted 6.10.0-rc1-bpi-r4 #1
[ 79.863361] Hardware name: Banana Pi BPI-R4 (DT)
[ 79.863363] pstate: 40400005 (nZcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 79.863368] pc : __local_bh_enable_ip+0x80/0x94
[ 79.863382] lr : ath12k_pci_read32+0x23c/0x298 [ath12k]
[ 79.863424] sp : ffffffc08620b700
[ 79.863426] x29: ffffffc08620b700 x28: 0000000000002d5c x27: ffffff8016872690
[ 79.863434] x26: ffffff80168731d0 x25: ffffff8016873604 x24: 0000000000000000
[ 79.863440] x23: ffffff8016870000 x22: ffffffc079b91ff8 x21: ffffff8016860000
[ 79.863445] x20: 00000000b004b994 x19: 0000000001e38338 x18: ffffffffffffffff
[ 79.863450] x17: 0000000000a44d38 x16: 0000003e3809b000 x15: 0000000000000000
[ 79.863455] x14: ffffff800b0880c0 x13: 0000000001c395f4 x12: 0000000000000000
[ 79.863460] x11: 0000000000000001 x10: ffffff80bf994180 x9 : ffffff800b0880c0
[ 79.863464] x8 : ffffff80bf994180 x7 : ffffff8000163180 x6 : 0000000000000002
[ 79.863469] x5 : 000000004000003c x4 : ffffff8016860000 x3 : 0000000000000000
[ 79.863474] x2 : ffffff800b088000 x1 : ffffff800b088000 x0 : 0000000000000000
[ 79.863480] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 79.863483] CPU: 2 PID: 3067 Comm: (udev-worker) Not tainted 6.10.0-rc1-bpi-r4 #1
[ 79.863487] Hardware name: Banana Pi BPI-R4 (DT)
[ 79.863489] Call trace:
[ 79.863492] dump_backtrace+0x94/0x114
[ 79.863498] show_stack+0x18/0x24
[ 79.863502] dump_stack_lvl+0x34/0x8c
[ 79.863509] dump_stack+0x18/0x24
[ 79.863513] panic+0x380/0x394
[ 79.863519] nmi_panic+0x48/0x94
[ 79.863524] arm64_serror_panic+0x6c/0x78
[ 79.863528] do_serror+0x28/0x68
[ 79.863532] el1h_64_error_handler+0x30/0x48
[ 79.863538] el1h_64_error+0x68/0x6c
[ 79.863541] __local_bh_enable_ip+0x80/0x94
[ 79.863546] ath12k_pci_read32+0x23c/0x298 [ath12k]
[ 79.863576] ath12k_pci_power_up+0xe4/0x370 [ath12k]
[ 79.863605] ath12k_core_init+0x30/0xb4 [ath12k]
[ 79.863633] ath12k_pci_probe+0x858/0xa4c [ath12k]
[ 79.863662] pci_device_probe+0x9c/0x140
[ 79.863669] really_probe+0xc0/0x390
[ 79.863676] __driver_probe_device+0x7c/0x15c
[ 79.863681] driver_probe_device+0x3c/0x110
[ 79.863686] __driver_attach+0xf0/0x1f8
[ 79.863691] bus_for_each_dev+0x78/0xd8
[ 79.863696] driver_attach+0x24/0x30
[ 79.863700] bus_add_driver+0x110/0x234
[ 79.863705] driver_register+0x5c/0x124
[ 79.863710] __pci_register_driver+0x4c/0x58
[ 79.863714] ath12k_pci_init+0x2c/0x6c [ath12k]
[ 79.863743] do_one_initcall+0x44/0x260
[ 79.863747] do_init_module+0x60/0x21c
[ 79.863754] load_module+0x1f3c/0x206c
[ 79.863758] init_module_from_file+0x88/0xcc
[ 79.863761] __arm64_sys_finit_module+0x1a0/0x388
[ 79.863764] invoke_syscall+0x48/0x114
[ 79.863770] el0_svc_common.constprop.0+0xc0/0xe0
[ 79.863776] do_el0_svc+0x1c/0x28
[ 79.863781] el0_svc+0x34/0xd8
[ 79.863787] el0t_64_sync_handler+0x120/0x12c
[ 79.863793] el0t_64_sync+0x194/0x198
[ 79.863797] SMP: stopping secondary CPUs
[ 79.863806] Kernel Offset: disabled
[ 79.863807] CPU features: 0x00,00000081,00100000,4200420b
[ 79.863812] Memory Limit: 3072 MB
[ 79.866592] pstore: backend (ramoops) writing error (-28)

Sounds like Janus has WNC7850 running on OpenWrt with the Bananapi R4 ?

Janusz was initially working with BPI-R64 board but interesting... I will check that out later :slight_smile:

1 Like