ar71xx: add support for TP-Link Archer C59 v2
authorKeith Maika <keithm@aoeex.com>
Fri, 15 Jun 2018 04:39:09 +0000 (00:39 -0400)
committerJohn Crispin <john@phrozen.org>
Mon, 30 Jul 2018 12:04:45 +0000 (14:04 +0200)
TP-Link Archer C59v2 is a dual-band AC1350 router based on
Qualcomm/Atheros QCA9561+QCA9886 chips.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- USB 2.0 port
- UART header on PCB

Flash instruction:
  - via web UI:
    1. Download openwrt-ar71xx-generic-archer-c59-v2-squashfs-factory.bin
    2. Login to router and open the Advanced tab
    3. Navigate to System Tools -> Firmware Upgrade
    4. Upload firmware using the Manual Upgrade form
  - via TFTP:
    1. Set PC to fixed ip address 192.168.0.66
    2. Download openwrt-ar71xx-generic-archer-c59-v2-squashfs-factory.bin
       and rename it to tp_recovery.bin
    3. Start a tftp server with the file tp_recovery.bin in its root directory
    4. Turn off the router
    5. Press and hold Reset button
    6. Turn on router with the reset button pressed and wait ~15 seconds
    7. Release the reset button and after a short time
       the firmware should be transferred from the tftp server
    8. Wait ~30 second to complete recovery.

Signed-off-by: Keith Maika <keithm@aoeex.com>
13 files changed:
target/linux/ar71xx/base-files/etc/board.d/01_leds
target/linux/ar71xx/base-files/etc/board.d/02_network
target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-4.9
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/image/generic-tp-link.mk
tools/firmware-utils/src/tplink-safeloader.c

index d15cff5111c54e092b5c2041712e2972e6a538d6..af480cb001115a5dba6688cdd9257d5f2e6b44ae 100755 (executable)
@@ -129,6 +129,7 @@ archer-c7)
        ;;
 archer-c58-v1|\
 archer-c59-v1|\
+archer-c59-v2|\
 archer-c60-v1|\
 archer-c60-v2)
        ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x1E"
@@ -137,7 +138,8 @@ archer-c60-v2)
        ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt"
 
        case "$board" in
-       archer-c59-v1)
+       archer-c59-v1|\
+       archer-c59-v2)
                ucidef_set_led_usbdev "usb" "USB" "$board:green:usb" "1-1"
                ;;
        esac
index 3967dee94b0d6601db2645321aace6cd69e55032..75c90a270100e427db7bacd7a97edde0f2daf5aa 100755 (executable)
@@ -249,6 +249,7 @@ ar71xx_setup_interfaces()
                ;;
        archer-c58-v1|\
        archer-c59-v1|\
+       archer-c59-v2|\
        fritz4020|\
        rb-450g)
                ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
index 45b5d2adbb670c283fbff5bbfa0782685c850356..fafdcce8f7e898819c51083abb05dddad5f65b8e 100644 (file)
@@ -66,6 +66,7 @@ get_status_led() {
        archer-c25-v1|\
        archer-c58-v1|\
        archer-c59-v1|\
+       archer-c59-v2|\
        archer-c60-v1|\
        archer-c60-v2|\
        archer-c7-v4|\
index 0ed624efc8a1389d0c09383c272384c7b43deb27..e08df23df6fc00555111d5e142b9b09e61e40ff4 100644 (file)
@@ -168,6 +168,7 @@ case "$FIRMWARE" in
        case $board in
        archer-c58-v1|\
        archer-c59-v1|\
+       archer-c59-v2|\
        archer-c60-v1|\
        archer-c60-v2|\
        cf-e355ac-v2|\
index a763938ecda878b767954e8dcb4b1d5807b26160..b58cf9b591f47c394c4c4b4a21e114e16af2da21 100644 (file)
@@ -14,6 +14,7 @@ board=$(board_name)
 case "$board" in
        archer-c58-v1|\
        archer-c59-v1|\
+       archer-c59-v2|\
        archer-c60-v1|\
        archer-c60-v2)
                echo $(macaddr_add $(mtd_get_mac_binary mac 8)  $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
index 27c4bec2805cfdded1d17c85fbbb9876e416dcd1..8f31f3ed70894274f8f40a357f0fec69934f0e99 100755 (executable)
@@ -492,6 +492,9 @@ ar71xx_board_detect() {
                ;;
        *"Archer C59 v1")
                name="archer-c59-v1"
+        ;;
+       *"Archer C59 v2")
+               name="archer-c59-v2"
                ;;
        *"Archer C60 v1")
                name="archer-c60-v1"
index 5a1f71b431fb7190f4140449bf44ad07dbd83cc1..d469699d3cfa2023c3b4b68fbbbdb14ee3cf435d 100755 (executable)
@@ -212,6 +212,7 @@ platform_check_image() {
        archer-c25-v1|\
        archer-c58-v1|\
        archer-c59-v1|\
+       archer-c59-v2|\
        archer-c60-v1|\
        archer-c60-v2|\
        archer-c7-v4|\
index a1c6360ef57742c5077f9c551c8688863657b163..8d25692ec865344a78790127e529151e09345409 100644 (file)
@@ -52,6 +52,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set
 # CONFIG_ATH79_MACH_ARCHER_C58_V1 is not set
 # CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set
+# CONFIG_ATH79_MACH_ARCHER_C59_V2 is not set
 # CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set
 # CONFIG_ATH79_MACH_ARCHER_C60_V2 is not set
 # CONFIG_ATH79_MACH_ARCHER_C7 is not set
index a6903d2939ce53f8e500d3ab19b7b857ebf822d5..7b82b42e0a04c16ec0790db0b556474f00b8c630 100644 (file)
@@ -1575,6 +1575,17 @@ config ATH79_MACH_ARCHER_C59_V1
        select ATH79_DEV_USB
        select ATH79_DEV_WMAC
 
+config ATH79_MACH_ARCHER_C59_V2
+       bool "TP-LINK Archer C59 v2 support"
+       select SOC_QCA956X
+       select ATH79_DEV_AP9X_PCI if PCI
+       select ATH79_DEV_ETH
+       select ATH79_DEV_GPIO_BUTTONS
+       select ATH79_DEV_LEDS_GPIO
+       select ATH79_DEV_M25P80
+       select ATH79_DEV_USB
+       select ATH79_DEV_WMAC
+
 config ATH79_MACH_ARCHER_C60_V1
        bool "TP-LINK Archer C60 v1 support"
        select SOC_QCA956X
index c500c91a1a38892572106e9e5ab547d6741306a9..6cc40e6a7bc3f1cc791b2a48ba6e99950108c2e0 100644 (file)
@@ -146,6 +146,49 @@ static struct gpio_led archer_c59_v1_leds_gpio[] __initdata = {
        },
 };
 
+static struct gpio_led archer_c59_v2_leds_gpio[] __initdata = {
+       {
+               .name           = "archer-c59-v2:green:power",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_POWER,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:green:wlan2g",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_WLAN2,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:green:wlan5g",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_WLAN5,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:green:lan",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_LAN,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:green:wan",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_WAN_GREEN,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:amber:wan",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_WAN_AMBER,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:green:wps",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_WPS,
+               .active_low     = 1,
+       },
+       {
+               .name           = "archer-c59-v2:green:usb",
+               .gpio           = ARCHER_C59_74HC_GPIO_LED_USB,
+               .active_low     = 1,
+       },
+};
+
 static struct gpio_keys_button archer_c59_v1_gpio_keys[] __initdata = {
        {
                .desc                   = "Reset button",
@@ -215,9 +258,9 @@ static struct spi_board_info archer_c59_v1_spi_info[] = {
        },
 };
 
-static void __init archer_c5x_v1_setup(void)
+static void __init archer_c5x_v1_setup(u32 macLocation)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
+       u8 *mac = (u8 *) KSEG1ADDR(macLocation);
        u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
 
        ath79_register_m25p80(NULL);
@@ -270,7 +313,7 @@ static void __init archer_c5x_v1_setup(void)
 
 static void __init archer_c58_v1_setup(void)
 {
-       archer_c5x_v1_setup();
+       archer_c5x_v1_setup(0x1f010008);
        ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c58_v1_leds_gpio),
                                archer_c58_v1_leds_gpio);
 }
@@ -280,10 +323,20 @@ MIPS_MACHINE(ATH79_MACH_ARCHER_C58_V1, "ARCHER-C58-V1",
 
 static void __init archer_c59_v1_setup(void)
 {
-       archer_c5x_v1_setup();
+       archer_c5x_v1_setup(0x1f010008);
        ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v1_leds_gpio),
                                archer_c59_v1_leds_gpio);
 }
 
 MIPS_MACHINE(ATH79_MACH_ARCHER_C59_V1, "ARCHER-C59-V1",
        "TP-LINK Archer C59 v1", archer_c59_v1_setup);
+
+static void __init archer_c59_v2_setup(void)
+{
+       archer_c5x_v1_setup(0x1f030008);
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v2_leds_gpio),
+                               archer_c59_v2_leds_gpio);
+}
+
+MIPS_MACHINE(ATH79_MACH_ARCHER_C59_V2, "ARCHER-C59-V2",
+       "TP-LINK Archer C59 v2", archer_c59_v2_setup);
index 8328a6febc9c4245f53b59c601d9cae463547d2a..0b959632db21c3187a8bff8fb02cdc9abf645679 100644 (file)
@@ -47,6 +47,7 @@ enum ath79_mach_type {
        ATH79_MACH_ARCHER_C5,                   /* TP-LINK Archer C5 board */
        ATH79_MACH_ARCHER_C58_V1,               /* TP-LINK Archer C58 V1 board */
        ATH79_MACH_ARCHER_C59_V1,               /* TP-LINK Archer C59 V1 board */
+       ATH79_MACH_ARCHER_C59_V2,               /* TP-LINK Archer C59 V2 board */
        ATH79_MACH_ARCHER_C60_V1,               /* TP-LINK Archer C60 V1 board */
        ATH79_MACH_ARCHER_C60_V2,               /* TP-LINK Archer C60 V2 board */
        ATH79_MACH_ARCHER_C7,                   /* TP-LINK Archer C7 board */
index 89983779e7bc7aecc3f696935a9a0bfc2936f058..3c0a89d2b8f175c8c4cd807656163da028f971b2 100644 (file)
@@ -45,6 +45,18 @@ define Device/archer-c59-v1
 endef
 TARGET_DEVICES += archer-c59-v1
 
+define Device/archer-c59-v2
+  $(Device/archer-c59-v1)
+  DEVICE_TITLE := TP-LINK Archer C59 v2
+  BOARDNAME := ARCHER-C59-V2
+  TPLINK_BOARD_ID := ARCHER-C59-V2
+  DEVICE_PROFILE := ARCHERC59V2
+  IMAGE_SIZE := 14400k
+  MTDPARTS := spi0.0:128k(factory-boot)ro,64k(u-boot)ro,64k(mac)ro,14400k(firmware),1664k(tplink)ro,64k@0xff0000(art)ro
+  SUPPORTED_DEVICES := archer-c59-v2
+endef
+TARGET_DEVICES += archer-c59-v2
+
 define Device/archer-c60-v1
   $(Device/archer-cxx)
   DEVICE_TITLE := TP-LINK Archer C60 v1
index 92d44856e5bec648c7a364d8505b90477eb90e2a..15eaa830d6fed15f2b90933e253fd42832845601 100644 (file)
@@ -463,6 +463,46 @@ static struct device_info boards[] = {
                .last_sysupgrade_partition = "file-system",
        },
 
+       /** Firmware layout for the C59v2 */
+       {
+               .id     = "ARCHER-C59-V2",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\r\n"
+                       "{product_name:Archer C59,product_ver:2.0.0,special_id:00000000}\r\n"
+                       "{product_name:Archer C59,product_ver:2.0.0,special_id:45550000}\r\n"
+                       "{product_name:Archer C59,product_ver:2.0.0,special_id:55530000}\r\n",
+               .support_trail = '\x00',
+               .soft_ver = "soft_ver:2.0.0 Build 20161206 rel.7303\n",
+
+               /** We're using a dynamic kernel/rootfs split here */
+               .partitions = {
+                       {"factory-boot", 0x00000, 0x20000},
+                       {"fs-uboot", 0x20000, 0x10000},
+                       {"default-mac", 0x30000, 0x00200},
+                       {"pin", 0x30200, 0x00200},
+                       {"device-id", 0x30400, 0x00100},
+                       {"product-info", 0x30500, 0x0fb00},
+                       {"firmware", 0x40000, 0xe10000},
+                       {"partition-table", 0xe50000, 0x10000},
+                       {"soft-version", 0xe60000, 0x10000},
+                       {"support-list", 0xe70000, 0x10000},
+                       {"profile", 0xe80000, 0x10000},
+                       {"default-config", 0xe90000, 0x10000},
+                       {"user-config", 0xea0000, 0x40000},
+                       {"usb-config", 0xee0000, 0x10000},
+                       {"certificate", 0xef0000, 0x10000},
+                       {"extra-para", 0xf00000, 0x10000},
+                       {"qos-db", 0xf10000, 0x30000},
+                       {"log", 0xfe0000, 0x10000},
+                       {"radio", 0xff0000, 0x10000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system",
+       },
+
        /** Firmware layout for the C60v1 */
        {
                .id     = "ARCHER-C60-V1",
@@ -1550,6 +1590,7 @@ static void build_image(const char *output,
 
        /* Some devices need the extra-para partition to accept the firmware */
        if (strcasecmp(info->id, "ARCHER-C25-V1") == 0 ||
+           strcasecmp(info->id, "ARCHER-C59-V2") == 0 ||
            strcasecmp(info->id, "ARCHER-C60-V2") == 0 ||
            strcasecmp(info->id, "TLWR1043NV5") == 0) {
                const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};