From b9bf9ba099654843ef87088a5850830fee4c1c92 Mon Sep 17 00:00:00 2001 From: apcameron <37645737+apcameron@users.noreply.github.com> Date: Tue, 11 Dec 2018 17:09:11 -0600 Subject: [PATCH] ar71xx: Add Support for the TP-LINK CPE220 V2.0 Device (#306) Installation: Flash factory image through stock firmware WEB UI or through TFTP To get to TFTP recovery just hold reset button while powering on for around 4-5 seconds and release. Rename factory image to recovery.bin Stock TFTP server IP:192.168.0.100 Stock device TFTP adress:192.168.0.254 --- README.md | 1 + configs/ar71xx-generic.config | 1 + files/www/cgi-bin/admin | 2 + files/www/cgi-bin/perlfunc.pm | 10 ++ ...01-add_support_for_TP-Link_CPE220_v2.patch | 103 ++++++++++++++++++ patches/700-cpe-diags.patch | 3 +- patches/series | 1 + 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 patches/001-add_support_for_TP-Link_CPE220_v2.patch diff --git a/README.md b/README.md index 10ed3c71..cbfb6a75 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ Rocket M5 TI | rocket-m-ti | 64Mb | stable TPLink CPE210 v1.0/v1.1 | cpe210-220-v1 | 64Mb | stable TPLink CPE210 v2.0 | cpe210-v2 | 64Mb | stable TPLink CPE210 v3.0 | cpe210-v3 | 64Mb | stable +TPLink CPE220 v2.0 | cpe220-v2 | 64Mb | stable TPLink CPE220 v3.0 | cpe220-v3 | 64Mb | stable TPLink CPE510 v1.0/v1.1 | cpe510-520-v1 | 64Mb | stable TPLink CPE510 v2.0 | cpe510-v2 | 64Mb | stable diff --git a/configs/ar71xx-generic.config b/configs/ar71xx-generic.config index 61a9b44b..69ad472d 100644 --- a/configs/ar71xx-generic.config +++ b/configs/ar71xx-generic.config @@ -3,6 +3,7 @@ CONFIG_TARGET_ar71xx_generic=y CONFIG_TARGET_MULTI_PROFILE=y CONFIG_TARGET_DEVICE_ar71xx_generic_DEVICE_cpe210-v2=y CONFIG_TARGET_DEVICE_ar71xx_generic_DEVICE_cpe210-v3=y +CONFIG_TARGET_DEVICE_ar71xx_generic_DEVICE_cpe220-v2=y CONFIG_TARGET_DEVICE_ar71xx_generic_DEVICE_cpe220-v3=y CONFIG_TARGET_DEVICE_ar71xx_generic_DEVICE_cpe210-220-v1=y CONFIG_TARGET_DEVICE_ar71xx_generic_DEVICE_cpe510-520-v1=y diff --git a/files/www/cgi-bin/admin b/files/www/cgi-bin/admin index 58333a24..41a15ecc 100755 --- a/files/www/cgi-bin/admin +++ b/files/www/cgi-bin/admin @@ -136,6 +136,8 @@ if($hardwaretype eq "nanostation-m") $hardwaretypev= "210-v2" ; # v2.0 } elsif($hwmodel =~ /CPE210 v3\.0/i) { $hardwaretypev= "210-v3" ; # v3.0 + } elsif($hwmodel =~ /CPE220 v2\.0/i) { + $hardwaretypev= "220-v2" ; # v3.0 } elsif($hwmodel =~ /CPE220 v3\.0/i) { $hardwaretypev= "220-v3" ; # v3.0 } elsif($hwmodel =~ /CPE510 v2\.0/i) { diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 3cdca82e..26fd5969 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -1022,6 +1022,16 @@ sub hardware_info 'rfband' => '2400', 'chanpower' => { 1 => '21', 2 => '25', 11 => '18' }, }, + 'TP-Link CPE220 v2.0' => { + 'name' => 'TP-Link CPE220 v2.0', + 'comment' => '', + 'supported' => '1', + 'maxpower' => '30', + 'pwroffset' => '0', + 'usechains' => 1, + 'rfband' => '2400', + 'chanpower' => { 1 => '25', 2 => '28', 11 => '27' }, + }, 'TP-Link CPE220 v3.0' => { 'name' => 'TP-Link CPE220 v3.0', 'comment' => '', diff --git a/patches/001-add_support_for_TP-Link_CPE220_v2.patch b/patches/001-add_support_for_TP-Link_CPE220_v2.patch new file mode 100644 index 00000000..82cce01d --- /dev/null +++ b/patches/001-add_support_for_TP-Link_CPE220_v2.patch @@ -0,0 +1,103 @@ +--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds ++++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds +@@ -238,6 +238,7 @@ cf-e530n) + cpe210|\ + cpe210-v2|\ + cpe210-v3|\ ++cpe220-v2|\ + cpe220-v3|\ + cpe510-v2|\ + cpe510-v3|\ +--- a/target/linux/ar71xx/base-files/etc/board.d/02_network ++++ b/target/linux/ar71xx/base-files/etc/board.d/02_network +@@ -310,6 +310,7 @@ ar71xx_setup_interfaces() + "0@eth0" "2:lan" "1:wan" "6@eth1" + ;; + cpe210|\ ++ cpe220-v2|\ + cpe220-v3|\ + cpe510|\ + wbs210|\ +--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh ++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh +@@ -581,6 +581,10 @@ ar71xx_board_detect() { + name="cpe210-v3" + tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" + ;; ++ *"CPE220 v2") ++ name="cpe220-v2" ++ tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" ++ ;; + *"CPE220 v3") + name="cpe220-v3" + tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" +--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +@@ -593,6 +593,7 @@ platform_check_image() { + tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0 + return 1 + ;; ++ cpe220-v2|\ + cpe610|\ + cpe510-v2|\ + cpe510-v3) +--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c ++++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +@@ -336,6 +336,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210_V2, "CPE2 + MIPS_MACHINE(ATH79_MACH_CPE210_V3, "CPE210V3", "TP-LINK CPE210 v3", + cpe210_v2_setup); + ++MIPS_MACHINE(ATH79_MACH_CPE220_V2, "CPE220V2", "TP-LINK CPE220 v2", ++ cpe210_setup); ++ + MIPS_MACHINE(ATH79_MACH_CPE220_V3, "CPE220V3", "TP-LINK CPE220 v3", + cpe220_v3_setup); + +--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h ++++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +@@ -76,6 +76,7 @@ enum ath79_mach_type { + ATH79_MACH_CPE210, /* TP-LINK CPE210 v1 */ + ATH79_MACH_CPE210_V2, /* TP-LINK CPE210 v2 */ + ATH79_MACH_CPE210_V3, /* TP-LINK CPE210 v3 */ ++ ATH79_MACH_CPE220_V2, /* TP-LINK CPE220 v2 */ + ATH79_MACH_CPE220_V3, /* TP-LINK CPE220 v3 */ + ATH79_MACH_CPE510_V2, /* TP-LINK CPE510 v2 */ + ATH79_MACH_CPE510_V3, /* TP-LINK CPE510 v3 */ +--- a/target/linux/ar71xx/image/generic-tp-link.mk ++++ b/target/linux/ar71xx/image/generic-tp-link.mk +@@ -216,6 +216,14 @@ define Device/cpe210-v3 + endef + TARGET_DEVICES += cpe210-v3 + ++define Device/cpe220-v2 ++ $(Device/cpe510-520-v1) ++ DEVICE_TITLE := TP-LINK CPE220 v2 ++ BOARDNAME := CPE220V2 ++ TPLINK_BOARD_ID := CPE210 ++endef ++TARGET_DEVICES += cpe220-v2 ++ + define Device/cpe220-v3 + $(Device/cpe210-v2) + DEVICE_TITLE := TP-LINK CPE220 v3 +--- a/tools/firmware-utils/src/tplink-safeloader.c ++++ b/tools/firmware-utils/src/tplink-safeloader.c +@@ -131,7 +131,17 @@ static struct device_info boards[] = { + "CPE210(TP-LINK|EU|N300-2):1.1\r\n" + "CPE220(TP-LINK|UN|N300-2):1.1\r\n" + "CPE220(TP-LINK|US|N300-2):1.1\r\n" +- "CPE220(TP-LINK|EU|N300-2):1.1\r\n", ++ "CPE220(TP-LINK|EU|N300-2):1.1\r\n" ++ "CPE220(TP-LINK|EU|N300-2|00000000):2.0\r\n" ++ "CPE220(TP-LINK|EU|N300-2|45550000):2.0\r\n" ++ "CPE220(TP-LINK|EU|N300-2|55530000):2.0\r\n" ++ "CPE220(TP-LINK|UN|N300-2|00000000):2.0\r\n" ++ "CPE220(TP-LINK|UN|N300-2|45550000):2.0\r\n" ++ "CPE220(TP-LINK|UN|N300-2|55530000):2.0\r\n" ++ "CPE220(TP-LINK|US|N300-2|55530000):2.0\r\n" ++ "CPE220(TP-LINK|UN|N300-2):2.0\r\n" ++ "CPE220(TP-LINK|EU|N300-2):2.0\r\n" ++ "CPE220(TP-LINK|US|N300-2):2.0\r\n", + .support_trail = '\xff', + .soft_ver = NULL, + diff --git a/patches/700-cpe-diags.patch b/patches/700-cpe-diags.patch index 622a631a..7ce4a2b8 100644 --- a/patches/700-cpe-diags.patch +++ b/patches/700-cpe-diags.patch @@ -1,11 +1,12 @@ --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh -@@ -162,9 +162,18 @@ get_status_led() { +@@ -162,9 +162,19 @@ get_status_led() { cf-e385ac) status_led="$board:blue:wlan2g" ;; + cpe210-v2|\ + cpe210-v3|\ ++ cpe220-v2|\ + cpe220-v3|\ + cpe510-v2|\ + cpe510-v3|\ diff --git a/patches/series b/patches/series index 140e61af..98cb367b 100644 --- a/patches/series +++ b/patches/series @@ -3,6 +3,7 @@ 001-add_support_for_TP-Link_CPE610_v1.patch 001-add_support_for_TP-Link_CPE220_v3.patch 001-add_support_for_TP-Link_CPE510_v3.patch +001-add_support_for_TP-Link_CPE220_v2.patch 002-firmware-check-fix.patch 003-add-winbond-w25q128jv.patch 004-add-lhg-5hpnd-xl.patch