[Banana Pi BPI-R64] Mainline OpenWRT image

afair uboot-way depends on right dts. it needs mac-address property and alias for ethernet-node

Run this in openwrt:

fw_setenv ethaddr newaddress

Or in uboot

setenv ethaddr newaddress

saveenv

1 Like

I applied the fw_setenv ethaddr command, and it changed the MAC address indeed (after rebooting). Now every interface has the same MAC address. I think it changed the internal bridge address. Is there any way to specify it separately for the wan/eth1 also? Perhaps it is not so important, because br-lan and wan are on different segments, so there should be no ARP conflict.

It changes adress of eth0 (gmac between soc and switch). eth1 should not exist and wan (dsa port) is connected to eth0 too

Independently of the main MAC address you may configure an individual mac address for wan port (or any other port) in OpenWrt. This works in LuCI:

or in CLI:

uci add network device
uci set network.@device[-1].name= 'wan'
uci set network.@device[-1].macaddr= '02:03:04:05:06:07'

Thanks, it worked :+1:

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