Tplink wr840n v6.20 / MT76/ MT7603e

dear Developers & advanced users

i have a question / problem with wr840n v6.20
after patching the files to add new device, everything seems to be OK but...
Wifi on v6.20 is almost unusable

i pulled the latest OpenWrt SNAPSHOT r11869-a176f8d3ec
which working so good on 840n v5 and tried to compile for v6.20
Lan,Switch,LED's everything is as expected

only wireless...
wfif scan is almost always blank
if there is some scan result, it is heavy reduced, only 10% of available AP's are shown
Station attached on v6.20 working well until they are close. If i move 10 meters away, signal start to drop and similar problems

i know that 32/4 devices are not supported in final release, but this time, it is about MT76 driver? which works very well on similar device

is there any chance for this problem to be solved?
because 840 v5 are no longer available and only replacement is v6.20

thanks in advance

1 Like

if someone is interested, here is the patch

diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v620.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v620.dts
new file mode 100644
index 0000000000..20cefd9c65
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_tplink_tl-wr840n-v620.dts
@@ -0,0 +1,116 @@
+/dts-v1/;
+
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+    compatible = "tplink,tl-wr840n-v620", "mediatek,mt7628an-soc";
+    model = "TP-Link TL-WR840N v620";
+
+    aliases {
+	led-boot = &led_power;
+	led-failsafe = &led_power;
+	led-running = &led_power;
+	led-upgrade = &led_power;
+    };
+    
+    memory@0 {
+	device_type = "memory";
+	reg = <0x0 0x2000000>;
+    };
+
+    chosen {
+	bootargs = "console=ttyS0,115200";
+    };
+
+    keys {
+	compatible = "gpio-keys-polled";
+	poll-interval = <20>;
+
+	reset {
+	    label = "reset";
+	    gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+	    linux,code = <KEY_RESTART>;
+	};
+    };
+    /* LED used is dual-color,dual lead LED */
+    leds {
+	compatible = "gpio-leds";
+
+	lan {
+	    label = "tl-wr840n-v620:green:lan";
+	    gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
+	};
+
+	wlan {
+	    label = "tl-wr840n-v620:green:wlan";
+	    gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+	};
+
+	led_power: orange {
+	    label = "tl-wr840n-v620:orange:wan";
+	    gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+	};
+
+	green {
+	    label = "tl-wr840n-v620:green:wan";
+	    gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
+	};
+    };
+};
+
+&spi0 {
+    status = "okay";
+
+    m25p80@0 {
+	compatible = "jedec,spi-nor";
+	reg = <0>;
+	spi-max-frequency = <10000000>;
+
+	partitions {
+	    compatible = "fixed-partitions";
+	    #address-cells = <1>;
+	    #size-cells = <1>;
+
+	    partition@0 {
+		label = "boot";
+		reg = <0x0 0x10000>;
+		read-only;
+	    };
+
+	    partition@10000 {
+		compatible = "tplink,firmware";
+		label = "firmware";
+		reg = <0x10000 0x3d0000>;
+	    };
+
+	    factory: partition@3f0000 {
+		label = "factory";
+		reg = <0x3f0000 0x10000>;
+		read-only;
+	    };
+	};
+    };
+};
+
+&wmac {
+    status = "okay";
+    mtd-mac-address = <&factory 0xf100>;
+    mediatek,mtd-eeprom = <&factory 0x10000>;
+};
+
+&ethernet {
+    mtd-mac-address = <&factory 0xf100>;
+    mediatek,portmap = "wllll";
+};
+
+&pinctrl {
+    state_default: pinctrl0 {
+	gpio {
+	    ralink,group = "p1led_an", "p3led_an", "p4led_an", "wled_an", "perst";
+	    ralink,function = "gpio";
+	};
+    };
+};
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 2b5ec60a90..7a58ec3785 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -400,6 +400,25 @@ define Device/tplink_tl-wr840n-v5
 endef
 TARGET_DEVICES += tplink_tl-wr840n-v5
 
+define Device/tplink_tl-wr840n-v620
+  SOC := mt7628an
+  IMAGE_SIZE := 3904k
+  DEVICE_VENDOR := TP-Link
+  DEVICE_MODEL := TL-WR840N
+  DEVICE_VARIANT := v620
+  TPLINK_FLASHLAYOUT := 4Mmtk
+  TPLINK_HWID := 0x08400006
+  TPLINK_HWREV := 0x1
+  TPLINK_HWREVADD := 0x7
+  TPLINK_HVERSION := 3
+  KERNEL := $(KERNEL_DTB)
+  KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
+  IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata | \
+       check-size $$$$(IMAGE_SIZE)
+  SUPPORTED_DEVICES += tl-wr840n-v620
+endef
+TARGET_DEVICES += tplink_tl-wr840n-v620
+
 define Device/tplink_tl-wr841n-v13
   $(Device/tplink)
   IMAGE_SIZE := 7808k
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
index a733353f71..3a2f4fb7d9 100755
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
@@ -45,6 +45,7 @@ ramips_setup_interfaces()
 	tplink,tl-mr3420-v5|\
 	tplink,tl-wr840n-v4|\
 	tplink,tl-wr840n-v5|\
+	tplink,tl-wr840n-v620|\
 	tplink,tl-wr841n-v13|\
 	tplink,tl-wr841n-v14|\
 	tplink,tl-wr842n-v5|\
@@ -186,6 +187,7 @@ ramips_setup_macs()
 	tplink,tl-mr3420-v5|\
 	tplink,tl-wr840n-v4|\
 	tplink,tl-wr840n-v5|\
+	tplink,tl-wr840n-v620|\
 	tplink,tl-wr841n-v13|\
 	tplink,tl-wr841n-v14|\
 	tplink,tl-wr842n-v5)
1 Like