[R2] Can't get the kernel to load MT7615 firmware on neither debian 9 (4.14) nor 10 (5.4)

You need 2 interfaces to run 2g4 and 5g (2 hostapd instances).

Make sure you have a space between the 1 and the >. Else stdout of blank echo is redirected not the char “1”

I did not started hostapd on the 2 wifi-interfaces due to less time,but always got 2 interfaces after echo 1 to dbdc file

If your chip gets hot you should put a heatsink on it. Which card do you have? I guess decreasing the tx power does not help much for temperature

I’m pretty sure I didn’t make that mistake since it’s not the first time I’ve had to change things like that one. But I’ll try again with a new image and the latest 5.10 from your github releases just in case.

I have this one.

Hi, I’ve finally had some time to tinker again with my bpi-r2, and a heatsink for the MT7615 :smiley:

Context: Fresh debian install from your image (downloaded yesterday). Already copied firmware files, both the ones from the link in your wiki and the customized one mentioned earlier on this thread. Kernel 5.10 from github (compiled by myself from yesterday’s 5.10-main, since the ones from github releases all hanged during “Starting kernel …”) with the default config (./build.sh importconfig).

The firmware gets loaded and the interface wlp1s0 is visible. However, I can’t interact with it. Trying to bring it up throws an RTNETLINK answers: Input/output error. Trying to enable dbdc does absolutely nothing (no errors, no changes, it just fails silently).

Looking through dmesg I’ve found a few things:

[    7.436214] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    7.461191] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    7.469873] cfg80211: failed to load regulatory.db

My research on this one tells me that there should be a file named regulatory.db at /lib/firmware, which there isn’t. Is it related to why my iw reg set gets reset to 00 on each reboot?

[   12.130666] mt7615e 0000:01:00.0: enabling device (0140 -> 0142)
[   12.130959] mt7615e 0000:01:00.0: Load eeprom: /lib/firmware/mediatek/mt7615e_rf.bin
[   12.138405] mt7615e 0000:01:00.0: Load eeprom OK, count 1200 byte
[   12.401604] mt7615e 0000:01:00.0 wlp1s0: renamed from wlan0
[   32.473900] mt7615e 0000:01:00.0: Message 16 (seq 1) timeout
[   32.473918] mt7615e 0000:01:00.0: Failed to get patch semaphore

The last line (Failed to get patch semaphore) I’ve seen it on this forum. However, the apparent solution was to compile branch 5.10-wifi, which hasn’t been updated since last year. Another proposed solution was to revert the semaphore patch, which I’m not sure where to start.

Also I’ve noticed that 5.10-main does not contain the driver mt76_new, but only mt76. Is this intentional?

regdb is not critical, but makes problems when using 5ghz…i guess you need to install regdb and maybe change your country…but this is step 2

furst you need to get the card working as Failed to get patch semaphore is critical…mhm, but you see wlanX for mt7615, right?..

you can try disabling bluetooth and reload mt7615 module…i thought this error was fixed…please disable eeprom-load (/lib/firmware/mediatek/mt7615_rf.bin) for testing the bootup…

for prebuilt kernel-images from github-releases…have you changed anything in you local repo to get it working? i guess serial-device is changed in your uboot-config

mt76_new is only in 5.4, because i merged mt7622/mt7615 from openwrt, 5.10 has these already included

furst you need to get the card working as Failed to get patch semaphore is critical…mhm, but you see wlanX for mt7615, right?..

Yes (the MAC address is valid too, but has been hidden):

root@bpi-r2:~# ip a
9: wlp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff

you can try disabling bluetooth and reload mt7615 module…i thought this error was fixed…please disable eeprom-load (/lib/firmware/mediatek/mt7615_rf.bin) for testing the bootup…

How can I disable bluetooth? There’s no kernel module loaded named bluetooth or bt-something. For the eeprom-load, if you mean removing the mt7615_rf.bin file, it doesn’t work (my first attempts didn’t have it). Still, I’ll try in a moment again, just in case.

for prebuilt kernel-images from github-releases…have you changed anything in you local repo to get it working? i guess serial-device is changed in your uboot-config

Not that I’m aware. Just git clone, cd, git checkout, ./build.sh importconfig, ./build.sh config to check if I see anything wrong (there was nothing wrong of course), and finally ./build.sh and then after a few minutes I selected the deb package.

mt76_new is only in 5.4, because i merged mt7622/mt7615 from openwrt, 5.10 has these already included

I see, thanks for confirming it.

EDIT: Wait, there is no mt7615_rf.bin file. The nearest one is the mt7615e_rf.bin, but if I remove that one, it doesn’t even load (it tries but fails).

thats the same as github releases do…see .github/workflows/build.yml have you used the right package (armhf/bpi-r2 instead of aarch64/bpi-r64)?

leaving eeprom-file shows an error, but this is not critical…just ignore it :wink:

ok, CONFIG_BT is builtin, you have to disable it by menuconfig and recompile

thats the same as github releases do…see .github/workflows/build.yml have you used the right package (armhf/bpi-r2 instead of aarch64/bpi-r64)?

Yes:

   82  dpkg -i linux-headers-5.10.25-bpi-r2-main_5.10.25-bpi-r2-main-1_armhf.deb 
   83  dpkg -i linux-image-5.10.25-bpi-r2-main_5.10.25-bpi-r2-main-1_armhf.deb 
   84  dpkg -i linux-libc-dev_5.10.25-bpi-r2-main-1_armhf.deb

leaving eeprom-file shows an error, but this is not critical…just ignore it :wink:

Alright, let me boot without the mt7615e_rf.bin and write the error here.

EDIT: Results without the mt7615e_rf.bin firmware (only the one from the link in your wiki):

root@bpi-r2:~# ip a
9: wlp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff

root@bpi-r2:~# dmesg | grep mt7615
[   12.083859] mt7615e 0000:01:00.0: enabling device (0140 -> 0142)
[   12.084119] mt7615e 0000:01:00.0: Load eeprom: /lib/firmware/mediatek/mt7615e_rf.bin
[   12.086802] mt7615e 0000:01:00.0: Open eeprom file failed: /lib/firmware/mediatek/mt7615e_rf.bin
[   12.288716] mt7615e 0000:01:00.0 wlp1s0: renamed from wlan0
[   32.474583] mt7615e 0000:01:00.0: Message 16 (seq 1) timeout
[   32.474602] mt7615e 0000:01:00.0: Failed to get patch semaphore

root@bpi-r2:~# ip link set wlp1s0 up
RTNETLINK answers: Input/output error

Exactly the same as before, just the error on dmesg

The error for eeprom is really a warning and can be ignored. I wanted to leave out this as issue…

I guess bluetooth is the problem,can you try with CONFIG_BT=m?

Semaphore error means that firmware (not eeprom) cannot be loaded (this is done after eeprom) as for loading firmware a lock (the semaphore itself) must be aquired…this is probably locked by another process (bluetooth). Seen this only on r64 till now

That’s what I’m trying to do. I’ve already compiled the new kernel with bluetooth completely disabled (since I’ll not need it anyways).

However, it seems I can’t uninstall the deb I generated yesterday…

root@bpi-r2:~# dpkg -P bananapi-r2-image-5.10-main
(Reading database ... 10849 files and directories currently installed.)
Removing bananapi-r2-image-5.10-main (5.10.25-1) ...
dpkg: error processing package bananapi-r2-image-5.10-main (--purge):
 installed bananapi-r2-image-5.10-main package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 bananapi-r2-image-5.10-main

was that the deb from build.sh-choice or the make_deps? first were my created debs the other is the linux-way (on github).

i guess the first one which creates entries in uenv.txt (linux way does not, you need to add uenv.txt entry manually)

you could try --force-all option for apt (maybe similar for dpkg available) to ignore errors in postrm script (this tries to delete the entry in uenv.txt)

was that the deb from build.sh-choice or the make_deps? first were my created debs the other is the linux-way (on github).

The one from the ./build.sh menu.

i guess the first one which creates entries in uenv.txt (linux way does not, you need to add uenv.txt entry manually)

Most probably.

you could try --force-all option for apt (maybe similar for dpkg available) to ignore errors in postrm script (this tries to delete the entry in uenv.txt)

Tried it, didn’t work, however…

I think I found the issue:

root@bpi-r2:~# grep -v uImage_5.10.25-main /boot/bananapi/bpi-r2/linux/uEnv.txt
root@bpi-r2:~# echo $?
1

My uEnv.txt only contains kernel=uImage_5.10.25-main. Remember on my previous posts from this thread that I had a problem where uEnv.txt didn’t exist? Well, it still doesn’t (didn’t) exist on your image when I dd'd it.

It seems when I installed the new kernel from the dpkg, the postinst script created one for me (/var/lib/dpkg/info/bananapi-r2-image-5.10-main.postinst), by adding a single line.

When trying to remove it, the postrm script tries to remove the line that postinst added, however grep fails with an error code of 1 as there are no matches since there are no more lines than the one it just filtered out…

And… yes, that was it! I just tried adding another line to uEnv.txt and it was removed successfully.

1 Like

I’ve just rebooted to the kernel without the bluetooth module. The result is: exactly the same as with bluetooth enabled :C.

EDIT: Just noticed that systemd-modules-load.service fails to load at boot. It seems it’s because of /etc/modules-load.d/cryptodev.conf (which contains blacklist cryptodev) trying to blacklist a module that doesn’t exist. It’s probably not related, but I thought I could mention it.

cryptodev is unrelated

have you look if bt module is loaded? maybe it’s loaded as depency…

There is no bt module loaded.

root@bpi-r2:~# lsmod
Module                  Size  Used by
configs                53248  0
nft_masq               16384  1
nft_nat                16384  1
nft_chain_nat          16384  1
nf_nat                 45056  3 nft_nat,nft_chain_nat,nft_masq
nf_conntrack          139264  3 nft_nat,nft_masq,nf_nat
nf_defrag_ipv6         20480  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack
mt7615e                24576  0
mt7615_common         114688  1 mt7615e
mt76                   73728  2 mt7615e,mt7615_common
lima                   61440  0
gpu_sched              40960  1 lima
spi_mt65xx             20480  0
mt6577_auxadc          16384  0
mtk_thermal            16384  0
pwm_mediatek           16384  0
mtk_pmic_keys          16384  0
nvmem_mtk_efuse        16384  0
nf_tables             200704  9 nft_nat,nft_chain_nat,nft_masq
nfnetlink              20480  1 nf_tables

Just in case, I’ve just checked if the kernel was the correct one:

root@bpi-r2:~# cat /proc/config.gz | gunzip | grep CONFIG_BT
# CONFIG_BT is not set

Ok, then you have completely dropped bt…

Maybe @nagi @Ryder.Lee or @skype have any idea about the semaphore error?

one of these 2 should normally fix the issue

ced050ae3ab6 2020-09-23 mt76: mt7615: retry if mt7615_mcu_init returns -EAGAIN 
2fc446487c36 2019-07-02 mt76: mt7615: always release sem in mt7615_load_patch

as far as i see the first one is not yet in 5.10-main, you can try to cherry-pick it

could you try adding the commit ced050ae3ab6 to your 5.10-main?

git checkout 5.10-main
git cherry-pick ced050ae3ab6

I still have the device on ip a, same as before.

The semaphore error is repeated every 20 seconds approx. Trying to bring the interface up still throws the same error, but takes a while.

While it’s trying to bring the interface up, I can’t ssh to the banana pi, but I can use a console that’s already connected… strange.

based on code it should be displayed max 10 times with 0.2s delay…you could try to increase the delay a bit, but i gues somewhere the semaphore is not released (maybe on Patch step before firmware)

What do you mean on “maybe on Patch step before firmware”? (I’m not familiar with the kernel loading stages, if that’s what you’re referring to.)

Should I try the other commit? (always release sem in mt7615_load_patch)

EDIT: I can’t seem to manage to cherry-pick the other commit… It seems there’s a conflict on drivers/net/wireless/mediatek/mt76/mt7615/mcu.c.

it’s not a kernel-thing more driver one :slight_smile:

i guess mt7615_load_patch does not release semaphore so mt7615_load_ram failes…you can try adding printk’s around these functions (and in mt7615_load_ram)

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);

the other patch was already in 5.10-main