Adding OpenWrt support for Archer A6 v3

Tell us what you're doing exactly, or post both the commands and the result together

Yes, it is similar to mt7615 but much more similar to mt7613.

Something like mt7612 and mt7602 is here with mt7663 and mt7613

Setup the TFTP server @192.168.0.5. No switch in-between.

Copied the initramfs.bin file generated form Linux build to TFTP folder and named it as as test.bin. Router expects boot file as test.bin.

Then ran following commands form u-boot command prompt:

tftpboot
bootm

@lukasz92 @arktrin Yes, everything here is supported, and MT76x3 use the same driver, see this commit

1 Like

@vrpatil SHOW YOUR LOGS, very hard to help you otherwise

so did it work or no?

bootm command requires you to put the load address from tftpboot, but because you don't share your output, I have no idea what it is. It might be
bootm 0x81000000

also if it doesn't work, you can try to make tftpboot load it at a different address
tftpboot 0x80800000
bootm 0x80800000

Thanks! Sounds inspiring :grinning:


MT7621 # tftpboot

 NetLoop,call eth_halt !

 NetLoop,call eth_init !
Trying Eth0 (10/100-M)

 ETH_STATE_ACTIVE!!
*** Warning: no boot file name; using 'test.bin'
TFTP from server 192.168.0.5; our IP address is 192.168.0.1
Filename 'test.bin'.

 TIMEOUT_COUNT=10,Load address: 0x84000000
Loading: checksum bad
checksum bad
T T T T T T T checksum bad
checksum bad
T Got ARP REPLY, set server/gtwy eth addr (a4:ba:db:b2:5c:08)
Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ########
done
Bytes transferred = 5031914 (4cc7ea hex)
LoadAddr=84000000 NetBootFileXferSize= 004cc7ea
MT7621 # bootm
## Booting image at 84000000 ...
Bad Magic Number,01000000
MT7621 #

Tried with loading at 0x80800000, same as above.

MT7621 # tftpboot 0x80800000

 NetLoop,call eth_halt !

 NetLoop,call eth_init !
Trying Eth0 (10/100-M)

 ETH_STATE_ACTIVE!!
*** Warning: no boot file name; using 'test.bin'
TFTP from server 192.168.0.5; our IP address is 192.168.0.1
Filename 'test.bin'.

 TIMEOUT_COUNT=10,Load address: 0x80800000
Loading: Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REQUEST, return our IP
Got ARP REPLY, set server/gtwy eth addr (a4:ba:db:b2:5c:08)
Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ########
done
Bytes transferred = 5031914 (4cc7ea hex)
LoadAddr=80800000 NetBootFileXferSize= 004cc7ea
MT7621 # bootm 0x80800000
## Booting image at 80800000 ...
Bad Magic Number,01000000

can you show us result of the command printenv?

Here it goes

MT7621 # printenv
bootargs=console=ttyS1,115200 root=/dev/mtdblock2 rootfstype=squashfs init=/etc/preinit mtdparts=raspi:256k(uboot),2048k(uImage),14016k@0x240000(rootfs),64k@0xff0000(ART) mem=128M
bootcmd=tftp
bootdelay=0x1
baudrate=115200
ethaddr="00:00:00:00:00:00"
ipaddr=192.168.0.1
serverip=192.168.0.5
stdin=serial
stdout=serial
stderr=serial

Environment size: 332/4092 bytes



Did you get anywhere with booting?

I did some work on this back in July, but run into a couple of issues which I don't have the time to fix:

  1. When booting from the SPI flash, the mt7530 bus fails on probe with reset timeout. This doesn't happen when booting with initramfs image.
root@OpenWrt:/# dmesg |grep mt7530
[    0.723634] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    0.771977] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    1.781927] mt7530 mdio-bus:1f: reset timeout
[    1.786342] mt7530: probe of mdio-bus:1f failed with error -145
root@OpenWrt:/# 

Booting with initramfs:

root@OpenWrt:/# dmesg |grep mt7530
[    3.787005] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    3.835438] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    3.923005] mt7530 mdio-bus:1f wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[    3.932567] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    3.942168] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    3.951787] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    3.961443] mt7530 mdio-bus:1f lan4 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[    3.971133] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[    4.636601] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[    5.852953] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[    9.965767] mt7530 mdio-bus:1f lan1: Link is Up - 1Gbps/Full - flow control rx/tx
[   10.007372] mt7530 mdio-bus:1f lan1: Link is Down
[   20.586521] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[   20.659958] mt7530 mdio-bus:1f lan2: configuring for phy/gmii link mode
[   20.705903] mt7530 mdio-bus:1f lan3: configuring for phy/gmii link mode
[   20.750361] mt7530 mdio-bus:1f lan4: configuring for phy/gmii link mode
[   20.803864] mt7530 mdio-bus:1f wan: configuring for phy/gmii link mode
[   23.661665] mt7530 mdio-bus:1f lan1: Link is Up - 1Gbps/Full - flow control rx/tx
root@OpenWrt:/# 

  1. The TX power for the mt7613 is limited to 3 dBm.
root@OpenWrt:/# iwinfo 
wlan0     ESSID: unknown
          Access Point: D8:07:B6:BF:D7:84
          Mode: Client  Channel: unknown (unknown)
          Tx-Power: 22 dBm  Link Quality: unknown/70
          Signal: unknown  Noise: unknown
          Bit Rate: unknown
          Encryption: unknown
          Type: nl80211  HW Mode(s): 802.11bgn
          Hardware: 14C3:7603 14C3:7603 [MediaTek MT7603E]
          TX power offset: none
          Frequency offset: none
          Supports VAPs: yes  PHY name: phy0

wlan1     ESSID: "OpenWrt"
          Access Point: D8:07:B6:BF:D7:83
          Mode: Master  Channel: 36 (5.180 GHz)
          Tx-Power: 3 dBm  Link Quality: unknown/70
          Signal: unknown  Noise: -92 dBm
          Bit Rate: unknown
          Encryption: none
          Type: nl80211  HW Mode(s): 802.11nac
          Hardware: 14C3:7663 14C3:7663 [Generic MAC80211]
          TX power offset: unknown
          Frequency offset: unknown
          Supports VAPs: yes  PHY name: phy1

root@OpenWrt:/# 

I can submit a WIP PR if someone is interested to test and fix these problems.

It may be possible that these issues are now fixed in master, since if it was so long ago that you did this. The transition to DSA switch driver in ramips target was apparently pretty messy...

I believe MT7615 is the firmware to use for 7613 ? The last commit I can see for it was in June. This thing takes ages to boot and the stock firmware performance is kind of poor but hardware on paper seems all supported and decent for the price. Wonder what's holding it back ...

I tried against the current master, but sadly the issues remain.
I started a new WIP C6U v1(EU) pull request. The current problems are mentioned in the commit message. This might be help the folks with A6/C6 v3, since the wikidevi claims these are the same devices, but I don't know for sure.

MT7613 uses the mt7663 firmware. The mt76 driver complains, if you don't have that on the board:

mt7615e 0000:02:00.0: mediatek/mt7663pr2h.bin not found, switching to mediatek/mt7663pr2h_rebb.bin                                                                             
mt7615e 0000:02:00.0: failed to load mediatek/mt7663pr2h_rebb.bin

Two mt7663 firmware packages are already available: kmod-mt7663-firmware-ap and kmod-mt7663-firmware-sta. The driver attempts to load the "sta" firmware first, and if that is not available tries to load the "ap" binaries (*_rebb.bin). I tried with both, but I'm still stuck at 3 dBm. Probably something else is not quite right.

Looks promising, once they figure out full support for that board, adding this one will be much easier

do you know the Magic number so @vrpatil can build an image?

MT7663 driver is board specific? What board do you mean?

The bootloader requires uImage, so header should start with 0x27051956.
Add KERNEL := $(KERNEL_DTB) | uImage lzma under the device make function in mt7621.mk

define Device/tplink_archer-c6u-v1
  $(Device/dsa-migration)
  $(Device/tplink-safeloader)
  IMAGE_SIZE := 15744k
  DEVICE_MODEL := Archer C6U
  DEVICE_VARIANT := v1
  DEVICE_PACKAGES := kmod-mt7603 \
           kmod-mt7615e kmod-mt7663-firmware-ap \
           kmod-usb3 kmod-usb-ledtrig-usbport
  KERNEL := $(KERNEL_DTB) | uImage lzma
  TPLINK_BOARD_ID := ARCHER-C6U-V1
endef
TARGET_DEVICES += tplink_archer-c6u-v1

This ^^^ generates the factory, sysupgrade and the initramfs images for C6U. You can tftp the initramfs (rename it to test.bin first) and just boot it.

Thanks, it worked. WiFi interface is not shown

[   10.723131] mt7603e 0000:01:00.0: enabling device (0000 -> 0002)
[   10.729319] mt7603e 0000:01:00.0: ASIC revision: 76030010
[   11.354457] mt7603e 0000:01:00.0: Firmware Version: ap_pcie
[   11.360079] mt7603e 0000:01:00.0: Build Time: 20160107100755
[   11.389569] mt7603e 0000:01:00.0: firmware init done

Not sure if below is an issue, but PCI seems to be working fine later

[    3.827575] mt7621-pci 1e140000.pcie: Parsing DT failed
[    3.928204] mt7621-pci 1e140000.pcie: Error applying setting, reverse things back

Update: WiFI is working, atleast I can see it is able to scan and show the list of networks available.

The switch DTS configuration is little confusing, for the same SOC different products have different configurations. I understand port0 is WAN, and rest all LAN to be bridged. But making so, is not creating default br-lan. If I name port0 as lan it is creating.

Also DHCP is not working on LAN ports.

Any approach to be followed for OpenWrt switch port naming?