[BPI-R4] WIFI card driver development


i open a new thread about the driver support for the bpi wifi7 card for r4…

bpi source is not compilable by me, also tried mapping the mt76 code with bpi patches into a newer kernel…so the mt76 repo is only for reference (easier than looking through a bunch of patches)

my current state is that i can load the right firmware with mainline-kernel, but i only see 2 interfaces (2.4G and 6G…5GHz is missing).

at least with the right firmware there are no more message timeouts flooding the console :smiley:

any help is welcome :slight_smile: maybe anyone knows why i only see 2 phy

Is it possible that, like the 7916, the 6ghz and 5ghz share the same phy? Have you double checked that the reg domain allows 5ghz where it’s set at? I remember another card having a safety measure where it didn’t allow the 5ghz and 6ghz at the same time, maybe the ax210?

When running the official m76 bpi image, post the /etc/config/wireless

Now do the same with mainline, what are the differences? Pci addresses different?

i cannot compile the official image or the mt76 driver with own kernel, i always run into build errors, so thats a dead end.

and the 6G phy goes from 5955-7115, but nothing below the 5955 MHz

Also when I run the 7916 the 6ghz interface shows the same, I have to switch it to 5ghz before other bands are listed

How do you switch the interface? Open hostapd on the interface?

I use /etc/config/wireless and just change 6g to 5g. Might be an easier way but I’ve yet to figure it out.

Does iw scan work for any of the detected wifi interfaces?


iw dev wlan0 scan

i would try to get all interfaces up first, but i tried it and wlan0/1 needs to be up and if i do so, i get a warning-trace

root@bpi-r4-v11:~# ip link set wlan0 up                                         
[   70.024778] ------------[ cut here ]------------                             
[   70.029405] WARNING: CPU: 3 PID: 3182 at net/mac80211/main.c:270 ieee80211_h]
[   70.039442] Modules linked in: mt7996e mt76_connac_lib mt76 mac80211 libarc4s
[   70.049361] CPU: 3 PID: 3182 Comm: ip Not tainted 6.9.0-rc1-bpi-r4-r4_mt76_s1
[   70.056919] Hardware name: Banana Pi BPI-R4 (DT)                             
[   70.061524] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)  
[   70.068474] pc : ieee80211_hw_conf_init+0x128/0x130 [mac80211]               
[   70.074329] lr : ieee80211_hw_conf_init+0x40/0x130 [mac80211]                
[   70.080096] sp : ffffffc084dd34e0                                            
[   70.083400] x29: ffffffc084dd34e0 x28: ffffffc080e5c378 x27: 0000000000000000
[   70.090526] x26: 0000000000000001 x25: 0000000000000000 x24: ffffff8012b00900
[   70.097653] x23: 0000000000000001 x22: ffffff800c419840 x21: ffffff800c418000
[   70.104778] x20: 00000000c00000bb x19: ffffff8012b00900 x18: 00000000ffffffff
[   70.111904] x17: ffffffc03e7a2000 x16: ffffffc0818a0000 x15: 0000000000000000
[   70.119030] x14: ffffff80012130c0 x13: 00000000000003e5 x12: 0000000000000001
[   70.126155] x11: 0000000000000001 x10: 0000000000000970 x9 : 0000000000000000
[   70.133280] x8 : ffffff80012139d0 x7 : ffffff80bf9b1d80 x6 : 000000000000129a
[   70.140405] x5 : fffffffec02a0fa0 x4 : 0000000000000000 x3 : 0000000000000000
[   70.147530] x2 : 0000000000000000 x1 : ffffff8001213000 x0 : 00000000c00000bb
[   70.154655] Call trace:                                                      
[   70.157092]  ieee80211_hw_conf_init+0x128/0x130 [mac80211]                   
[   70.162600]  ieee80211_do_open+0x4c8/0x71c [mac80211]                        
[   70.167674]  ieee80211_open+0x5c/0x98 [mac80211]                             
[   70.172313]  __dev_open+0xec/0x1b4                                           
[   70.175710]  __dev_change_flags+0x1ec/0x2bc                                  
[   70.179883]  dev_change_flags+0x24/0x6c

which points here:

but no idea why this trace is triggered, i guess because

ret = local->ops->config(&local->hw, changed);

return non zero…which could be a callback in the mt76 driver which fails

so problem is somewhere here

tried up2date openwrt from source and replaced firmware with the 233 variant…there i do not see the trace,but get message timeouts after enabling the wifi in /etc/config/wireless and restarting it (/etc/init.d/network restart) and do only see 1 phy

[  139.101455] br-lan: port 5(phy1-ap0) entered blocking state                                                                  
[  139.107019] br-lan: port 5(phy1-ap0) entered forwarding state                                                                
[  139.113444] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready                                                        
[  139.120341] device phy1-ap0 left promiscuous mode                                                                            
[  139.125089] br-lan: port 5(phy1-ap0) entered disabled state                                                                  
[  141.848340] mt7530-mmio 15020000.switch wan: Link is Up - 1Gbps/Full - flow control rx/tx                                    
[  159.847385] mt7996e 0000:01:00.0: Message 001a0034 (seq 15) timeout                                                          
[  159.854297] br-wan: port 1(wan) entered blocking state                                                                       
[  159.859462] br-wan: port 1(wan) entered forwarding state                                                                     
[  159.864886] IPv6: ADDRCONF(NETDEV_CHANGE): br-wan: link becomes ready                                                        
[  180.327388] mt7996e 0000:01:00.0: Message 0012002b (seq 1) timeout                                                           
[  200.807387] mt7996e 0000:01:00.0: Message 0012002b (seq 2) timeout

after a reboot it looks better, but not perfect

11: phy1-ap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN qlen 1000                                                 
    link/ether 00:0c:43:26:60:12 brd ff:ff:ff:ff:ff:ff                                                                          
12: phy0-ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000                         
    link/ether 00:0c:43:26:60:10 brd ff:ff:ff:ff:ff:ff                                                                          
    inet6 fe80::20c:43ff:fe26:6010/64 scope link                                                                                
       valid_lft forever preferred_lft forever

i do now know why i only see 2 of 3 phy

mt76_get_field(dev, MT_PAD_GPIO, MT_PAD_GPIO_ADIE_COMB) returns 2

and so BAND1 is not valid for triband-support

and so first check in register_phy exits function

downstream mt76 driver changed this to

/* tri-band support */
if (band <= MT_BAND2 && dev->chip_sku)
	return true;

thats what i try now :wink: and i see 3 interfaces now :wink:

10: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000                                              
    link/ether 00:0c:43:26:60:10 brd ff:ff:ff:ff:ff:ff                                                                               
11: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000                                              
    link/ether 00:0c:43:26:60:11 brd ff:ff:ff:ff:ff:ff                                                                               
12: wlan2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000                                              
    link/ether 00:0c:43:26:60:12 brd ff:ff:ff:ff:ff:ff

but all bring a warning in mac80211, when i try to set them up

WARNING: CPU: 2 PID: 3234 at net/mac80211/main.c:270 ieee80211_hw_conf_init+0x128/0x130 [mac80211]

in downstream this was added to mt7996_config (main.c)

        if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
+               if (!mt76_testmode_enabled(phy->mt76) && !phy->mt76->test.bf_en) {
+                       ret = mt7996_mcu_edcca_enable(phy, true);
+                       if (ret)
+                               return ret;
+               }

this function is only in downstream, but i do not understand what exactly it does (looks like some checks for reg-domain)…added it with all depencies i found, but still the warning…

it looks like the warning is caused by the mt7996_mcu_set_txpower_sku call in mt7996_config…


Great news Frank

Looking forward to the NIC being released now.

1 Like

Current state is that it looks like that the special firmware for the module (_233) is not compatible with mainline code…contacted mtk (person who upstreamed current firmware)

1 Like

So how did you get the third interface working? What steps are needed to make them show up as you did? Do you have your own github for this project?

See first post…

3rd phy patch depends on the firmware loading patch (sku field)

got information that the firmware with 233 suffix on bpi-repo and sdk is not compatible with mainline-code :frowning:

the mac80211 warning is caused by the mt7996_mcu_set_txpower_sku call in mt7996_config.

i hope we get an updated version supporting the card soon