Support for TP-LINK TL-WR802N V4

Awesome,please check /tmp/sysinfo/board_name to see if board is detected fine.
And if it is you can flash it over web ui.

If that works I will open a PR

So, after the boot, this is what I get:

BusyBox v1.27.2 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r5705-88a2cff
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# 
root@OpenWrt:/# uname -a
Linux OpenWrt 4.9.73 #0 Tue Jan 9 20:14:18 2018 mips GNU/Linux
root@OpenWrt:/# cat /tmp/sysinfo/board_name 
tl-wr802n-v4
root@OpenWrt:/# 

So it appears the model name is correctly decoded. For the mac address, it seems it's correctly decoded as well:

On the Openwrt:

root@OpenWrt:/# ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UNKNOWN qlen 1000
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff

On the stock firmware:

~ # ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ifb0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 32
    link/ether 0a:69:a1:8d:4a:92 brd ff:ff:ff:ff:ff:ff
3: ifb1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 32
    link/ether 5e:c3:f2:37:e3:cc brd ff:ff:ff:ff:ff:ff
4: sit0: <NOARP> mtu 1480 qdisc noop state DOWN 
    link/sit 0.0.0.0 brd 0.0.0.0
5: ip6tnl0: <NOARP> mtu 1460 qdisc noop state DOWN 
    link/tunnel6 :: brd ::
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
7: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
8: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
9: eth0.4@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
10: eth0.5@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
11: eth0.6@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
12: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether c0:25:e9:6c:ef:cf brd ff:ff:ff:ff:ff:ff
13: ra0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether c0:25:e9:6c:ef:ce brd ff:ff:ff:ff:ff:ff
14: ra1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether c2:25:e9:7c:ef:ce brd ff:ff:ff:ff:ff:ff
15: apcli0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether c2:25:e9:0c:ef:ce brd ff:ff:ff:ff:ff:ff
~ #

Awesome,last thing is to check if stock firmware accepts factory image.
If it does it is ready for PR

So, should I try to flash the openwrt-ramips-mt76x8-tl-wr802-v4-squashfs-sysupgrade.bin via the web interface? I don't get what you're talking about when you write « factory image ».

Yeah, try flashing sysupgrade.
I forgot that sysupgrade images for M76x8 are configured to pretty much contain everything like factory images for other architectures

So, via the web interface, it fails:

~ # 
~ # 
~ # 
~ # spiflash_ioctl_read, Read from 0x00020000 length 0x1d0, ret 0, retlen 0x1d0
flash hver is 4
image hver is 4
[ rsl_sys_updateFirmware ] 2154:  NEW: swRevision-0x55aa0100, platformVer-0xa5000000, swSignature-0x1

[ rsl_getCurrSwSignature ] 483:  CURR: swRevision-0x55aa0310, platformVer-0xa5000901, swSignature-0x90103

spiflash_ioctl_read, Read from 0x007c0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x007d0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x007c0000 length 0x10000, ret 0, retlen 0x10000
T#[ util_execSystem ] 139:  oal_sys_writeAppFlash cmd is "echo 2 > /proc/sys/vm/drop_caches"

spiflash_ioctl_read, Read from 0x00020000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00030000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00020000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00030000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00040000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00030000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00040000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00050000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00040000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00050000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00060000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00050000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00060000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00070000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00060000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00070000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00080000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00070000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00080000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00090000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00080000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00090000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x000a0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00090000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x000a0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x000b0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x000a0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x000b0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x000c0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x000b0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x000c0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x000d0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x000c0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x000d0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x000e0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x000d0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x000e0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x000f0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x000e0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x000f0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00100000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x000f0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00100000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00110000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00100000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00110000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00120000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00110000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00120000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00130000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00120000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00130000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00140000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00130000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00140000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00150000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00140000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00150000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00160000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00150000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00160000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00170000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00160000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00170000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00180000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00170000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00180000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00190000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00180000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00190000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x001a0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00190000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x001a0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x001b0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x001a0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x001b0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x001c0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x001b0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x001c0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x001d0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x001c0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x001d0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x001e0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x001d0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x001e0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x001f0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x001e0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x001f0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00200000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x001f0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00200000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00210000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00200000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00210000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00220000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00210000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00220000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00230000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00220000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00230000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00240000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00230000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00240000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00250000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00240000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00250000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00260000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00250000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00260000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00270000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00260000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00270000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00280000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00270000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00280000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00290000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00280000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00290000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x002a0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00290000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x002a0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x002b0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x002a0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x002b0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x002c0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x002b0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x002c0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x002d0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x002c0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x002d0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x002e0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x002d0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x002e0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x002f0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x002e0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x002f0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00300000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x002f0000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00300000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00310000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00300000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00310000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00320000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00310000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00320000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00330000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00320000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00330000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00340000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00330000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00340000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00350000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00340000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00350000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00360000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00350000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00360000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00370000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00360000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00370000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00380000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00370000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00380000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x00390000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00380000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x00390000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x003a0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x00390000 length 0x10000, ret 0, retlen 0x10000
#spiflash_ioctl_read, Read from 0x003a0000 length 0x10000, ret 0, retlen 0x10000
.
spiflash_ioctl_erase, erase to 0x003b0000 length 0x0, nerase done
spiflash_ioctl_write, Write to 0x003a0000 length 0x10000, ret 0, retlen 0x10000
T#[04030C0E][04030C0E]
DDR Calibration DQS reg = 00008888
                                  

U-Boot 1.1.3 (Apr 21 2017 - 20:28:08)
                                     
Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
******************************    
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 17
find flash: W25Q64BV                     
============================================ 
Ralink UBoot Version: 4.3.0.0                
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)                  
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit                       
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 21 2017  Time:20:28:08
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 
                                                 
 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes   
RESET MT7628 PHY!!!!!!          
continue to starting system.                                                                                                                                                                                                    0 
disable switch phyport...                                                                                                                                                                                                        
                         
3: System Boot system code via Flash.(0xbc020000)
do_bootm:argc=2, addr=0xbc020000                 
## Booting image at bc020000 ...
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover
[04030C0E][04030C0E]                                                        
DDR Calibration DQS reg = 00008888
                                  

U-Boot 1.1.3 (Apr 21 2017 - 20:28:08)
                                     
Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
******************************    
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 17
find flash: W25Q64BV                     
============================================ 
Ralink UBoot Version: 4.3.0.0                
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)                  
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit                       
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 21 2017  Time:20:28:08
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 
                                                 
 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes   
RESET MT7628 PHY!!!!!!          
continue to starting system.                                                                                                                                                                                                    0 
disable switch phyport...                                                                                                                                                                                                        
                         
3: System Boot system code via Flash.(0xbc020000)
do_bootm:argc=2, addr=0xbc020000                 
## Booting image at bc020000 ...
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover
[04030C0E][04030C0D]                                                        
DDR Calibration DQS reg = 00008888
                                  

U-Boot 1.1.3 (Apr 21 2017 - 20:28:08)
                                     
Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
******************************    
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 17
find flash: W25Q64BV                     
============================================ 
Ralink UBoot Version: 4.3.0.0                
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)                  
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit                       
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 21 2017  Time:20:28:08
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 
                                                 
 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes   
RESET MT7628 PHY!!! 0           
TODO, Read MAC Address from Flash
                                 
switch BootType:
                
4: System Enter Boot Command Line Interface.
                                            
U-Boot 1.1.3 (Apr 21 2017 - 20:28:08)
MT7628 #

Ok,then its got the 840N v4 bug they fixed in v5.
So you can only use TFTP image and flash from TFTP

Flash from tftp? You mean, from uboot? I tried to flash it from uboot using "cp.linux" and "erase.linux", with the same result. What command should I use? (also, which bug are you speaking of? got any link?)

Yeah,you just hold reset button while booting and default TFTP recovery method will be triggered.

I am speaking of bug described in this commit
https://github.com/openwrt/openwrt/commit/24043a0d2e01b9843c0dc529205b3b0bc7ecbbf9

Ok, so following the instructions, the flash works (pressing the button, and having renamed the tftp-recovery as "tp_recovery.bin".

Full boot log:

[04020D06][04020C0D]
DDR Calibration DQS reg = 00008788     
                                  

U-Boot 1.1.3 (Apr 21 2017 - 20:28:08)
                                     
Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
flash manufacture id: ef, device id 40 17
find flash: W25Q64BV                     
============================================ 
Ralink UBoot Version: 4.3.0.0                
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)                  
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit                       
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 21 2017  Time:20:28:08
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 
                                                 
 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes   
RESET MT7628 PHY!!!!!!..................................................
starting recovery...                                                    
TODO, Read MAC Address from Flash
                                 

 netboot_common, argc= 3 
                         
 NetTxPacket = 0x83FE7700 
                          
 KSEG1ADDR(NetTxPacket) = 0xA3FE7700 
                                     
 NetLoop,call eth_halt ! 
                         
 NetLoop,call eth_init ! 
Trying Eth0 (10/100-M)   
                      
 Waitting for RX_DMA_BUSY status Start... done
                                              

 ETH_STATE_ACTIVE!! 
TFTP from server 192.168.0.66; our IP address is 192.168.0.2
Filename 'tp_recovery.bin'.                                 
                           
 TIMEOUT_COUNT=10,Load address: 0x80060000
Loading: T Got ARP REPLY, set server/gtwy eth addr (2c:41:38:0d:6f:a9)
Got it                                                                
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ############################                                     
done                                 
Bytes transferred = 8126464 (7c0000 hex)
NetBootFileXferSize= 007c0000           
                             
 Erase flash !!
From 0x20000 length 0x7A0000
..........................................................................................................................
                                                                                                                          
 Copy 0x80080000 to 0x00020000, count 0x7A0000.... 
..........................................................................................................................
[04030C0E][04030C0E]                                                                                                      
DDR Calibration DQS reg = 00008888
                                  

U-Boot 1.1.3 (Apr 21 2017 - 20:28:08)
                                     
Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
******************************    
Software System Reset Occurred
******************************
flash manufacture id: ef, device id 40 17
find flash: W25Q64BV                     
============================================ 
Ralink UBoot Version: 4.3.0.0                
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)                  
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit                       
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 21 2017  Time:20:28:08
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 
                                                 
 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =64 Mbytes   
RESET MT7628 PHY!!!!!!          
continue to starting system.                                                                                                                                                                                                    0 
disable switch phyport...                                                                                                                                                                                                        
                         
3: System Boot system code via Flash.(0xbc020000)
do_bootm:argc=2, addr=0xbc020000                 
## Booting image at bc020000 ...
   Uncompressing Kernel Image ... OK
No initrd                           
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64                         
                                 
Starting kernel ...
                   
[    0.000000] Linux version 4.9.73 (robimarko@Builder) (gcc version 6.3.0 (OpenWrt GCC 6.3.0 r5705-88a2cff) ) #0 Tue Jan 9 20:14:18 2018
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is TP-Link TL-WR802N v4
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=0006dcc0
[    0.000000] Readback ErrCtl register=0006dcc0
[    0.000000] Memory: 60440K/65536K available (3114K kernel code, 158K rwdata, 752K rodata, 192K init, 209K bss, 5096K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource_probe: no matching clocksources found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007528] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.070040] pid_max: default: 32768 minimum: 301
[    0.074623] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080963] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.093975] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.103467] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.109383] pinctrl core: initialized pinctrl subsystem
[    0.115050] NET: Registered protocol family 16
[    0.138825] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.144537] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.150093] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.159127] clocksource: Switched to clocksource MIPS
[    0.165155] NET: Registered protocol family 2
[    0.170287] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.176978] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.183160] TCP: Hash tables configured (established 1024 bind 1024)
[    0.189357] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.194955] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.201294] NET: Registered protocol family 1
[    0.208356] Crashlog allocated RAM at address 0x3f00000
[    0.214543] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.228631] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.234248] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.252121] io scheduler noop registered
[    0.255851] io scheduler deadline registered (default)
[    0.261604] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.268836] console [ttyS0] disabled
[    0.272329] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.281051] console [ttyS0] enabled
[    0.281051] console [ttyS0] enabled
[    0.288045] bootconsole [early0] disabled
[    0.288045] bootconsole [early0] disabled
[    0.297308] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.306335] m25p80 spi32766.0: using chunked io (size=32)
[    0.311884] m25p80 spi32766.0: s25fl064k (8192 Kbytes)
[    0.317124] 4 ofpart partitions found on MTD device spi32766.0
[    0.323050] Creating 4 MTD partitions on "spi32766.0":
[    0.328270] 0x000000000000-0x000000020000 : "boot"
[    0.334848] 0x000000020000-0x0000007c0000 : "firmware"
[    0.390709] 2 tplink-fw partitions found on MTD device firmware
[    0.396737] 0x000000020000-0x00000016c604 : "kernel"
[    0.403371] 0x00000016c604-0x0000007c0000 : "rootfs"
[    0.410218] mtd: device 3 (rootfs) set to be root filesystem
[    0.416479] 1 squashfs-split partitions found on MTD device rootfs
[    0.422825] 0x0000003a0000-0x0000007c0000 : "rootfs_data"
[    0.430002] 0x0000007c0000-0x0000007d0000 : "config"
[    0.436841] 0x0000007d0000-0x000000800000 : "factory"
[    0.444463] libphy: Fixed MDIO Bus: probed
[    0.457688] rt3050-esw 10110000.esw: link changed 0x00
[    0.464554] mtk_soc_eth 10100000.ethernet: generated random MAC address d6:a9:88:00:3b:ca
[    0.473742] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.483707] NET: Registered protocol family 10
[    0.491245] NET: Registered protocol family 17
[    0.495810] 8021q: 802.1Q VLAN Support v1.8
[    0.510903] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.519096] Freeing unused kernel memory: 192K
[    0.523666] This architecture does not have kernel memory protection.
[    1.623534] init: Console is alive
[    1.627214] init: - watchdog -
[    2.179137] random: fast init done
[    2.887738] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.095375] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.113243] init: - preinit -
[    4.552581] rt3050-esw 10110000.esw: link changed 0x00
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    7.895283] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    7.926029] urandom-seed: Seed file not found (/etc/urandom.seed)
[    8.135362] procd: - early -
[    8.138390] procd: - watchdog -
[    8.679902] rt3050-esw 10110000.esw: link changed 0x01
[    8.702748] procd: - watchdog -
[    8.706204] procd: - ubus -
[    8.961822] procd: - init -
Please press Enter to activate this console.
[    9.469613] kmodloader: loading kernel modules from /etc/modules.d/*
[    9.480648] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    9.497866] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
[    9.506058] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
[    9.516105] ip_tables: (C) 2000-2006 Netfilter Core Team
[    9.530154] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[    9.588910] xt_time: kernel timezone is -0000
[    9.649834] mt76_wmac 10300000.wmac: ASIC revision: 76280001
[    9.658549] mt76_wmac 10300000.wmac: Invalid MAC address, using random address 8a:d0:dd:12:d9:12
[    9.669653] mt76_wmac 10300000.wmac: Firmware Version: _e2_mp
[    9.675497] mt76_wmac 10300000.wmac: Build Time: 20150211175503
[    9.699152] firmware init done
[    9.946510] PPP generic driver version 2.4.2
[    9.953684] NET: Registered protocol family 24
[    9.962613] kmodloader: done loading kernel modules from /etc/modules.d/*
[   18.629486] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   18.636488] jffs2_build_filesystem(): unlocking the mtd device... [   18.642610] done.
[   18.644561] jffs2_build_filesystem(): erasing all blocks after the end marker... [   22.500585] br-lan: port 1(eth0) entered blocking state
[   22.505901] br-lan: port 1(eth0) entered disabled state
[   22.511717] device eth0 entered promiscuous mode
[   22.575660] br-lan: port 1(eth0) entered blocking state
[   22.581033] br-lan: port 1(eth0) entered forwarding state
[   22.586716] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   23.529247] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready




BusyBox v1.27.2 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r5705-88a2cff
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# 
root@OpenWrt:/# 
root@OpenWrt:/# [   43.792089] done.
[   43.794098] jffs2: notice: (882) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.

Great,so it is pretty much ready.
I will clean up the branch a bit and open a PR.

Just another question,does sticker on the device have MAC adress for wireless interface?
Because from log I can see that MAC read from flash for WLAN is invalid

There is only one ram on the sticker, but I managed to switch this box with the board from another device, so I can't confirm that the mac address on the sticker agree; but as previously said, launching ip l on the device with the stock firmware gave one mac address for the ethernet as well wireless interface.

Ok,then it defaults to ethernet MAC,that is quite often.

Hi, i'm back with another question. This device has two 2.4GHz antennas, still, whene launching " iw phy phy0 info", this is what I get:

Wiphy phy0
	max # scan SSIDs: 4
	max scan IEs length: 2257 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
		 * mesh point
	Band 1:
		Capabilities: 0x1fe
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			TX STBC
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 4 usec (0x05)
		HT TX/RX MCS rate indexes supported: 0-15
		Frequencies:
			* 2412 MHz [1] (20.0 dBm)
			* 2417 MHz [2] (20.0 dBm)
			* 2422 MHz [3] (20.0 dBm)
			* 2427 MHz [4] (20.0 dBm)
			* 2432 MHz [5] (20.0 dBm)
			* 2437 MHz [6] (20.0 dBm)
			* 2442 MHz [7] (20.0 dBm)
			* 2447 MHz [8] (20.0 dBm)
			* 2452 MHz [9] (20.0 dBm)
			* 2457 MHz [10] (20.0 dBm)
			* 2462 MHz [11] (20.0 dBm)
			* 2467 MHz [12] (20.0 dBm) (no IR)
			* 2472 MHz [13] (20.0 dBm) (no IR)
			* 2484 MHz [14] (20.0 dBm) (no IR)
	valid interface combinations:
		 * #{ IBSS } <= 1, #{ managed, AP, mesh point } <= 4,
		   total <= 4, #channels <= 1, STA/AP BI must match
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing

In particular, it seems only one antenna is found: Available Antennas: TX 0 RX 0

Is that normal?

Yes,completelly normal.
BTW I am now cleaning this up and will open a PR

I have successfully built the image from https://github.com/robimarko/openwrt/tree/WR802N-v4 and can confirm that I have a working system. The problem is periodic wireless transmission issues. I have rebased the WR802N-v4 branch changes to the latest master from git.openwrt.org to see if any of the ramips changes helped but nothing so far. What I can tell is:

  1. Ethernet remains stable at all times
  2. Wireless reception remains stable
  3. Wireless transmission starts to fail if there is a large enough gap of time without activity

When the transmission starts to fail and I start to ping the router from the laptop:

  • tcpdump on the router shows laptop ICMP request and router ICMP reply
  • "iw dev wlan0 station dump" shows an sudden increase in "tx retries" and "tx failed"

If I add a router daemon to constantly ping a node on the network, everything works fine so I'm guessing there is some kind of power save or queue timeout issue. I can definitely work on a patch but I'm not quite sure where to start in the code.

Any suggestions?

I should add that "/etc/init.d/network restart" is enough to get it working again.

I'm not sure if this is a MT7628 issue but I spent some time trying different settings and it appears that if you turn off "WMM mode", everything works as intended. I don't have any need for high throughput on this device so I its not a problem for me. I'm not sure if this is the right place to record this so others know about it.

Hi!

I am trying to figure out how to flash my TL-WR802M v4 with Open-WRT but I can't seem to locate the files needed. Also I am not quite sure how to build the image. Would you happen to have a pre-built image file available that you could share?

Also the link you referenced doesn't appear to work for some reason:
https://github.com/robimarko/openwrt/tree/WR802N-v4

@robimarko What is the status of your PR?