[Banana Pi BPI-R64] Mainline OpenWRT image

I upgraded luci-mod-network and it handles the bridge interface differently that it used before. But now the LAN bridge does not have any fixed IP address and it does not act as a DHCP server. What should I change in the new config? Here is the bridge related section in the /etc/network/config:

config interface 'lan'
    option proto 'static'
    option ipaddr '192.168.0.1'
    option netmask '255.255.255.0'
    option ip6assign '60'
    option ifname 'br-lan'

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'lan1'
    list ports 'lan2'
    list ports 'lan3'
    list ports 'lan4'

I guess you need to define br-lan before assign ip-address to it…so basicly swapping both blocks

If I add Option type 'bridge' to the config interface 'lan' section, it already gets IP address, but still not leasing DHCP addresses to clients… I wonder if there is a comprehensive description of the network config options, or at least a sample configuration with the changed syntax.

Edit: I can add br-lan and the ports manually with brctl. Then it works. But when I open the Network - Interfaces configuration page, it says:

The existing network configuration needs to be changed for LuCi to function properly. Upon pressing “Continue”, bridges configuration will be moved from “interface” sections to “device” sections the network will be restarted to apply the updated configuration.

But after this change the lan1…lan4 ports are not bridged to eth0, and the bridged ports are down. I can restore it only if I add option type 'bridge to the config interface ‘lan’ section, and add the lan1 … lan4 interfaces to the bridge manually with brctl addif br-lan lan1 and same for lan2 lan3 lan4. However, this is not compatible with LuCi. LuCi version: git-21.140.43486-398982f

After upgrading the kernel to 5.10.39 it works fine. Edit: it worked fine, but today my wan6 interface “disappeared”. It is present in LuCi, but not showing up by ifconfig:

root@OpenWrt:/sys/class/net# ifconfig | grep Link
`br-lan    Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5A`
      inet6 addr: fe80::6855:75ff:fe51:de5a/64 Scope:Link
eth0      Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5A
      inet6 addr: fe80::6855:75ff:fe51:de5a/64 Scope:Link
ifb4eth1  Link encap:Ethernet  HWaddr 4A:80:25:54:53:95
      inet6 addr: fe80::4880:25ff:fe54:5395/64 Scope:Link
lan1      Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5A
lan2      Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5A
lan3      Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5A
lan4      Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5A
lo        Link encap:Local Loopback
wan       Link encap:Ethernet  HWaddr 6A:55:75:51:DE:5B
      inet6 addr: fe80::6855:75ff:fe51:de5b/64 Scope:Link
root@OpenWrt:/sys/class/net# ls
6in4-WAN6  br-lan     eth1       lan1       lan3       lo         wan
6in4-wan6  eth0       ifb4eth1   lan2       lan4       sit0       wlan0

Also I created a second 6in4-WAN6 device by mistake. Maybe this caused the confusion. Is there any way to remove it? And how could I restore the wan6 interface? My kernel is 5.10.39 from snapshot image.

I try to setup Samba4 server via Lui. It seems no working anymore after update to 5.10.39.

For those who interested in fully-working internal Wi-Fi - since mt76 driver loads EEPROM data for MT7622 from MTD partition, it’s possible to place this data into SPI-NAND chip where mt76 driver can found it.

You will need this patch for kernel (place to target/linux/mediatek/patches-5.10/): 116-dts-bpi64-add-wmac-eeprom-partition.patch (504 Байта) and this for u-boot (place to package/boot/uboot-mediatek/patches/): 405-bananapi_bpi_r64_add_wmac_eeprom_partition.patch (796 Байты)

This patches adds partition with eeprom (called “rf”) to SPI-NAND/mtd. After building and installing you’ll need to flash MT7622_EEPROM.bin (1 КБ) into “rf” partition:

mtd erase rf
mtd write MT7622_EEPROM.bin rf

After reboot you’ll get fully-working internal Wi-Fi with fixed MAC-address.

1 Like

Is there a way to add rf only to spi-nand without touching gpt from sdcard/emmc? I do not see link to spi-nand…it seems to use current bootdevice as bootargs are changed too

How do mt76 driver search in spi nand…afair it looks only in current devices mtd partitions which is sd/emmc

Or you can just add this patch to mt76

1 Like

mt76 driver takes reference to partition from device tree, here is resulting dts from openwrt:

	snand: spi_nand@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "spi-nand";
		spi-max-frequency = <104000000>;
		reg = <0>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "bl2";
				reg = <0x0 0x80000>;
				read-only;
			};

			partition@80000 {
				label = "fip";
				reg = <0x80000 0x200000>;
				read-only;
			};

			rf: partition@280000 {
				label = "rf";
				reg = <0x280000 0x80000>;
			};

			partition@300000 {
				label = "ubi";
				reg = <0x300000 0x7d00000>;
			};
		};
	};

skip-skip-skip

&wmac {
	mediatek,mtd-eeprom = <&rf 0x0000>;
	status = "okay";
};

I’d defined mtd partition with object id “rf” (rf: partition@280000) and referenced it as mediatek,mtd-eeprom parameter of wmac. mt76 driver reads mediatek,mtd-eeprom, checks that it is a mtd partition ref and extract data through kernel mtd subsystem. Take a look at https://github.com/openwrt/mt76/blob/67ed4d902c848bb3f94cf14b87b20e4814dadc82/eeprom.c#L27

So, in case of other systems (not openwrt) you can define snand with rf-partition and reference it in wmac node in device tree. Than, after boot, just flash eeprom data to that partition using mtd-utils. So, there is no need to touch anything on MMC/SD and rf data will be always with hardware.

I think this question is more suitable for this thread. I can’t make EC25-E 4G board to work in CN8 slot.

GPIO90 (499 as 409+90) seems to be set to out/high upon boot:

[    0.028706] gpio-499 (asm_sel): hogged as output/high

But the modem board is not detected:

root@OpenWrt:/# lsusb 
Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.51 xhci-hcd xHCI Host Controller
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.51 xhci-hcd xHCI Host Controller
root@OpenWrt:/# ls /dev/tty
tty    ttyS0  ttyS1

And GPIO90 is eventually set to low level and I can’t change it. I always get a “Resource busy” error:

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 
root@OpenWrt:/# echo 499 > /sys/class/gpio/export
ash: write error: Resource busy

fw_setenv bootconf config-mt7622-bananapi-bpi-r64-sata or fw_setenv bootconf config-mt7622-bananapi-bpi-r64-pcie1 have no effect on GPIO90 state.

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

1 Like

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?