[BPI-R64] mt7622 mac80211 WiFi driver

this is the information I obtained in the discussion group. I will ask if there is any other information to provide to you. In addition, do you have debian wlan0 test code? AP and client. I use hostapd -B /etc/hostapd/hostapd.conf to report errors. I don’t have these configurations yet.

interface=wlan0
driver=nl80211
ssid=mt7622

root@MT7622:~# hostapd -B /etc/hostapd/hostapd.conf 
Configuration file: /etc/hostapd/hostapd.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED 
wlan0: CTRL-EVENT-TERMINATING 
hostapd_free_hapd_data: Interface wlan0 wasn't started

I have only ap-code ready (2g4 and 5g,for r2,but you only need to replace iface names)

https://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:wlan#hostapd

Have not tried yet with mt7615/mt7622. Mt7615 is currently in my r2 (added antenna on wf3 today so i can test 2g4 and 5g). with and without the firmware-file i got a driver own failed…

without i see this:

[   49.882535] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622-wmac_rf.bin                                                          
[   49.891445] mt7622-wmac 18000000.wmac: Open file failed : /lib/firmware/mediatek/mt7622-wmac_rf.bin                                                       
[   49.901529] mt7622-wmac 18000000.wmac: Invalid MAC address, using random address 02:9d:39:63:ac:55                                                        
[   51.114069] mt7622-wmac 18000000.wmac: driver own failed

with the file i see this:

[   31.582413] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622-wmac_rf.bin                                                          
[   31.594925] mt7622-wmac 18000000.wmac: Load firmware ERR, count 1024byte                                                                                  
[   31.601739] mt7622-wmac 18000000.wmac: Load firmware OK, count -2byte                                                                                     
[   31.610768] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'                                                                                 
root@bpi-r64:~# [   32.826357] mt7622-wmac 18000000.wmac: driver own failed

looks like the error message is added by this patchset: https://www.spinics.net/lists/linux-wireless/msg200710.html

i cannot start AP on wlan0

Could not set interface wlan0 flags (UP): Input/output error                                                                                                 
nl80211: Could not set interface 'wlan0' UP

i still have the rfkill-option active (softdep rfkill pre: mt7622)

tried 5.9-main (without the eeprom-patch), same result

seems like it is the rfkill-issue again… i loaded rfkill-module before mt7615e and then i got the firmware-load and can start hostapd

i tried to change the rule because driver-module is named mt7615e instead of mt7622m same result (after reboot). directly after boot i get the driver own failure, if i unload the module and load again, i get the firmware-info…maybe mt7622 is blocked some time

mt7622-wmac 18000000.wmac: N9 Firmware Version: _reserved_, Build Time: 20190801210351

rfkill is loaded on boot, maybe the wlan0-interface in /etc/network/interfaces blocks…removed it so network is started completely, but same

root@bpi-r64:~# service networking status                                                                                                                    
�● networking.service - Raise network interfaces                                                                                                             
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor prese                                                                             
   Active: active (exited) since Thu 2019-02-14 10:12:03 UTC; 1 years 7 months a                                                                             
     Docs: man:interfaces(5)                                                                                                                                 
  Process: 164 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0                                                                             
 Main PID: 164 (code=exited, status=0/SUCCESS)                                                                                                               
                                                                                                                                                             
Feb 14 10:12:02 bpi-r64 systemd[1]: Starting Raise network interfaces...                                                                                     
Feb 14 10:12:03 bpi-r64 systemd[1]: Started Raise network interfaces.                                                                                        
root@bpi-r64:~# lsmod                                                                                                                                        
Module                  Size  Used by                                                                                                                        
aes_generic            36864  1                                                                                                                              
cmac                   16384  1                                                                                                                              
btmtkuart              24576  0                                                                                                                              
bluetooth             512000  20 btmtkuart                                                                                                                   
ecdh_generic           16384  2 bluetooth                                                                                                                    
ecc                    24576  1 ecdh_generic                                                                                                                 
rfkill                 32768  3 bluetooth                                                                                                                    
libaes                 16384  2 bluetooth,aes_generic                                                                                                        
ip_tables              28672  0                                                                                                                              
x_tables               36864  1 ip_tables                                                                                                                    
root@bpi-r64:~# modprobe mt7615e                                                                                                                             
[   52.224481] cfg80211: Loading compiled-in X.509 certificates for regulatory database                                                                      
[   52.380732] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'                                                                                    
[   52.388300] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2                                                            
[   52.399402] cfg80211: failed to load regulatory.db                                                                                                        
[   52.564273] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622-wmac_rf.bin                                                          
[   52.584584] mt7622-wmac 18000000.wmac: Load firmware ERR, count 1024byte                                                                                  
[   52.592669] mt7622-wmac 18000000.wmac: Load firmware OK, count -2byte                                                                                     
[   52.615394] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'                                                                                 
root@bpi-r64:~# [   53.823422] mt7622-wmac 18000000.wmac: driver own failed                                                                                  
root@bpi-r64:~# modprobe -r mt7615e                                                                                                                          
root@bpi-r64:~# modprobe mt7615e                                                                                                                             
[   83.800559] cfg80211: Loading compiled-in X.509 certificates for regulatory database                                                                      
[   83.820595] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'                                                                                    
[   83.827979] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2                                                            
[   83.850229] cfg80211: failed to load regulatory.db                                                                                                        
[   83.948589] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622-wmac_rf.bin                                                          
[   83.958684] mt7622-wmac 18000000.wmac: Load firmware ERR, count 1024byte                                                                                  
[   83.974036] mt7622-wmac 18000000.wmac: Load firmware OK, count -2byte                                                                                     
[   84.001470] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'                                                                                 
[   84.054993] mt7622-wmac 18000000.wmac: N9 Firmware Version: _reserved_, Build Time: 20190801210351                                                        
root@bpi-r64:~#

btw. it looks like the eeprom does not get loaded…(ok-message is wrong because on err there is only ret-var set, but not returned). i added the len in brackets to see difference

[  157.004155] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622-wmac_rf.bin                                                          
[  157.019551] mt7622-wmac 18000000.wmac: Load firmware ERR, count 1024 byte (19880)

imho the len is wrong, it is passed to function so i guess it’s the size of full eeprom and sobuffer needs to initialized with zeros till len and then overridden with file-data (or filled after last file-byte)

root@bpi-r64:~# ls -lh /lib/firmware/mediatek/mt7622-wmac_rf.bin
-rw-r--r-- 1 root root 1.0K Sep 16 12:23 /lib/firmware/mediatek/mt7622-wmac_rf.bin
root@bpi-r64:~# ls -l /lib/firmware/mediatek/mt7622-wmac_rf.bin
-rw-r--r-- 1 root root 1024 Sep 16 12:23 /lib/firmware/mediatek/mt7622-wmac_rf.bin

but i get the same values second time i insert the module…but then initialization succeeds

@nagi have you an idea why driver own failes the first time (also without eeprom-patch - 5.9-main)? without the patch (revert 894b7767ec2fc21574775c354ab5350e51c2171c) i get this:

 mt7622-wmac 18000000.wmac: Timeout for driver own

Could you try to uncheck “Bluetooth subsystem support” in make kernel_menuconfig?

Networking support --> < > Bluetooth subsystem support

Indeed ret does not return, I have modified the above code. You try again:

static int
mt76_get_of_file(struct mt76_dev *dev, int len)
{
	char path[64]="";
	struct file *fp;
	loff_t pos=0;
	int ret;
	
	ret = snprintf(path,sizeof(path),"/lib/firmware/mediatek/%s_rf.bin",dev->dev->driver->name);
	if(ret < 0)
		return -EINVAL;
	dev_info(dev->dev,"Load firmware : %s\n",path);
	fp = filp_open(path, O_RDONLY, 0);
	if (IS_ERR(fp)) {
		dev_info(dev->dev,"Load firmware Faile : %s\n",path);
		return -ENOENT;
	}
	ret = kernel_read(fp, dev->eeprom.data, len, &pos);
	if(ret < len){
		dev_info(dev->dev,"Load firmware ERR, count %dbyte\n",ret);
		ret = -ENOENT;
	}else{
		dev_info(dev->dev,"Load firmware OK, count %dbyte\n",ret);
		ret = 0;
	}
	filp_close(fp, 0);
	return ret;
}

As i have compiled bluetooth-support as module i can try to unload it before loading mt7615e module. Should be same,right? bluetooth-module can’t be unloaded…still in use (have unloaded all depencies (mtkbtuart)), but still in use…i guess bluetooth-daemon blocks it. need to drop the revert so i compile and install again without bluetooth.

same result:

root@bpi-r64:~# lsmod                                                           
Module                  Size  Used by                                           
ip_tables              28672  0                                                 
x_tables               36864  1 ip_tables                                       
root@bpi-r64:~# modprobe mt7615e                                                
[   22.867561] cfg80211: Loading compiled-in X.509 certificates for regulatory d
atabase                                                                         
[   22.897073] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'       
[   22.914501] platform regulatory.0: Direct firmware load for regulatory.db fai
led with error -2                                                               
[   22.923360] cfg80211: failed to load regulatory.db                           
[   23.042029] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek
/mt7622-wmac_rf.bin                                                             
[   23.054968] mt7622-wmac 18000000.wmac: Load firmware ERR, count 1024byte     
[   23.065892] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'    
root@bpi-r64:~# [   24.269933] mt7622-wmac 18000000.wmac: driver own failed

and now unloading/reloading does not work…have tried many times

@skype, which problem do you mean? i have only the problem with eeprom, where len is larger than the eeprom-file

Indeed ret does not return, I have modified the above, and I provide my test environment:

I don’t understand your above operations very well, because I always ask you for advice and Google search for wifi configuration. You see if you can get close to my test method so that I can help you solve some problems。

I have not used rfkill, nor have I installed it yet. This means that after my configuration starts, I can directly search for wireless AP signals. I provided screenshots.

root@MT7622:~# dmesg | grep mt7622
[    1.237983] rtc_mt7622 10212800.rtc: registered as rtc0
[    2.174171] rtc_mt7622 10212800.rtc: setting system clock to 2000-01-01T03:50:41 UTC (946698641)
[    5.545529] mt7622_wmac 18000000.wmac: ASIC revision: 76220010
[    5.589460] mt7622_wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622_wmac_rf.bin
[    5.664182] mt7622_wmac 18000000.wmac: Load firmware OK, count 1024byte
[    5.702666] mt7622_wmac 18000000.wmac: MAC addr = 00:0c:43:26:60:00
[    5.767225] mt7622_wmac 18000000.wmac: N9 Firmware Version: _reserved_, Build Time: 20190801210351
[    5.893336] mt7622_wmac 18000000.wmac: Firmware init done
[    5.922671] mt7622_wmac 18000000.wmac: Driver own success
root@MT7622:~# dmesg | grep mt7615e
[    5.554275] mt7615e 0000:01:00.0: assign IRQ: got 140
[    5.676722] mt7615e 0000:01:00.0: enabling device (0000 -> 0002)
[    5.739069] mt7615e 0000:01:00.0: enabling bus mastering
[    5.782814] mt7615e 0000:01:00.0: Load firmware : /lib/firmware/mediatek/mt7615e_rf.bin
[    5.834248] mt7615e 0000:01:00.0: Load firmware OK, count 1024byte
[    5.880527] mt7615e 0000:01:00.0: HW/SW Version: 0x8a108a10, Build Time: 20180518100604a
[    5.953826] mt7615e 0000:01:00.0: N9 Firmware Version: _reserved_, Build Time: 20190103180756
[    6.011722] mt7615e 0000:01:00.0: CR4 Firmware Version: _reserved_, Build Time: 20181207140436
[   13.727317] mt7615e 0000:01:00.0 wlp1s0: renamed from wlan1
root@MT7622:~# 

and

root@MT7622:~# ip a
12: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:43:26:60:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.3/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:43ff:fe26:6000/64 scope link 
       valid_lft forever preferred_lft forever
13: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:43:28:05:ab brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/24 brd 192.168.1.255 scope global wlp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:43ff:fe28:5ab/64 scope link 
       valid_lft forever preferred_lft forever

and

root@MT7622:~# iw dev
phy#1
        Interface wlp1s0
                ifindex 13
                wdev 0x100000001
                addr 00:0c:43:28:05:ab
                ssid mt7615e
                type AP
                channel 48 (5240 MHz), width: 20 MHz, center1: 5240 MHz
                txpower 6.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes   tx-packets
                        0       0       0       0       0       0       0       0          0
phy#0
        Interface wlan0
                ifindex 12
                wdev 0x1
                addr 00:0c:43:26:60:00
                ssid mt7622
                type AP
                channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
                txpower 20.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes   tx-packets
                        0       0       0       0       0       0       0       0          0
root@MT7622:~# 

I will provide my two bin files again, it seems there is no problem at present.

eeprom.c (2.7 KB) mt7615e_rf.bin (1.2 KB) mt7622_wmac_rf.bin (1 KB)

I have found no fatal problems in my current test!

I tested only mt7622 and used eeprom-file from first post of this thread. But also without modifying eeprom.c i have the driver own issue. With bluetooth i can unload mt7615e module and reload it to get it working. Without bluetooth i got always the driver own issue

Could you try my 5.9-mt76eeprom branch to have same config? My buster rootfs is prepared to test bluetooth too,so i have installed those tools.

No problem, I will test it next week. Can you provide your configuration, and I will refer to your config for testing.

you mean my hostapd-config? (works only if not driver own issue appears)

#ctrl_interface=/var/run/hostapd
#ctrl_interface_group=0 # These 2 are just parameters so that the hostap daemon runs.

interface=wlan0
driver=nl80211

ssid=r64_APi

hw_mode=g
channel=2
#macaddr_acl=0
auth_algs=1
#ignore_broadcast_ssid=0
#wpa=2
#wmm_enabled=1
#wpa_passphrase=12345678
#wpa_key_mgmt=WPA-PSK
#wpa_pairwise=TKIP
#rsn_pairwise=CCMP

my kernelconfig:

https://github.com/frank-w/BPI-R2-4.14/blob/5.9-mt76eeprom/arch/arm64/configs/mt7622_bpi-r64_defconfig (currently with disabled CONFIG_BT, which is set to m in defconfig)

maybe any patch in my tree may break wifi? these are for bluetooth on r64

  • 6fc2b86858a8 bluetooth: mt7622: increase sleeptime in scpsys
  • 8b3ed61bb312 bluetooth: firmware: add mt7622 bluetooth firmware
  • d43115dd13d6 arm64: dts: enable bluetooth-node
  • f92108b7acfa tty: serial: don’t do termios for BTIF

the rfkill was previously used to fix the semaphore-issue: [BPI-R64] mt7622 mac80211 WiFi driver

i guess pcie and switch-changes does not affect wifi. strange that you don’t get the ret<len error…

i tried 5.8-main and there firmware is loaded the first time (no driver own issue)…so something is changed till 5.8 and 5.9 causing this issue

@skype which kernel did you use (5.9+)?

I am using linux 5.4.72, your branch.

Ah,ok, i got the driver own issue only on 5.9+,maybe the len-issue is also only there

in my 5.4 i see the semaphore-problem again (imho this was because bluetooth/rfkill)

root@bpi-r64:~# modprobe -r mt7622
root@bpi-r64:~# modprobe mt7622
[  100.778469] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[  100.787154] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  100.794318] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[  100.803989] cfg80211: failed to load regulatory.db
[  100.817743] mt7622_wmac 18000000.wmac: ASIC revision: 76220010
[  100.823808] mt7622_wmac 18000000.wmac: Invalid MAC address, using random address 42:de:fd:15:bb:52
[  100.832854] mt7622_wmac 18000000.wmac: MAC addr = 42:de:fd:15:bb:52
[  111.069495] mt7622_wmac 18000000.wmac: Message -16 (seq 1) timeout
[  111.075697] mt7622_wmac 18000000.wmac: Failed to get patch semaphore
[  111.083874] mt7622_wmac: probe of 18000000.wmac failed with error -11

with eeprom-patch it looks like this:

root@bpi-r64:~# modprobe -r mt7622
root@bpi-r64:~# modprobe rfkill
root@bpi-r64:~# modprobe mt7622
[   55.822252] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   55.830948] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   55.838025] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[   55.847673] cfg80211: failed to load regulatory.db
[   55.860947] mt7622_wmac 18000000.wmac: ASIC revision: 76220010
[   55.866845] mt7622_wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622_wmac_rf.bin
[   55.875668] mt7622_wmac 18000000.wmac: Load firmware Failed : /lib/firmware/mediatek/mt7622_wmac_rf.bin
[   55.885127] mt7622_wmac 18000000.wmac: Invalid MAC address, using random address 46:c0:74:51:9a:d9
[   55.894111] mt7622_wmac 18000000.wmac: MAC addr = 46:c0:74:51:9a:d9
[   66.013328] mt7622_wmac 18000000.wmac: Message -16 (seq 1) timeout
[   66.019530] mt7622_wmac 18000000.wmac: Failed to get patch semaphore
[   66.027684] mt7622_wmac: probe of 18000000.wmac failed with error -11
root@bpi-r64:~#

mhm, failed is because file is named “mt7622-wmac_rf.bin” instead of “mt7622_wmac_rf.bin” (seems filename differs between 5.4 and 5.9)…modulename is in 5.4 (mt76_new) also mt7622 and not part of mt7615e

after removing the CONFIG_BT and copy the eeprom-file to other name:

root@bpi-r64:~# modprobe -r mt7622
root@bpi-r64:~# modprobe mt7622
[   84.258144] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   84.266821] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   84.273471] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[   84.282212] cfg80211: failed to load regulatory.db
[   84.353538] mt7622_wmac 18000000.wmac: ASIC revision: 76220010
[   84.359422] mt7622_wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622_wmac_rf.bin
[   84.369517] mt7622_wmac 18000000.wmac: Load firmware OK, count 1024 byte
[   84.376288] mt7622_wmac 18000000.wmac: MAC addr = 00:0c:43:26:60:00
[   84.383543] mt7622_wmac 18000000.wmac: HW/SW Version: 0x8a108a10, Build Time: 20190801210006a
[   84.383543] 
[   84.406056] mt7622_wmac 18000000.wmac: N9 Firmware Version: _reserved_, Build Time: 20190801210351
[   84.461907] mt7622_wmac 18000000.wmac: Firmware init done
[   84.487375] mt7622_wmac 18000000.wmac: Driver own success
[   88.245589] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
root@bpi-r64:~# 

so eeprom-load on 5.4 works if CONFIG_BT is disabled…else i got the semaphore-error. on 5.9+ i got the driver-own issue and eeprom load failed because len is too big (eeprom-size differently in eeprom_init)

@nagi have you an idea about the driver own issue? It seems not related to bluetooth (like semaphore issue on 5.4).

Mhm,found this https://github.com/openwrt/mt76/issues/438#issuecomment-688114445, but it’s not compatible with my 5.9 source…seems there are Patches missing. but it looks like 5.9.3 has the patch already… => driver own issue fixed in 5.9.3…still have the different len problem…

drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c:75:	ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_FULL_SIZE);
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h:20:#define MT7615_EEPROM_FULL_SIZE			(MT7615_EEPROM_TXDPD_OFFSET + \
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h-21-						 MT7615_EEPROM_TXDPD_COUNT * \
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h-22-						 MT7615_EEPROM_TXDPD_SIZE)

it looks like this calculation has changed a bit with dc7bd30b97aa (mt76: mt7615: fix EEPROM buffer size), but was also larger than 1k

drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h:54:#define MT7615_EEPROM_SIZE		1024
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h:14:#define MT7615_EEPROM_TXDPD_OFFSET		(MT7615_EEPROM_SIZE + \
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h-15-						 MT7615_EEPROM_DCOC_COUNT * \
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h-16-						 MT7615_EEPROM_DCOC_SIZE)
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h:11:#define MT7615_EEPROM_DCOC_SIZE			256
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h-12-#define MT7615_EEPROM_DCOC_COUNT		34

on entering the mt76_eeprom_init-function i have a len of 19880, so we cannot check again the len…maybe it’s better to check for filesize after read and then fill eeprom-buffer with 0x00

DEBUG: Passed mt76_eeprom_init 127 len:19880

the ret=len imho only works for mtd, if the mtd-partition has same size as eeprom

added a filesize-function and compared the loaded bytes with its return-value…now i got read ok

root@bpi-r64:~# modprobe mt7615e
[  957.477558] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[  957.630999] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  957.638469] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[  957.649409] cfg80211: failed to load regulatory.db
[  957.821120] DEBUG: Passed mt76_eeprom_init 150 len:19880 
[  957.827020] mt7622-wmac 18000000.wmac: Load firmware : /lib/firmware/mediatek/mt7622-wmac_rf.bin
[  957.841716] DEBUG: Passed mt76_get_of_file 51 fsize:1024 
[  957.853486] mt7622-wmac 18000000.wmac: Load firmware OK, count 1024 byte
[  957.875826] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
root@bpi-r64:~# [  957.955821] mt7622-wmac 18000000.wmac: N9 Firmware Version: _reserved_, Build Time: 20190801210351

and it looks like mac is correctly read from eeprom-file

10: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:0c:43:26:60:00 brd ff:ff:ff:ff:ff:ff
root@bpi-r64:~# hd /lib/firmware/mediatek/mt7622-wmac_rf.bin |less
00000000  22 76 05 00 00 0c 43 26  60 00...
1 Like

as i see all have 4 bytes (first 54Mbit,channel1-6,7-10,11-14 as delta). i guess i need to set only the position you’ve mentioned…with delta-bytes=0 all should have same tx-power,right?

is the value directly the dBM (like comment mentiones)?

the defined value 00100110 is then 38dB (in eeprom-file too for all 4 antennas) which seems wrong to me…(26 in front of the line is hexadecimal representation). what is suggested (imho ~21dB) or max value?

also it looks like the eeprom also contain MACs for BT and both ethernet-ports (full mt7622 eeprom)

0x26 decimal is 38, I guess it should be: 38 * 0.5 = 19dBm, the other three parameters should be fine-tuned, so just leave it alone.

I think there should be a Bluetooth address set. I haven’t debugged Bluetooth there. I am not familiar with it. I think I still need to ask you for advice in the future.

why this calculation? or did you get -19dB with the value of 38?

is there an easier way to get the filesize? see my repo i linked before for my current implementation

for bluetooth i did not much except adding some patches, installed bluez and made some basic tests with bluetoothctl

@nagi is there a way to fix the semaphore-issue on (my) 5.4 without disabling CONFIG_BT? i have still the modprobe-config which loads rfkill before mt7622

why this calculation? or did you get -19dB with the value of 38?

The power values are in unit of 0.5dBm in registers.

@nagi is there a way to fix the semaphore-issue on (my) 5.4 without disabling CONFIG_BT? i have still the modprobe-config which loads rfkill before mt7622

This happens because both wifi and bt share some parts in the wbsys, I haven’t dived into this issue yet.

1 Like

could you try kernel from my tree? change in build.conf board to bpi-r64 (remove # ), run

  • ./build.sh importconfig
  • ./build.sh

in mainline-kernel bluetooth is not working, at least because the scpsys and tty-patch is missing

or use kernels compiled from travis (github-releases)

Btw. I read that set_fs will be limited in 5.10 for some architectures because it can be a security hole. Is there any way to get the filesize without it?

1 Like

Hi frank,

Could you try this patch and see if patch semaphore problem fixes in mt7622? (With BT subsystem enabled)

It also tries to init again as you did, but merged into the code.

1 Like

thanks, this seems to fix it (need to patch manually, but it’s small patch) :slight_smile:

 root@bpi-r64:~# uname -a                                                        
Linux bpi-r64 5.4.72-bpi-r64-main #1 SMP PREEMPT Wed Nov 11 10:53:44 CET 2020 ax
root@bpi-r64:~# dmesg | grep hci0                                               
[    6.578465] Bluetooth: hci0: Device setup in 242847 usecs                    
root@bpi-r64:~# dmesg | grep mt7622                                             
[    0.000000] Kernel command line: board=bpi-r64 console=ttyS0,115200n1 earlyp2
[    1.191837] rtc_mt7622 10212800.rtc: registered as rtc0                      
[    1.931814] rtc_mt7622 10212800.rtc: setting system clock to 2000-01-01T00:0)
[    6.366853] mt7622_wmac 18000000.wmac: ASIC revision: 76220010               
[    6.410250] mt7622_wmac 18000000.wmac: Load firmware : /lib/firmware/mediaten
[    6.466927] mt7622_wmac 18000000.wmac: Load firmware OK, count 1024 byte     
[    6.497514] mt7622_wmac 18000000.wmac: MAC addr = 00:0c:43:26:60:00          
[    6.536181] mt7622_wmac 18000000.wmac: N9 Firmware Version: _reserved_, Buil1
[    6.633222] mt7622_wmac 18000000.wmac: Firmware init done                    
[    6.657449] mt7622_wmac 18000000.wmac: Driver own success                    
root@bpi-r64:~#
1 Like