Add support for TP-Link TL-WR850N v2

Hi there,
A few months ago, I added a new device from TP-Link, and it would be nice if OpenWrt officially supported it. Therefore, I will post updates here on adding support for it.
Info & photos https://wikidevi.wi-cat.ru/TP-LINK_TL-WR850N_v2
This router is very similar to TP-Link TL-WR840 v4 and TP-Link TL-WR841 v13

tl-wr850n-v2.patch for current master:

--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
@@ -81,7 +81,8 @@
 	ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
 	;;
-tplink,tl-wr840n-v4)
+tplink,tl-wr840n-v4|\
+tplink,tl-wr850n-v2)
 	ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt"
 	ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
@@ -72,6 +72,7 @@
 	tplink,tl-wr841n-v13|\
 	tplink,tl-wr841n-v14|\
 	tplink,tl-wr842n-v5|\
+	tplink,tl-wr850n-v2|\
 	unielec,u7628-01-16m|\
 	wrtnode,wrtnode2p|\
 	wrtnode,wrtnode2r|\
@@ -195,7 +196,8 @@
 	tplink,tl-wr840n-v5|\
 	tplink,tl-wr841n-v13|\
 	tplink,tl-wr841n-v14|\
-	tplink,tl-wr842n-v5)
+	tplink,tl-wr842n-v5|\
+	tplink,tl-wr850n-v2)
 		wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xf100)" 1)
 		;;
 	tplink,archer-c20-v5|\
--- a/target/linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr850n-v2.dts
@@ -0,0 +1,65 @@
+/dts-v1/;
+
+#include "mt7628an_tplink_8m.dtsi"
+
+/ {
+	compatible = "tplink,tl-wr850n-v2", "mediatek,mt7628an-soc";
+	model = "TP-Link TL-WR850N v2";
+
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		lan {
+			label = "tl-wr850n-v2:green:lan";
+			gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
+		};
+
+		led_power: power {
+			label = "tl-wr850n-v2:green:power";
+			gpios = <&gpio 36 GPIO_ACTIVE_LOW>;
+		};
+
+		wan {
+			label = "tl-wr850n-v2:green:wan";
+			gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
+		};
+
+		wlan {
+			label = "tl-wr850n-v2:green:wlan";
+			gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
+		};
+
+		wps {
+			label = "tl-wr850n-v2:green:wps";
+			gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&state_default {
+	gpio {
+		groups = "p0led_an", "p2led_an", "perst", "refclk", "wdt", "wled_an";
+		function = "gpio";
+	};
+};
+
+&esw {
+	mediatek,portmap = <0x3e>;
+};
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -474,6 +474,20 @@
 endef
 TARGET_DEVICES += tplink_tl-wr842n-v5
 
+define Device/tplink_tl-wr850n-v2
+  $(Device/tplink-v2)
+  IMAGE_SIZE := 7808k
+  DEVICE_MODEL := TL-WR850N
+  DEVICE_VARIANT := v2
+  TPLINK_FLASHLAYOUT := 8Mmtk
+  TPLINK_HWID := 0x08500002
+  TPLINK_HWREVADD := 0x2
+  IMAGES := sysupgrade.bin tftp-recovery.bin
+  IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin)
+  SUPPORTED_DEVICES += tl-wr850n-v2
+endef
+TARGET_DEVICES += tplink_tl-wr850n-v2
+
 define Device/tplink_tl-wr902ac-v3
   $(Device/tplink-v2)
   IMAGE_SIZE := 7808k

Serial uart 115200n8
tftp server 192.168.0.66/255.255.255.0
openwrt-ramips-mt76x8-tplink_tl-wr850n-v2-squashfs-tftp-recovery.bin rename to tp_recovery.bin
press RESET button & power on
change computer ip to dhcp client

[04040D08][04040C0E]
DDR Calibration DQS reg = 0000898A


U-Boot 1.1.3 (Apr 15 2019 - 17:56:43)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
gpiomode2 05540554.
gpiomode2 00000000.
gpiomode2 05550555.
flash manufacture id: c8, device id 40 17
find flash: GD25Q64B
============================================
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 15 2019  Time:17:56:43
============================================
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 = 0x83FE7840

 KSEG1ADDR(NetTxPacket) = 0xA3FE7840

 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: checksum bad
checksum bad
Got ARP REPLY, set server/gtwy eth addr (00:1d:60:b9:50:f4)
Got it
#################checksum bad
########checksum bad
########################################
         #################################################################
         #################################################################
         ######################################checksum bad
###########################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################checksum bad
#############checksum bad
###################
         #################################################################
         #################################################################
         #################################################################
         #######checksum bad
##########################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ############################
done
Bytes transferred = 8126464 (7c0000 hex)
NetBootFileXferSize= 007c0000

 Erase flash !!
From 0x20000 length 0x7A0000
..........................................................................................................................

 Copy 0x80080000 to 0x00020000, count 0x7A0000....
..........................................................................................................................
[04040D07][04040C0D]
DDR Calibration DQS reg = 00008889


U-Boot 1.1.3 (Apr 15 2019 - 17:56:43)

Board: Ralink APSoC DRAM:  64 MB
relocate_code Pointer at: 83fb8000
******************************
Software System Reset Occurred
******************************
gpiomode2 05540554.
gpiomode2 00000000.
gpiomode2 05550555.
flash manufacture id: c8, device id 40 17
find flash: GD25Q64B
============================================
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 15 2019  Time:17:56:43
============================================
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 5.4.45 (inflabz@PC) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r12974-75f19deb3a)) #0 Sun Jun 14 22:04:35 2020
[    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] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is TP-Link TL-WR850N v2
[    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, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Writing ErrCtl register=00030f40
[    0.000000] Readback ErrCtl register=00030f40
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 57644K/65536K available (4543K kernel code, 193K rwdata, 1024K rodata, 1208K init, 197K bss, 7892K 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] random: get_random_bytes called from start_kernel+0x32c/0x518 with crng_init=0
[    0.000000] CPU Clock: 580MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000009] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007541] Calibrating delay loop... 385.02 BogoMIPS (lpj=770048)
[    0.045450] pid_max: default: 32768 minimum: 301
[    0.050102] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.057124] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.070670] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.080097] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.086776] pinctrl core: initialized pinctrl subsystem
[    0.092995] NET: Registered protocol family 16
[    0.132362] clocksource: Switched to clocksource MIPS
[    0.138646] NET: Registered protocol family 2
[    0.143791] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.151909] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.159281] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.166078] TCP: Hash tables configured (established 1024 bind 1024)
[    0.172400] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.178693] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.185739] NET: Registered protocol family 1
[    0.189965] PCI: CLS 0 bytes, default 32
[    0.198282] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.213287] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.218920] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.245140] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.250837] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.256541] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.262216] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.269585] printk: console [ttyS0] disabled
[    0.273780] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.282508] printk: console [ttyS0] enabled
[    0.282508] printk: console [ttyS0] enabled
[    0.290915] printk: bootconsole [early0] disabled
[    0.290915] printk: bootconsole [early0] disabled
[    0.301737] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.316562] spi-nor spi0.0: gd25q64 (8192 Kbytes)
[    0.321421] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.327876] Creating 4 MTD partitions on "spi0.0":
[    0.332759] 0x000000000000-0x000000020000 : "boot"
[    0.338689] 0x000000020000-0x0000007c0000 : "firmware"
[    0.347260] 2 tplink-fw partitions found on MTD device firmware
[    0.353354] Creating 2 MTD partitions on "firmware":
[    0.358417] 0x000000000000-0x0000001d619a : "kernel"
[    0.364596] 0x0000001d619c-0x0000007a0000 : "rootfs"
[    0.370588] mtd: device 3 (rootfs) set to be root filesystem
[    0.378117] 1 squashfs-split partitions found on MTD device rootfs
[    0.384485] 0x000000450000-0x0000007a0000 : "rootfs_data"
[    0.391021] 0x0000007c0000-0x0000007d0000 : "config"
[    0.397177] 0x0000007d0000-0x000000800000 : "factory"
[    0.404165] libphy: Fixed MDIO Bus: probed
[    0.420968] rt3050-esw 10110000.esw: link changed 0x00
[    0.427471] mtk_soc_eth 10100000.ethernet: generated random MAC address ee:40:85:41:16:31
[    0.436620] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.446930] NET: Registered protocol family 10
[    0.455965] Segment Routing with IPv6
[    0.459917] NET: Registered protocol family 17
[    0.464529] 8021q: 802.1Q VLAN Support v1.8
[    0.480046] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.494078] Freeing unused kernel memory: 1208K
[    0.498702] This architecture does not have kernel memory protection.
[    0.505238] Run /sbin/init as init process
[    1.108367] random: fast init done
[    1.539681] init: Console is alive
[    1.543511] init: - watchdog -
[    2.688139] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.871407] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.889342] init: - preinit -
[    4.292708] random: jshn: uninitialized urandom read (4 bytes read)
[    4.382749] random: jshn: uninitialized urandom read (4 bytes read)
[    4.653889] random: jshn: uninitialized urandom read (4 bytes read)
[    5.279838] 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
[    5.506119] urandom_read: 2 callbacks suppressed
[    5.506129] random: procd: uninitialized urandom read (4 bytes read)
[    8.872384] rt3050-esw 10110000.esw: link changed 0x04
[    9.722913] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    9.756099] urandom-seed: Seed file not found (/etc/urandom.seed)
[    9.880500] procd: - early -
[    9.883554] procd: - watchdog -
[   10.532509] procd: - watchdog -
[   10.536034] procd: - ubus -
[   10.704143] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.733072] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.740165] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.751083] procd: - init -
Please press Enter to activate this console.
[   11.584016] kmodloader: loading kernel modules from /etc/modules.d/*
[   11.635216] Loading modules backported from Linux version v5.7-rc3-0-g6a8b55ed4056
[   11.642980] Backport generated by backports.git v5.7-rc3-1-0-gc0c7d2bb
[   11.714973] xt_time: kernel timezone is -0000
[   11.839820] mt76_wmac 10300000.wmac: ASIC revision: 76280001
[   12.052022] urngd: v1.0.2 started.
[   12.252793] random: crng init done
[   12.256247] random: 1 urandom warning(s) missed due to ratelimiting
[   12.886582] mt76_wmac 10300000.wmac: Firmware Version: 20151201
[   12.892676] mt76_wmac 10300000.wmac: Build Time: 20151201183641
[   12.912372] mt76_wmac 10300000.wmac: firmware init done
[   13.199473] PPP generic driver version 2.4.2
[   13.213442] NET: Registered protocol family 24
[   13.252910] kmodloader: done loading kernel modules from /etc/modules.d/*
[   39.302297] rt3050-esw 10110000.esw: link changed 0x00
[   42.871301] rt3050-esw 10110000.esw: link changed 0x04
[   45.137595] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   45.156469] jffs2_build_filesystem(): unlocking the mtd device...
[   45.156539] done.
[   45.164797] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   46.109057] br-lan: port 1(eth0.1) entered blocking state
[   46.122204] br-lan: port 1(eth0.1) entered disabled state
[   46.128146] device eth0.1 entered promiscuous mode
[   46.133070] device eth0 entered promiscuous mode
[   46.215460] br-lan: port 1(eth0.1) entered blocking state
[   46.221021] br-lan: port 1(eth0.1) entered forwarding state
[   47.144552] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   53.115395] done.
[   53.117426] jffs2: notice: (1335) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   53.347125] overlayfs: upper fs does not support tmpfile.
3 Likes

Welcome to the community and congratulations that you got this working! :slight_smile:

To get it officially supported, you should

BTW: Please create new dataentrypages ONLY via https://openwrt.org/meta/create_new_dataentry_page, not by copy & pasting!

The same for devciepages: Please create them ONLY via https://openwrt.org/meta/create_new_device_page, not by copy & pasting.

Thanks!

2 Likes

Thanks for the links for creating new pages, I did not know this. I'm a newbie.
Usually solder nand / spi flash and find gpios, I will get better than programming)

Here is the link to PR https://github.com/openwrt/openwrt/pull/3113
I hope I did everything right.
I also compiled the firmware and flashed it into the router, taking into account the latest changes in PR.

2 Likes

OpenWrt Bootlog https://pastebin.com/6ahN0w6V

LuCI

Switch

1 Like

Test firmware https://inf.labz.ru/tplink/tl-wr850v2/

I can't install SQM I get this error

When you get the message “Cannot satisfy the following dependencies for…” it is most likely because you installed a snapshot version of OpenWrt.
Read here for possible solutions.

Flash done by following -https://openwrt.org/toh/tp-link/tl-wr850n.
After flash, the admin page 192.168.1.1 shows - This site can’t be reached.


192.168.1.1 refused to connect.

Please help. Thanks

See https://openwrt.org/faq/can_not_connect_via_webbrowser for possible solutions.

hello,
were can i find a firmware with luci, i don't know how to install luci by command line
I have install openwrt-ramips-mt76x8-tplink_tl-wr850n-v2-squashfs-tftp-recovery.bin
but i can only connect with SSH

Thank you

This device currently has only snapshot support, which comes without LuCI.
There are no stable builds available with LuCI included.

opkg update
opkg install luci

This topic was intended for adding support for this specific device.
Since official snapshot images are available now, I will set a timer for this topic to close.

Therefore: Please open new topics for any open issues with this device.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.