[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