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

172 lines
6.2 KiB
Diff
Raw Normal View History

Index: openwrt/target/linux/ar71xx/base-files/lib/ar71xx.sh
===================================================================
--- openwrt.orig/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ openwrt/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -594,6 +594,10 @@ ar71xx_board_detect() {
name="cpe510"
tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')"
;;
+ *"CPE510 v2")
+ name="cpe510-v2"
+ tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)"
+ ;;
*"CPE830")
name="cpe830"
;;
Index: openwrt/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
===================================================================
--- openwrt.orig/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ openwrt/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -592,6 +592,10 @@ platform_check_image() {
tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0
return 1
;;
+ cpe510-v2)
+ tplink_pharos_check_image "$1" "7f454c46" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0
+ return 1
+ ;;
a40|\
a60|\
mr1750|\
Index: openwrt/target/linux/ar71xx/base-files/etc/board.d/01_leds
===================================================================
--- openwrt.orig/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ openwrt/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -250,6 +250,7 @@ cf-e530n)
cpe210|\
cpe210-v2|\
cpe210-v3|\
+cpe510-v2|\
cpe510|\
wbs210|\
wbs510)
@@ -261,7 +262,8 @@ wbs510)
case "$board" in
cpe210-v2|\
- cpe210-v3)
+ cpe210-v3|\
+ cpe510-v2)
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan0" "eth0"
;;
*)
Index: openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network
===================================================================
--- openwrt.orig/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -76,6 +76,7 @@ ar71xx_setup_interfaces()
cf-e380ac-v2|\
cpe210-v2|\
cpe210-v3|\
+ cpe510-v2|\
dr342|\
eap120|\
eap300v2|\
Index: openwrt/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
===================================================================
--- openwrt.orig/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
+++ openwrt/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
@@ -230,6 +230,39 @@ static void __init cpe210_v2_setup(void)
ath79_register_wmac(ee, mac);
}
+static void __init cpe510_v2_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe210_v2_leds_gpio),
+ cpe210_v2_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, CPE510_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(cpe510_gpio_keys),
+ cpe510_gpio_keys);
+ ath79_register_m25p80(NULL);
+ ath79_register_mdio(1, 0x0);
+ /* WAN */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(4);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+ ath79_register_eth(0);
+ /* LAN */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_register_eth(1);
+
+ ath79_register_wmac(ee, mac);
+}
+
MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
cpe210_setup);
@@ -239,6 +272,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_CPE510_V2, "CPE510V2", "TP-LINK CPE510 v2",
+ cpe510_v2_setup);
+
MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520",
cpe510_setup);
Index: openwrt/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
===================================================================
--- openwrt.orig/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ openwrt/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_CPE510_V2, /* TP-LINK CPE510 v2 */
ATH79_MACH_CPE505N, /* P&W CPE505N */
ATH79_MACH_CPE510, /* TP-LINK CPE510 */
ATH79_MACH_CPE830, /* YunCore CPE830 */
Index: openwrt/target/linux/ar71xx/image/generic-tp-link.mk
===================================================================
--- openwrt.orig/target/linux/ar71xx/image/generic-tp-link.mk
+++ openwrt/target/linux/ar71xx/image/generic-tp-link.mk
@@ -175,6 +175,13 @@ define Device/cpe510-520-v1
endef
TARGET_DEVICES += cpe510-520-v1
+define Device/cpe510-v2
+ $(Device/cpe510-520-v1)
+ DEVICE_TITLE := TP-LINK CPE510 v2
+ BOARDNAME := CPE510V2
+endef
+TARGET_DEVICES += cpe510-v2
+
define Device/cpe210-220-v1
$(Device/cpe510-520-v1)
DEVICE_TITLE := TP-LINK CPE210/220 v1
Index: openwrt/tools/firmware-utils/src/tplink-safeloader.c
===================================================================
--- openwrt.orig/tools/firmware-utils/src/tplink-safeloader.c
+++ openwrt/tools/firmware-utils/src/tplink-safeloader.c
@@ -214,7 +214,17 @@ static struct device_info boards[] = {
"CPE510(TP-LINK|EU|N300-5):1.1\r\n"
"CPE520(TP-LINK|UN|N300-5):1.1\r\n"
"CPE520(TP-LINK|US|N300-5):1.1\r\n"
- "CPE520(TP-LINK|EU|N300-5):1.1\r\n",
+ "CPE520(TP-LINK|EU|N300-5):1.1\r\n"
+ "CPE510(TP-LINK|EU|N300-5|00000000):2.0\r\n"
+ "CPE510(TP-LINK|EU|N300-5|45550000):2.0\r\n"
+ "CPE510(TP-LINK|EU|N300-5|55530000):2.0\r\n"
+ "CPE510(TP-LINK|UN|N300-5|00000000):2.0\r\n"
+ "CPE510(TP-LINK|UN|N300-5|45550000):2.0\r\n"
+ "CPE510(TP-LINK|UN|N300-5|55530000):2.0\r\n"
+ "CPE510(TP-LINK|US|N300-5|55530000):2.0\r\n"
+ "CPE510(TP-LINK|UN|N300-5):2.0\r\n"
+ "CPE510(TP-LINK|EU|N300-5):2.0\r\n"
+ "CPE510(TP-LINK|US|N300-5):2.0\r\n",
.support_trail = '\xff',
.soft_ver = NULL,