--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -592,6 +592,7 @@ platform_check_image() { tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0 return 1 ;; + cpe610|\ cpe510-v2) tplink_pharos_check_image "$1" "7f454c46" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0 return 1 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -1,3 +1,4 @@ + /* Copyright (c) 2014, Matthias Schiffer All rights reserved. @@ -228,6 +229,46 @@ static struct device_info boards[] = { .support_trail = '\xff', .soft_ver = NULL, + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"signature", 0x32000, 0x00400}, + {"os-image", 0x40000, 0x1c0000}, + {"file-system", 0x200000, 0x5b0000}, + {"soft-version", 0x7b0000, 0x00100}, + {"support-list", 0x7b1000, 0x00400}, + {"user-config", 0x7c0000, 0x10000}, + {"default-config", 0x7d0000, 0x10000}, + {"log", 0x7e0000, 0x10000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "support-list", + }, + + /** Firmware layout for the CPE610 */ + { + .id = "CPE610", + .vendor = "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n", + .support_list = + "SupportList:\r\n" + "CPE610(TP-LINK|EU|N300-5|00000000):1.0\r\n" + "CPE610(TP-LINK|EU|N300-5|45550000):1.0\r\n" + "CPE610(TP-LINK|EU|N300-5|55530000):1.0\r\n" + "CPE610(TP-LINK|UN|N300-5|00000000):1.0\r\n" + "CPE610(TP-LINK|UN|N300-5|45550000):1.0\r\n" + "CPE610(TP-LINK|UN|N300-5|55530000):1.0\r\n" + "CPE610(TP-LINK|US|N300-5|55530000):1.0\r\n" + "CPE610(TP-LINK|UN|N300-5):1.0\r\n" + "CPE610(TP-LINK|EU|N300-5):1.0\r\n" + "CPE610(TP-LINK|US|N300-5):1.0\r\n", + .support_trail = '\xff', + .soft_ver = NULL, + .partitions = { {"fs-uboot", 0x00000, 0x20000}, {"partition-table", 0x20000, 0x02000}, --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c @@ -125,6 +125,18 @@ static struct gpio_led cpe210_v2_leds_gp }, }; +static struct gpio_led cpe610_leds_gpio[] __initdata = { + { + .name = "tp-link:green:lan0", + .gpio = CPE510_GPIO_LED_LAN0, + .active_low = 1, + }, { + .name = "tp-link:green:link1", + .gpio = CPE510_GPIO_LED_L1, + .active_low = 1, + }, +}; + static struct gpio_keys_button cpe510_gpio_keys[] __initdata = { { .desc = "Reset button", @@ -263,6 +275,39 @@ static void __init cpe510_v2_setup(void) ath79_register_wmac(ee, mac); } +static void __init cpe610_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(cpe610_leds_gpio), + cpe610_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); @@ -278,6 +323,9 @@ MIPS_MACHINE(ATH79_MACH_CPE510_V2, "CPE5 MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520", cpe510_setup); +MIPS_MACHINE(ATH79_MACH_CPE610, "CPE610", "TP-LINK CPE610", + cpe610_setup); + MIPS_MACHINE(ATH79_MACH_WBS210, "WBS210", "TP-LINK WBS210", wbs_setup); --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -592,6 +592,10 @@ ar71xx_board_detect() { name="cpe510-v2" tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" ;; + *"CPE610") + name="cpe610" + tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" + ;; *"CPE830") name="cpe830" ;; --- a/target/linux/ar71xx/image/generic-tp-link.mk +++ b/target/linux/ar71xx/image/generic-tp-link.mk @@ -209,6 +209,14 @@ define Device/cpe210-v3 endef TARGET_DEVICES += cpe210-v3 +define Device/cpe610-v1 + $(Device/cpe510-520-v1) + DEVICE_TITLE := TP-LINK CPE610 + BOARDNAME := CPE610 + TPLINK_BOARD_ID := CPE610 +endef +TARGET_DEVICES += cpe610-v1 + define Device/wbs210-v1 $(Device/cpe510-520-v1) DEVICE_TITLE := TP-LINK WBS210 v1 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -260,6 +260,10 @@ wbs510) ;; esac ;; +cpe610) + ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan0" "eth0" + ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:link1" "wlan0" + ;; cr3000) ucidef_set_led_netdev "wan" "WAN" "pcs:blue:wan" "eth1" ucidef_set_led_switch "lan1" "LAN1" "pcs:blue:lan1" "switch0" "0x04" --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -76,6 +76,7 @@ ar71xx_setup_interfaces() cap4200ag|\ cf-e380ac-v1|\ cf-e380ac-v2|\ + cpe610|\ cpe210-v2|\ cpe210-v3|\ cpe510-v2|\ --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -79,6 +79,7 @@ enum ath79_mach_type { ATH79_MACH_CPE510_V2, /* TP-LINK CPE510 v2 */ ATH79_MACH_CPE505N, /* P&W CPE505N */ ATH79_MACH_CPE510, /* TP-LINK CPE510 */ + ATH79_MACH_CPE610, /* TP-LINK CPE610 */ ATH79_MACH_CPE830, /* YunCore CPE830 */ ATH79_MACH_CPE870, /* YunCore CPE870 */ ATH79_MACH_CR3000, /* PowerCloud CR3000 */