From d93969a13a5b3db1fe5290466ce9de31be1616e3 Mon Sep 17 00:00:00 2001
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Wed, 3 Jul 2019 23:21:54 +0200
Subject: [PATCH] ramips: Improve compatible for TP-Link Archer devices

Include "Archer" in compatible as it is part of the device name.

Update Makefile device names where necessary to match compatible.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 .../linux/ramips/base-files/etc/board.d/01_leds   | 10 +++++-----
 .../ramips/base-files/etc/board.d/02_network      | 10 +++++-----
 .../ramips/base-files/lib/upgrade/platform.sh     |  2 +-
 target/linux/ramips/dts/ArcherC2-v1.dts           |  2 +-
 target/linux/ramips/dts/ArcherC20i.dts            |  2 +-
 target/linux/ramips/dts/ArcherC20v1.dts           |  2 +-
 target/linux/ramips/dts/ArcherC20v4.dts           |  2 +-
 target/linux/ramips/dts/ArcherC50.dts             |  4 ++--
 target/linux/ramips/dts/ArcherC50V3.dts           |  2 +-
 target/linux/ramips/dts/ArcherC50V4.dts           |  2 +-
 target/linux/ramips/dts/ArcherMR200.dts           |  2 +-
 target/linux/ramips/image/mt7620.mk               | 10 ++++++----
 target/linux/ramips/image/mt76x8.mk               | 15 +++++++++------
 13 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index d020347d725..62ea8b9ec64 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -330,23 +330,23 @@ tplink,tl-wr841n-v14)
 	ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
 	;;
-tplink,c2-v1)
+tplink,archer-c2-v1)
 	ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch1" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch1" "0x01"
 	set_wifi_led "$boardname:green:wlan"
 	;;
-tplink,c20-v1)
+tplink,archer-c20-v1)
 	ucidef_set_led_switch "lan" "lan" "$boardname:blue:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x01"
 	ucidef_set_led_netdev "wlan2g" "wlan2g" "$boardname:blue:wlan2g" "wlan0"
 	;;
-tplink,c20-v4)
+tplink,archer-c20-v4)
 	ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
 	ucidef_set_led_netdev "wlan2g" "wlan2g" "$boardname:green:wlan2g" "wlan0"
 	;;
-tplink,c50-v3|\
-tplink,c50-v4)
+tplink,archer-c50-v3|\
+tplink,archer-c50-v4)
 	ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
 	ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan2g" "phy0tpt"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index b13590566ce..ec2be9715ca 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -238,9 +238,9 @@ ramips_setup_interfaces()
 	mzk-wdpr|\
 	rt-n14u|\
 	skylab,skw92a|\
-	tplink,c20-v4|\
-	tplink,c50-v3|\
-	tplink,c50-v4|\
+	tplink,archer-c20-v4|\
+	tplink,archer-c50-v3|\
+	tplink,archer-c50-v4|\
 	tplink,tl-mr3420-v5|\
 	tplink,tl-wr842n-v5|\
 	tl-wr840n-v4|\
@@ -261,7 +261,7 @@ ramips_setup_interfaces()
 			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
 		;;
 	c50|\
-	tplink,c20-v1)
+	tplink,archer-c20-v1)
 		ucidef_add_switch "switch0" \
 			"1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0"
 		;;
@@ -324,7 +324,7 @@ ramips_setup_interfaces()
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
 		;;
 	edimax,br-6478ac-v2|\
-	tplink,c2-v1)
+	tplink,archer-c2-v1)
 		ucidef_add_switch "switch1" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 7372a379399..65522b23fd6 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -45,7 +45,7 @@ platform_do_upgrade() {
 	xiaomi,mir3p)
 		nand_do_upgrade "$ARGV"
 		;;
-	tplink,c50-v4)
+	tplink,archer-c50-v4)
 		MTD_ARGS="-t romfile"
 		default_do_upgrade "$ARGV"
 		;;
diff --git a/target/linux/ramips/dts/ArcherC2-v1.dts b/target/linux/ramips/dts/ArcherC2-v1.dts
index 921a50a56cd..e20b8735693 100644
--- a/target/linux/ramips/dts/ArcherC2-v1.dts
+++ b/target/linux/ramips/dts/ArcherC2-v1.dts
@@ -6,7 +6,7 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "tplink,c2-v1", "ralink,mt7620a-soc";
+	compatible = "tplink,archer-c2-v1", "ralink,mt7620a-soc";
 	model = "TP-Link Archer C2 v1";
 
 	aliases {
diff --git a/target/linux/ramips/dts/ArcherC20i.dts b/target/linux/ramips/dts/ArcherC20i.dts
index cf715a413f9..7dfaddeee46 100644
--- a/target/linux/ramips/dts/ArcherC20i.dts
+++ b/target/linux/ramips/dts/ArcherC20i.dts
@@ -6,7 +6,7 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "tplink,c20i", "ralink,mt7620a-soc";
+	compatible = "tplink,archer-c20i", "ralink,mt7620a-soc";
 	model = "TP-Link Archer C20i";
 
 	chosen {
diff --git a/target/linux/ramips/dts/ArcherC20v1.dts b/target/linux/ramips/dts/ArcherC20v1.dts
index 39e33b8ff08..602cc70e027 100644
--- a/target/linux/ramips/dts/ArcherC20v1.dts
+++ b/target/linux/ramips/dts/ArcherC20v1.dts
@@ -6,7 +6,7 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	compatible = "tplink,c20-v1", "ralink,mt7620a-soc";
+	compatible = "tplink,archer-c20-v1", "ralink,mt7620a-soc";
 	model = "TP-Link Archer C20 v1";
 
 	aliases {
diff --git a/target/linux/ramips/dts/ArcherC20v4.dts b/target/linux/ramips/dts/ArcherC20v4.dts
index aaafcc52f53..f207ac0d469 100644
--- a/target/linux/ramips/dts/ArcherC20v4.dts
+++ b/target/linux/ramips/dts/ArcherC20v4.dts
@@ -6,7 +6,7 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	compatible = "tplink,c20-v4", "mediatek,mt7628an-soc";
+	compatible = "tplink,archer-c20-v4", "mediatek,mt7628an-soc";
 	model = "TP-Link Archer C20 v4";
 
 	aliases {
diff --git a/target/linux/ramips/dts/ArcherC50.dts b/target/linux/ramips/dts/ArcherC50.dts
index b6f5bed0b71..b1e13bebea5 100644
--- a/target/linux/ramips/dts/ArcherC50.dts
+++ b/target/linux/ramips/dts/ArcherC50.dts
@@ -6,8 +6,8 @@
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	compatible = "tplink,c50", "ralink,mt7620a-soc";
-	model = "TP-Link Archer C50";
+	compatible = "tplink,archer-c50-v1", "ralink,mt7620a-soc";
+	model = "TP-Link Archer C50 v1";
 
 	aliases {
 		led-boot = &led_power;
diff --git a/target/linux/ramips/dts/ArcherC50V3.dts b/target/linux/ramips/dts/ArcherC50V3.dts
index cc4e72819f9..32cc42ef587 100644
--- a/target/linux/ramips/dts/ArcherC50V3.dts
+++ b/target/linux/ramips/dts/ArcherC50V3.dts
@@ -6,7 +6,7 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "tplink,c50-v3", "mediatek,mt7628an-soc";
+	compatible = "tplink,archer-c50-v3", "mediatek,mt7628an-soc";
 	model = "TP-Link Archer C50 v3";
 
 	aliases {
diff --git a/target/linux/ramips/dts/ArcherC50V4.dts b/target/linux/ramips/dts/ArcherC50V4.dts
index 37f388620e3..7d129a5f804 100644
--- a/target/linux/ramips/dts/ArcherC50V4.dts
+++ b/target/linux/ramips/dts/ArcherC50V4.dts
@@ -7,7 +7,7 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "tplink,c50-v4", "mediatek,mt7628an-soc";
+	compatible = "tplink,archer-c50-v4", "mediatek,mt7628an-soc";
 	model = "TP-Link Archer C50 v4";
 
 	aliases {
diff --git a/target/linux/ramips/dts/ArcherMR200.dts b/target/linux/ramips/dts/ArcherMR200.dts
index ff00dbe9584..566b2431fc5 100644
--- a/target/linux/ramips/dts/ArcherMR200.dts
+++ b/target/linux/ramips/dts/ArcherMR200.dts
@@ -6,7 +6,7 @@
 #include <dt-bindings/input/input.h>
 
 / {
-	compatible = "tplink,mr200", "ralink,mt7620a-soc";
+	compatible = "tplink,archer-mr200", "ralink,mt7620a-soc";
 	model = "TP-Link Archer MR200";
 
 	aliases {
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index a8a53912169..abf2b1eed64 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -729,9 +729,10 @@ define Device/edimax_ew-7478apc
 endef
 TARGET_DEVICES += edimax_ew-7478apc
 
-define Device/tplink_c2-v1
+define Device/tplink_archer-c2-v1
   $(Device/Archer)
   DTS := ArcherC2-v1
+  SUPPORTED_DEVICES += tplink,c2-v1
   TPLINK_FLASHLAYOUT := 8Mmtk
   TPLINK_HWID := 0xc7500001
   TPLINK_HWREV := 50
@@ -740,11 +741,12 @@ define Device/tplink_c2-v1
   DEVICE_VARIANT := v1
   DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-switch-rtl8366-smi kmod-switch-rtl8367b
 endef
-TARGET_DEVICES += tplink_c2-v1
+TARGET_DEVICES += tplink_archer-c2-v1
 
-define Device/tplink_c20-v1
+define Device/tplink_archer-c20-v1
   $(Device/Archer)
   DTS := ArcherC20v1
+  SUPPORTED_DEVICES += tplink,c20-v1
   TPLINK_FLASHLAYOUT := 8Mmtk
   TPLINK_HWID := 0xc2000001
   TPLINK_HWREV := 0x44
@@ -754,7 +756,7 @@ define Device/tplink_c20-v1
   DEVICE_VARIANT := v1
   DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport
 endef
-TARGET_DEVICES += tplink_c20-v1
+TARGET_DEVICES += tplink_archer-c20-v1
 
 define Device/vonets_var11n-300
   DTS := VAR11N-300
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 9ad77e83db4..96b067e9005 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -302,7 +302,7 @@ define Device/tplink_tl-wr841n-v14
 endef
 TARGET_DEVICES += tplink_tl-wr841n-v14
 
-define Device/tplink_c20-v4
+define Device/tplink_archer-c20-v4
   $(Device/tplink)
   DTS := ArcherC20v4
   IMAGE_SIZE := 7808k
@@ -314,10 +314,11 @@ define Device/tplink_c20-v4
   TPLINK_HWREVADD := 0x4
   TPLINK_HVERSION := 3
   DEVICE_PACKAGES := kmod-mt76x0e
+  SUPPORTED_DEVICES += tplink,c20-v4
 endef
-TARGET_DEVICES += tplink_c20-v4
+TARGET_DEVICES += tplink_archer-c20-v4
 
-define Device/tplink_c50-v3
+define Device/tplink_archer-c50-v3
   $(Device/tplink)
   DTS := ArcherC50V3
   IMAGE_SIZE := 7808k
@@ -329,10 +330,11 @@ define Device/tplink_c50-v3
   TPLINK_HWREVADD := 0x1
   TPLINK_HVERSION := 3
   DEVICE_PACKAGES := kmod-mt76x2
+  SUPPORTED_DEVICES += tplink,c50-v3
 endef
-TARGET_DEVICES += tplink_c50-v3
+TARGET_DEVICES += tplink_archer-c50-v3
 
-define Device/tplink_c50-v4
+define Device/tplink_archer-c50-v4
   $(Device/tplink)
   DTS := ArcherC50V4
   IMAGE_SIZE := 7616k
@@ -345,8 +347,9 @@ define Device/tplink_c50-v4
   TPLINK_HVERSION := 3
   DEVICE_PACKAGES := kmod-mt76x2
   IMAGES := sysupgrade.bin
+  SUPPORTED_DEVICES += tplink,c50-v4
 endef
-TARGET_DEVICES += tplink_c50-v4
+TARGET_DEVICES += tplink_archer-c50-v4
 
 define Device/tplink_tl-mr3020-v3
   $(Device/tplink)
-- 
GitLab