aredn/patches/001-add_support_for_TP-Link...

158 lines
5.1 KiB
Diff

From 70260d35ff2f9428c085583f30b053ec45eea2f8 Mon Sep 17 00:00:00 2001
From: Andrew Cameron <apcameron@softhome.net>
Date: Fri, 25 Oct 2019 20:32:48 -0500
Subject: [PATCH 2/2] ar71xx: add Support for the TP-LINK CPE220 V3.0 Device
This adds support for a popular low-cost 2.4GHz N based AP
Specifications:
SoC: Qualcomm Atheros QCA9533 (650MHz)
RAM: 64MB
Storage: 8 MB SPI NOR
Wireless: 2.4GHz N based built into SoC 2x2
Ethernet: 2x 100/10 Mbps, integrated into SoC
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
Signed-off-by: Andrew Cameron apcameron@softhome.net
---
.../ar71xx/base-files/etc/board.d/01_leds | 1 +
.../ar71xx/base-files/etc/board.d/02_network | 1 +
.../base-files/etc/board.d/03_gpio_switches | 1 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 4 ++++
.../ar71xx/base-files/lib/upgrade/platform.sh | 3 ++-
.../files/arch/mips/ath79/mach-cpe510.c | 24 +++++++++++++++++++
.../ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
target/linux/ar71xx/image/generic-tp-link.mk | 8 +++++++
8 files changed, 42 insertions(+), 1 deletion(-)
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -254,6 +254,7 @@ cf-e530n)
cpe210|\
cpe210-v2|\
cpe210-v3|\
+cpe220-v3|\
cpe510|\
cpe510-v2|\
wbs210|\
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -289,6 +289,7 @@ ar71xx_setup_interfaces()
"0@eth0" "2:lan" "1:wan" "6@eth1"
;;
cpe210|\
+ cpe220-v3|\
cpe510|\
wbs210|\
wbs510)
--- a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
@@ -11,6 +11,7 @@ board=$(board_name)
case "$board" in
cpe210|\
+cpe220-v3|\
cpe510|\
wbs210|\
wbs510)
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -759,6 +759,10 @@ ar71xx_board_detect() {
name="cpe210-v3"
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)"
+ ;;
*"CPE505N")
name="cpe505n"
;;
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -594,7 +594,8 @@ platform_check_image() {
return 1
;;
cpe210-v2|\
- cpe210-v3)
+ cpe210-v3|\
+ cpe220-v3)
tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0
return 1
;;
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
@@ -304,6 +304,27 @@ static void __init cpe610_setup(void)
ath79_register_wmac(ee, mac);
}
+static void __init cpe220_v3_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe510_leds_gpio),
+ cpe510_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, CPE510_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(cpe210_v2_gpio_keys),
+ cpe210_v2_gpio_keys);
+
+ ath79_register_m25p80(NULL);
+ ath79_register_mdio(0, 0x0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_register_eth(1);
+
+ ath79_register_wmac(ee, mac);
+}
+
MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
cpe210_setup);
@@ -313,6 +334,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_V3, "CPE220V3", "TP-LINK CPE220 v3",
+ cpe220_v3_setup);
+
MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520",
cpe510_setup);
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -77,6 +77,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_V3, /* TP-LINK CPE220 v3 */
ATH79_MACH_CPE505N, /* P&W CPE505N */
ATH79_MACH_CPE510, /* TP-LINK CPE510 */
ATH79_MACH_CPE510_V2, /* TP-LINK CPE510 v2 */
--- a/target/linux/ar71xx/image/generic-tp-link.mk
+++ b/target/linux/ar71xx/image/generic-tp-link.mk
@@ -231,6 +231,14 @@ define Device/cpe610-v1
endef
TARGET_DEVICES += cpe610-v1
+define Device/cpe220-v3
+ $(Device/cpe210-v2)
+ DEVICE_TITLE := TP-LINK CPE220 v3
+ BOARDNAME := CPE220V3
+ TPLINK_BOARD_ID := CPE220V3
+endef
+TARGET_DEVICES += cpe220-v3
+
define Device/wbs210-v1
$(Device/cpe510-520-v1)
DEVICE_TITLE := TP-LINK WBS210 v1