[BPI-R64] OpenWRT kernel 5.4.40 running from eMMC

Nice to see there is an official patch now…i got them here or by email and collected over time :slight_smile:

I don’t know if openwrts build-system can handle mbox files…then you can click “series” button in the upper right corner if patchwork site to download a “git am” compatible file with all patches from the series

Maybe you can change that by modifying udev-files.

There is a discussion about the 6dbm issue,but afaik no working solution…here is a hint why this happens,but afair patch was bot accepted and maybe not compatible with mainline code

@svintuss As for 6dbm limit. Compile mt76 driver with eeprom.c from git on top of this thread. This is working for me on mt7622. I do not have 7615 so cannot check.

1 Like

After replacing eeprom.c mt7615 is non-functional: It became a clone of mt7622 device (same MAC, system thinks it’s 2.4 GHz).

Compare this output to my previous post: ifindex, wdev and addr are different.

root@OpenWrt:/# iw dev
phy#1
        Interface wlan1
                ifindex 15
                wdev 0x100000005
                addr 00:0c:43:26:60:00
                type AP
                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
phy#0
        Interface wlan0
                ifindex 16
                wdev 0x7
                addr 00:0c:43:26:60:00
                type managed
                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

I’m sure this is because the fixed eeprom-data in mt76_get_of_eeprom called for every device handled by the driver

Do you see your mac-address? :grin:

This function should be called only for mt7622 wifi and not mt7615…

If i see this you see that with the eeprom-data all cards will be handled as 7622 because of first 2 bytes

You need something like this in mt76_get_eeprom function:

switch (mt76_chip(dev)) {
    case 0x7622: /*here existing content*/ break;
    case 0x7615: /*eeprom data for 7615*/ break;
}

But make sure function returns 1 else it will break mt76_eeprom_init…

1 Like

Thank you, @frank-w. Do you have any ideas where can I get eeprom data for 7615?

@niebieski20 where did you get mt7622 eeprom?

You can skip the eeprom part for mt7615 in a first step (only write eeprom data for mt7622) but let function return always 1. I guess he used the eeprom-data normaly written to mtd partition in openwrt

have modified eeprom.c like i’ve mentioned…

eeprom.c (7,3 KB)

Thank you.

Am I getting this right?

static int
mt76_get_of_eeprom(struct mt76_dev *dev, int len)
{

	switch (mt76_chip(dev)) {
    		case 0x7622:

			static const u8 eeprom[] = {
				 0x22, 0x76, 0x05, 0x00, 0x00, 0x0C, 0x43, 0x26, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x44, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x20, 0x00, 0x00, 0xB3, 0x40, 0xB6, 0xC3, 0xC3, 0x26, 0x00, 0x00, 0x00, 0x41, 0xC4, 0x26, 0x00, 0x00, 0x00, 0x41, 0xC4, 0x26, 0x00, 0x00, 0x00, 0xC0, 0xC5, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC3, 0xC3, 0xC2, 0xC1, 0x00, 0xC3, 0x00, 0xC3,
		  0x00, 0x81, 0x81, 0x81, 0x83, 0xC1, 0xC1, 0x82, 0x83, 0x83, 0x83, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x84, 0x00, 0x2E, 0x00, 0x90, 0x00, 0x00, 0x87, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		};
			memcpy(dev->eeprom.data, eeprom, 0x400);

			break;
    		
		case 0x7615: /*eeprom data for 7615*/ 
			break;
		};


	int ret; 
	ret = 1;  // this part makes the function to always return 1, right?
	return ret;

}

Can images from this post be of any help in extracting mt7615 eeprom? Full support for mt7615 WiFi is claimed.

http://forum.banana-pi.org/t/bpi-r64-new-image-lede17-openwrt-image-kernel-4-4-177-sd-emmc-booting-2020-04-09/10924

lspci in this LEDE image looks like this.

root@LEDE:/# lspci

0000:00:00.0 Unclassified device [0002]: MEDIATEK Corp. Device 7622
0001:00:00.0 PCI bridge: MEDIATEK Corp. Device 5396
0001:01:00.0 Unclassified device [0002]: MEDIATEK Corp. Device 7615

basicly yes, but i have renamed the data-const and moved outside the switch for better readability. also the ret-lines can be merged to int ret=1; or easier “return 1;” as replacement for the 3 lines

i think you do not need any additional eeprom-data, because card should have it’s own burned onto it. i had also used mt7622 without any additional eeprom-data, but i have no mt7615 which may breaḱ and have not yet looked at the 6dbm-issue (i guess eeprom-data is fix for this)

Ok, so this is what I came up with.

static int
mt76_get_of_eeprom(struct mt76_dev *dev, int len)
{

	static const u8 eeprom_mt7622[] = {
		 0x22, 0x76, 0x05, 0x00, 0x00, 0x0C, 0x43, 0x26, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x44, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x20, 0x00, 0x00, 0xB3, 0x40, 0xB6, 0xC3, 0xC3, 0x26, 0x00, 0x00, 0x00, 0x41, 0xC4, 0x26, 0x00, 0x00, 0x00, 0x41, 0xC4, 0x26, 0x00, 0x00, 0x00, 0xC0, 0xC5, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC3, 0xC3, 0xC2, 0xC1, 0x00, 0xC3, 0x00, 0xC3,
  0x00, 0x81, 0x81, 0x81, 0x83, 0xC1, 0xC1, 0x82, 0x83, 0x83, 0x83, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x84, 0x00, 0x2E, 0x00, 0x90, 0x00, 0x00, 0x87, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};


	switch (mt76_chip(dev)) {
    		case 0x7622: /*write eeprom data for 7622*/ 
			memcpy(dev->eeprom.data, eeprom_mt7622, 0x400);
			break;
    		
		case 0x7615: /*write eeprom data for 7615*/ 
			break;
		};


	return 1; // this part makes the function to always return 1, right?

}

As a result I should have mt7622 working on 20dBm and mt7615 functional but limited to 6dBm, right?

1 Like

right, just try it out…i have not yet tested it…

Thanks, I’ve got mt7615 functionality back, but it’s still limited to 6dBm.

root@OpenWrt:/# iw dev
phy#1
        Interface wlan1
                ifindex 8
                wdev 0x100000002
                addr 00:0c:43:26:60:00
                type AP
                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
phy#0
        Interface wlan0
                ifindex 7
                wdev 0x2
                addr 42:03:a1:a3:81:24
                ssid testssid
                type managed
                channel 48 (5240 MHz), width: 80 MHz, center1: 5210 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
1 Like

The connection issue is fixed by

https://patchwork.kernel.org/patch/11580563/

https://pastebin.com/NSh9f6Dp

It works for @Kosyak

Hello all. I took a break from further experimentation to get the BPI MT7615 PICe card working on my BPI R64 rev 1.1. I was able to get the 2020-05-08 update ,Debian10 with kernel 5.4.0 installed on eMMC and the MT7615 is working somewhat satisfactorily with it.

I am trying to keep the MT7622 and DRAM chips cooler using a 5V fan (extracted from an old laptap). Can someone help me how to control the fan speed using PWM? I have hooked the fan to the fan socket (which is besides the WPS switch), but presently it runs at full speed. The schematic shows FAN_OUT has different labels: GPIO97/PWM_CH3/TXD4 or G12, PWM3 I don’t know exactly how to try out different PWM duty cycles from the command line. I will eventually do it programatically.

I can start a new topic to discuss this request if it is not appropriate here.

A new topic discussing about the pwm would be better and created it [BPI-R64] PWM-support

1 Like

Thank you for starting the new topic. I’ll repost my previous message there.

I finally have some good news. I’ve managed to fix the 6dBm limit for mt7615e card thanks to @Ryder.Lee and @frank-w.

One should recompile OpenWRT (or mt76 module) with this eeprom.c. I’ve hard-coded mt7615e.eeprom.bin contents from here. I’ve also tried a more common MT7615E1_EEPROM.bin found here and many other repositories. These files have two bytes different but there is no difference in performance or functionality.

eeprom.c (13.5 KB)

As a result I’ve got WiFi working on 2.4 and 5 GHz in both AP and client modes.

root@OpenWrt:/# iw dev
phy#1
        Interface wlan1
                ifindex 8
                wdev 0x100000002
                addr 00:0c:43:26:60:00
                type AP
                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
phy#0
        Interface wlan0
                ifindex 7
                wdev 0x2
                addr 00:0c:43:26:60:00
                ssid testssid
                type managed
                channel 48 (5240 MHz), width: 80 MHz, center1: 5210 MHz
                txpower 16.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

The downsides as I see them:

  1. mt7615 is up from 6 dBm to 16 dBm but it is still not enough. MacBook’s own 5GHz WiFi connection gives much higher speeds than mt7615 in client mode. Images from @sinovoip seem to have mt7615 working on 20 dBm.
  2. I wouldn’t call this an elegant solution as it requires manually replacing eeprom.c, recompiling OpenWRT and copying mt76.ko, mt7615-common.ko and mt7615e.ko to /lib/modules/5.4.42/
  3. Both cards have the same MAC address, which seems to be encoded in eeprom.

Although these steps give me an almost working OpenWRT router, I still have some questions:

  1. How can I increase both mt7622 and mt7615 to their maximum capabilities? I want them to operate at 30 dBm to cover large areas in the countryside.
  2. If there is no obvious answer to the first question, how can I increase mt7615 to at least 20 dBm? Is it possible to extract/get eeprom from official @sinovoip LEDE/Ubuntu/Debian images?
  3. @frank-w could you please clarify how to make the driver load eeprom from file as you advised here? I now have kmod-mt7615e included in kernel and both kmod-mt76 and kmod-mt76x2 excluded from build.

Against same mac just change bytes 4-9 (5-10 if counting from 1) in your struct for mt7622 or 7615 :slight_smile:

For eeprom loading from file…basicly in similar way like firmware

Here an api-call “request_firmware” is used which loads file from filesystem defined in headerfile into a struct firmware

https://www.kernel.org/doc/html/v4.13/driver-api/firmware/request_firmware.html#request-firmware

Maybe a similar function exists without writing firmware to device/starting it

Else there are basic file operation functions in c (e.g. https://stackoverflow.com/a/14002980). You can look into source of request firmware how it gets the full path to file (afaik it checks multiple paths) and create a new function with only needed code for eeprom

Afaik the core-part you need here is

https://elixir.bootlin.com/linux/latest/source/drivers/base/firmware_loader/main.c#L498

Or maybe this directly

https://elixir.bootlin.com/linux/latest/source/fs/exec.c#L899

Which makes memory allocation,but you need to create path-string before

1 Like

@svintuss As for TX power. Change country to US in wifi settings. You will be able to go to up 28dbm with mt7622. Bare in mind that it each country have different restrictions for tx power of customer transsivers and can be illegal to increase them.

1 Like

@frank-w thank you for explanation, I’ll try to do things right.

@niebieski20 thanks for the advice. Manually specifying country in /etc/config/wireless did have some effect. mt7622 responds to country code change but mt7615 doesn’t. mt7622 won’t go past 25 dBm and mt7615 is stuck on 16 dBm. I’ve tried ‘US’, ‘AU’ and ‘RU’ domains.

root@OpenWrt:/# iw reg get
global
country AU: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 36), (N/A)
        (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
        (5470 - 5600 @ 80), (N/A, 27), (0 ms), DFS
        (5650 - 5730 @ 80), (N/A, 27), (0 ms), DFS
        (5730 - 5850 @ 80), (N/A, 36), (N/A)
        (57000 - 66000 @ 2160), (N/A, 43), (N/A), NO-OUTDOOR

root@OpenWrt:/# iw dev
phy#1
        Interface wlan1
                ifindex 9
                wdev 0x100000003
                addr 00:0c:43:26:60:00
                ssid OpenWrt_2.4
                type AP
                channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz
                txpower 25.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 10
                wdev 0x3
                addr 00:0c:43:26:60:00
                ssid testssid
                type managed
                channel 48 (5240 MHz), width: 80 MHz, center1: 5210 MHz
                txpower 16.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

I still think there is some limitation in eeproms. I found eeprom bytes meaning in mt76x02_eeprom.h and in mt7615/eeprom.h files. Seems like I need to change some bytes in eeprom to unlock mt7615 card’s full potential.

// This is from mt76x02_eeprom.h

enum mt76x02_eeprom_field {
	MT_EE_CHIP_ID =				0x000,
	MT_EE_VERSION =				0x002,
	MT_EE_MAC_ADDR =			0x004,
	MT_EE_PCI_ID =				0x00A,
	MT_EE_ANTENNA =				0x022,
	MT_EE_CFG1_INIT =			0x024,
	MT_EE_NIC_CONF_0 =			0x034,
	MT_EE_NIC_CONF_1 =			0x036,
	MT_EE_COUNTRY_REGION_5GHZ =		0x038,
	MT_EE_COUNTRY_REGION_2GHZ =		0x039,
	MT_EE_FREQ_OFFSET =			0x03a,
	MT_EE_NIC_CONF_2 =			0x042,

	MT_EE_XTAL_TRIM_1 =			0x03a,
	MT_EE_XTAL_TRIM_2 =			0x09e,

	MT_EE_LNA_GAIN =			0x044,
	MT_EE_RSSI_OFFSET_2G_0 =		0x046,
	MT_EE_RSSI_OFFSET_2G_1 =		0x048,
	MT_EE_LNA_GAIN_5GHZ_1 =			0x049,
	MT_EE_RSSI_OFFSET_5G_0 =		0x04a,
	MT_EE_RSSI_OFFSET_5G_1 =		0x04c,
	MT_EE_LNA_GAIN_5GHZ_2 =			0x04d,

	MT_EE_TX_POWER_DELTA_BW40 =		0x050,
	MT_EE_TX_POWER_DELTA_BW80 =		0x052,

	MT_EE_TX_POWER_EXT_PA_5G =		0x054,

	MT_EE_TX_POWER_0_START_2G =		0x056,
	MT_EE_TX_POWER_1_START_2G =		0x05c,

	/* used as byte arrays */
#define MT_TX_POWER_GROUP_SIZE_5G		5
#define MT_TX_POWER_GROUPS_5G			6
	MT_EE_TX_POWER_0_START_5G =		0x062,
	MT_EE_TSSI_SLOPE_2G =			0x06e,

	MT_EE_TX_POWER_0_GRP3_TX_POWER_DELTA =	0x074,
	MT_EE_TX_POWER_0_GRP4_TSSI_SLOPE =	0x076,

	MT_EE_TX_POWER_1_START_5G =		0x080,

	MT_EE_TX_POWER_CCK =			0x0a0,
	MT_EE_TX_POWER_OFDM_2G_6M =		0x0a2,
	MT_EE_TX_POWER_OFDM_2G_24M =		0x0a4,
	MT_EE_TX_POWER_OFDM_5G_6M =		0x0b2,
	MT_EE_TX_POWER_OFDM_5G_24M =		0x0b4,
	MT_EE_TX_POWER_HT_MCS0 =		0x0a6,
	MT_EE_TX_POWER_HT_MCS4 =		0x0a8,
	MT_EE_TX_POWER_HT_MCS8 =		0x0aa,
	MT_EE_TX_POWER_HT_MCS12 =		0x0ac,
	MT_EE_TX_POWER_VHT_MCS0 =		0x0ba,
	MT_EE_TX_POWER_VHT_MCS4 =		0x0bc,
	MT_EE_TX_POWER_VHT_MCS8 =		0x0be,

	MT_EE_2G_TARGET_POWER =			0x0d0,
	MT_EE_TEMP_OFFSET =			0x0d1,
	MT_EE_5G_TARGET_POWER =			0x0d2,
	MT_EE_TSSI_BOUND1 =			0x0d4,
	MT_EE_TSSI_BOUND2 =			0x0d6,
	MT_EE_TSSI_BOUND3 =			0x0d8,
	MT_EE_TSSI_BOUND4 =			0x0da,
	MT_EE_FREQ_OFFSET_COMPENSATION =	0x0db,
	MT_EE_TSSI_BOUND5 =			0x0dc,
	MT_EE_TX_POWER_BYRATE_BASE =		0x0de,

	MT_EE_TSSI_SLOPE_5G =			0x0f0,
	MT_EE_RF_TEMP_COMP_SLOPE_5G =		0x0f2,
	MT_EE_RF_TEMP_COMP_SLOPE_2G =		0x0f4,

	MT_EE_RF_2G_TSSI_OFF_TXPOWER =		0x0f6,
	MT_EE_RF_2G_RX_HIGH_GAIN =		0x0f8,
	MT_EE_RF_5G_GRP0_1_RX_HIGH_GAIN =	0x0fa,
	MT_EE_RF_5G_GRP2_3_RX_HIGH_GAIN =	0x0fc,
	MT_EE_RF_5G_GRP4_5_RX_HIGH_GAIN =	0x0fe,

	MT_EE_BT_RCAL_RESULT =			0x138,
	MT_EE_BT_VCDL_CALIBRATION =		0x13c,
	MT_EE_BT_PMUCFG =			0x13e,

	MT_EE_USAGE_MAP_START =			0x1e0,
	MT_EE_USAGE_MAP_END =			0x1fc,

	__MT_EE_MAX
};

// This is from mt7615/eeprom.h

enum mt7615_eeprom_field {
	MT_EE_CHIP_ID =				0x000,
	MT_EE_VERSION =				0x002,
	MT_EE_MAC_ADDR =			0x004,
	MT_EE_NIC_CONF_0 =			0x034,
	MT_EE_NIC_CONF_1 =			0x036,
	MT_EE_WIFI_CONF =			0x03e,
	MT_EE_CALDATA_FLASH =			0x052,
	MT_EE_TX0_2G_TARGET_POWER =		0x058,
	MT_EE_TX0_5G_G0_TARGET_POWER =		0x070,
	MT_EE_TX1_5G_G0_TARGET_POWER =		0x098,
	MT_EE_EXT_PA_2G_TARGET_POWER =		0x0f2,
	MT_EE_EXT_PA_5G_TARGET_POWER =		0x0f3,
	MT7663_EE_TX0_2G_TARGET_POWER =		0x123,
	MT_EE_TX2_5G_G0_TARGET_POWER =		0x142,
	MT_EE_TX3_5G_G0_TARGET_POWER =		0x16a,

	MT7615_EE_MAX =				0x3bf,
	MT7622_EE_MAX =				0x3db,
	MT7663_EE_MAX =				0x400,
};

I’ve tried changing MT_EE_COUNTRY_REGION_5GHZ and MT_EE_COUNTRY_REGION_2GHZ bytes in mt7615e.eeprom.bin from 0x01 to 0x00 but that had no effect on 16 dBm limit. Maybe @Ryder.Lee could help with these settings?

1 Like

I’ve extracted mt7615 eeprom from the official BPI LEDE image. It’s loaded from /etc_ro/wlan/MT7615E_EEPROM2.bin just like @frank-w suggested.

Here’s the difference with the eeprom that @Ryder.Lee linked.

This might answer the question which bytes in mt7615 eeprom are responsible for TX power. mt7615 limit has gone up from 16 dBm to 23 dBm.

However this didn’t solve poor connection speed issue.

  1. On MacBook Pro connected to WiFi 5Ghz network I get 270 Mbit download and 100 Mbit upload.
  2. On same MacBook connected to BPI-R64 with ethernet which in turn is connected to 5 Ghz WiFi I get only 200 Mbit download (unstable) and 8 Mbit upload. Upload speed does not change upon changing regional domain and TX power. 16 dBm - 20 dBm - 22 dBm all give similar results.

Any advice on increasing mt7615 upload and download speeds?

P. S. Here are an updated eeprom.c and MT7615E_EEPROM2.bin itself.

eeprom.c (13.5 KB) MT7615E_EEPROM2_BPI.bin (1 KB)

1 Like