Gpio90 is for sata and defined in dts.
According to Getting started with BananaPi R64 I need to set GPIO90 to high level and PCIe supports EC-25 4G module.
Nevertheless I can’t figure out why I end up with GPIO90 set to in/lo instead of out/high as should be for PCIe mode.
In the recent OpenWrt builds you can choose between PCIe mode (default) and SATA mode by selecting different device-tree overlay blobs at boot. That controls whether SATA or PCIe is active and also locks the asm_sel
GPIO to the matching level.
As PCIe is the default, you should not need to modify anything in order for both, PCIe and USB signals, to arrive at CN8. However, as the current supplied on the slot is limited, many modems don’t come up unless you change the current limit (see other reports in the wiki and forums about that).
Thank you. I’ve modified CN25 to increase current limit ([BPI-R64] OpenWRT kernel 5.4.40 running from eMMC), I need t do the same for CN8, right?
UPD: I changed the current limit (changed resistor to 3kOhm as in the post above), but it had no effect. GPIO90 is still set to in/lo and no USB modem is present in the system.
root@OpenWrt:/# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 409-511, parent: platform/10211000.pinctrl, pinctrl_moore:
gpio-409 ( |reset ) in hi IRQ
gpio-463 ( |reset ) out hi
gpio-490 ( |cd ) in lo IRQ ACTIVE LOW
gpio-494 ( |bpi-r64:pio:blue ) out lo
gpio-498 ( |bpi-r64:pio:green ) out lo
gpio-499 ( |asm_sel ) in lo
gpio-511 ( |wps ) in hi IRQ
Unfortunately /sys/kernel/debug/gpio
doesn’t really reflect reality for gpio-hogs.
Also, the USB lanes of the slot should not even be affected from what ever GPIO is set to, because that just controls whether the shared SATA/PCIE pins of the SoC are either connected to the SATA port or to the PCIe lane of the mPCIe slot.
And as the EC-25 only uses the USB (and SIM card and power supply) pins of the slot which are always available on CN8 (and not available on CN25 at all afaik) it should work as soon as it has enough power to come up. I’ve heard reports from users that power is not supplied by the board in case of SATA being selected as it depends on the PCIe controller being enabled, apparently. I had no time yet to verify or fix that and if you haven’t manually switched the installation to SATA mode, you don’t need to be concerned about that.
Regarding the slot, I also see the same line
gpio-499 ( |asm_sel ) in lo
on my system and the MT7615E module sitting in the CN8 slot works great. So maybe we miss some USB port nodes in DTS? I never had the chance to try the USB pins of the slot as I only got NGFF modem in NGFF->USB3 adapter externally.
Thanks.
I think I misguided you and myself with GPIO. I found out that mainline image does see the EC25 board (http://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/openwrt-mediatek-mt7622-bananapi_bpi-r64-sdcard.img.gz) but if I compile the image myself with all the defaults from scratch the modem is missing from cat /sys/kernel/debug/usb/devices
.
Below is the output from mainline image.
root@OpenWrt:/# cat /sys/kernel/debug/usb/devices
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 2
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 5.10
S: Manufacturer=Linux 5.10.52 xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=1a0c0000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=2c7c ProdID=0125 Rev= 3.18
S: Manufacturer=Android
S: Product=Android
C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=5000 MxCh= 1
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 3.00 Cls=09(hub ) Sub=00 Prot=03 MxPS= 9 #Cfgs= 1
P: Vendor=1d6b ProdID=0003 Rev= 5.10
S: Manufacturer=Linux 5.10.52 xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=1a0c0000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
So now I need to find out the difference between mainline image and default build with Bananapi Bpi-R64 profile.
There is a quite straight answer to that and it’s here:
https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/config.buildinfo
Thank you. Now that’s a mystery.
I’ve recompiled OpenWrt from scratch (with make distclean
and git pull
) with the above config.buildinfo and the only patch from @frank-w to make mt76 module take calibration data from files.
And 4G EC25 module isn’t listed.
root@OpenWrt:/# cat /sys/kernel/debug/usb/devices
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 2
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 5.10
S: Manufacturer=Linux 5.10.52 xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=1a0c0000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=5000 MxCh= 1
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 3.00 Cls=09(hub ) Sub=00 Prot=03 MxPS= 9 #Cfgs= 1
P: Vendor=1d6b ProdID=0003 Rev= 5.10
S: Manufacturer=Linux 5.10.52 xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=1a0c0000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
What am I missing?
P. S. Maybe there is a way to make mainline image take WiFi calibration data from files?
You can use mainline snapshot SDK to build only package/kernel/mt76
from source and replace the wifi-related kernel modules.
Looks like SDK won’t work for me as I’m using MacOS.
Is there any other way I can reproduce mainline image exactly as it is apart from mt76 patch?
I’m afraid using a Linux x86_64 VM is the most straight forward way to go. Reproducing the mainline image using the config seed can also work on Darwin or architectures other than x86_64, but you really have to build with all kmods (incl. those from feeds) enabled for the kernel to be compatible (and that may turn out to be more complicated than just using SDK inside a Ubuntu VM)
Sorry for asking so much noobs questions, but could you be more specific? I’ve got a Linux VM with mainline SDK up and running, but after performing these commands mt76 source code is nowhere to be found. And I can’t figure out where to put .patch files.
tar -xf openwrt-sdk-mediatek-mt7622_gcc-8.4.0_musl.Linux-x86_64.tar.xz
cd openwrt-sdk-mediatek-mt7622_gcc-8.4.0_musl.Linux-x86_64/
./scripts/feeds update -a
./scripts/feeds install mt76
make menuconfig
make feeds/base/package/kernel/mt76 download
make feeds/base/package/kernel/mt76 prepare
make -j8 package/feeds/base/mt76/compile
You can create a folder feeds/base/package/kernel/mt76/patches/
and put your patch there.
From the looks of it it has no effect since no source files ever appear in mt76 folder. I know that there should be a eeprom.c
file but it’s nowhere to be found in the SDK folder.
$ ls feeds/base/package/kernel/mt76
Makefile patches
After installing the newly compiled mt76-test_2021-07-15-bbebea7d-4_aarch64_cortex-a53.ipk
nothing has changed.
Here’s example patch to hardcode mt7622 wmac eeprom.
Thank you, I know this approach. But the problem I face is not the patch itself, but the fact that it’s not applied.
Or that self-compiled OpenWrt image for BPI-R64 is different from the one precompiled in mainline repo.
If you create a folder patches
in feeds/base/package/kernel/mt76
and place the patch there it should get applied during build.
Maybe watch the build to see if that’s really happening:
make package/mt76/{clean,compile} V=99
Thank you, this worked.
I’ve got confused with paths like feeds/base/package/...
Furthermore the resulting package is located in
bin/targets/mediatek/mt7622/packages
instead of
bin/packages/aarch64_cortex-a53/base
which I can’t figure out why.
After executing make package/mt76/{clean,prepare} QUILT=1
source code appears in
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/mt76-2021-07-15-bbebea7d
BTW do you know if it’s possible to include binary files in patches? The idea is to have a mt76-firmware
package which would put two additional calibration data files in /lib/firmware/mediatek/
directory.
The package is built per target (intead of per architecture) due to PKG_NONSHARED:=1
being set. This is because it’s a kernel module and needs to match the exact kernel build of the target, and not just the architecture.
I don’t think it’s possible to include binaries in patches, and it’s also just something nobody should do imho. You can, however, place the files in package/kernel/mt76/files
and edit package/kernel/mt76/Makefile
to have them included in the a generated package mt7622-default-eeprom
(or something like that).
Maybe you can put your files directly to https://github.com/openwrt/openwrt/tree/master/target/linux/mediatek/base-files