ath79: add support for TP-Link TL-WPA8630P v2
authorAndreas Böhler <dev@aboehler.at>
Sat, 14 Mar 2020 23:20:22 +0000 (00:20 +0100)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Mon, 10 Aug 2020 09:48:08 +0000 (11:48 +0200)
The TL-WPA8630P v2 is a HomePlug AV2 compatible device with a QCA9563 SoC
and 2.4GHz and 5GHz WiFi modules.

Specifications
--------------

  - QCA9563 750MHz, 2.4GHz WiFi
  - QCA9888 5GHz WiFi
  - 8MiB SPI Flash
  - 128MiB RAM
  - 3 GBit Ports (QCA8337)
  - PLC (QCA7550)

MAC address assignment
----------------------

WiFi 2.4GHz and LAN share the same MAC address as printed on the label.
5GHz WiFi uses LAN-1, based on assumptions from similar devices.

LAN Port assignment
-------------------

While there are 3 physical LAN ports on the device, there will be 4
visible ports in OpenWrt. The fourth port (internal port 5) is used
by the PowerLine Communication SoC and thus treated like a regular
LAN port.

Versions
--------

Note that both TL-WPA8630 and TL-WPA8630P, as well as the different
country-versions, differ in partitioning, and therefore shouldn't be
cross-flashed.

This adds support for the two known partitioning variants of the
TL-WPA8630P, where the variants can be safely distinguished via the
tplink-safeloader SupportList. For the non-P variants (TL-WPA8630),
at least two additional partitioning schemes exist, and the same
SupportList entry can have different partitioning.
Thus, we don't support those officially (yet).

Also note that the P version for Germany (DE) requires the international
image version, but is properly protected by SupportList.

In any case, please check the OpenWrt Wiki pages for the device
before flashing anything!

Installation
------------

Installation is possible from the OEM web interface. Make sure to
install the latest OEM firmware first, so that the PLC firmware is
at the latest version. However, please also check the Wiki page
for hints according to altered partitioning between OEM firmware
revisions.

Additional thanks to Jon Davies and Joe Mullally for bringing
order into the partitioning mess.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
[minor DTS adjustments, add label-mac-device, drop chosen, move
common partitions to DTSI, rename de to int, add AU support strings,
adjust TPLINK_BOARD_ID, create common node in generic-tp-link.mk,
adjust commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts [new file with mode: 0644]
target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts [new file with mode: 0644]
target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi [new file with mode: 0644]
target/linux/ath79/generic/base-files/etc/board.d/01_leds
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ath79/image/generic-tp-link.mk
tools/firmware-utils/src/tplink-safeloader.c

diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts
new file mode 100644 (file)
index 0000000..afcb471
--- /dev/null
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "qca9563_tplink_tl-wpa8630p-v2.dtsi"
+
+/ {
+       compatible = "tplink,tl-wpa8630p-v2-eu", "qca,qca9563";
+       model = "TP-Link WPA8630P v2 (EU)";
+};
+
+&partitions {
+       mac: partition@630000 {
+               label = "mac";
+               reg = <0x630000 0x010000>;
+               read-only;
+       };
+
+       partition@640000 {
+               label = "tplink";
+               reg = <0x640000 0x1b0000>;
+               read-only;
+       };
+
+       art: partition@7f0000 {
+               label = "art";
+               reg = <0x7f0000 0x010000>;
+               read-only;
+       };
+};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts
new file mode 100644 (file)
index 0000000..8655283
--- /dev/null
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "qca9563_tplink_tl-wpa8630p-v2.dtsi"
+
+/ {
+       compatible = "tplink,tl-wpa8630p-v2-int", "qca,qca9563";
+       model = "TP-Link WPA8630P v2 (Int.)";
+};
+
+&partitions {
+       partition@630000 {
+               label = "tplink";
+               reg = <0x630000 0x1b0000>;
+               read-only;
+       };
+
+       mac: partition@7e0000 {
+               label = "mac";
+               reg = <0x7e0000 0x010000>;
+               read-only;
+       };
+
+       art: partition@7f0000 {
+               label = "art";
+               reg = <0x7f0000 0x010000>;
+               read-only;
+       };
+};
diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi
new file mode 100644 (file)
index 0000000..16c055b
--- /dev/null
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "qca956x.dtsi"
+
+/ {
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+               label-mac-device = &eth0;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       label = "tp-link:green:power";
+                       gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+               };
+
+               wifi2g {
+                       label = "tp-link:green:wifi2g";
+                       gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy1tpt";
+               };
+
+               wifi5g {
+                       label = "tp-link:green:wifi5g";
+                       gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               lan {
+                       label = "tp-link:green:lan";
+                       gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               led_control {
+                       gpio-export,name = "tp-link:led:control";
+                       gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "Reset button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               pair {
+                       label = "Pair button";
+                       linux,code = <BTN_1>;
+                       gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               leds {
+                       label = "LED control button";
+                       linux,code = <BTN_0>;
+                       gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               wps {
+                       label = "WPS button";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+       };
+};
+
+&spi {
+       status = "okay";
+
+       num-cs = <1>;
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <25000000>;
+
+               partitions: partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "factory-uboot";
+                               reg = <0x000000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@20000 {
+                               label = "u-boot";
+                               reg = <0x020000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@40000 {
+                               compatible = "tplink,firmware";
+                               label = "firmware";
+                               reg = <0x040000 0x5e0000>;
+                       };
+
+                       partition@620000 {
+                               label = "partition-table";
+                               reg = <0x620000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+};
+
+&uart {
+       status = "okay";
+};
+
+&mdio0 {
+       status = "okay";
+
+       phy-mask = <0>;
+
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+               phy-mode = "sgmii";
+               qca,mib-poll-interval = <500>;
+
+               qca,ar8327-initvals = <
+                       0x04 0x00080080 /* PORT0 PAD MODE CTRL */
+                       0x7c 0x0000007e /* PORT0_STATUS */
+               >;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&phy0>;
+       phy-mode = "sgmii";
+       mtd-mac-address = <&mac 0x8>;
+};
+
+&wmac {
+       status = "okay";
+
+       mtd-cal-data = <&art 0x1000>;
+       mtd-mac-address = <&mac 0x8>;
+};
index 636ff16a174124c831992a588747bd986da68f7e..1dff5acc38f53c2749124159263f7a0e8f695a85 100755 (executable)
@@ -296,6 +296,10 @@ tplink,tl-mr6400-v1)
        ucidef_set_led_netdev "wan" "WAN" "tp-link:white:wan" "eth1"
        ucidef_set_led_netdev "4g" "4G" "tp-link:white:4g" "usb0"
        ;;
+tplink,tl-wpa8630p-v2-eu|\
+tplink,tl-wpa8630p-v2-int)
+       ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x3c"
+       ;;
 tplink,tl-wr842n-v2)
        ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
        ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
index d99e2ed0ebbf1e2e8dd4e15b240298fa496149f9..b4e18296188d6b72d587e4e7a79e72c0749606ad 100755 (executable)
@@ -293,6 +293,12 @@ ath79_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2"
                ;;
+       tplink,tl-wpa8630p-v2-eu|\
+       tplink,tl-wpa8630p-v2-int)
+               # port 5 (internal) is the power-line port
+               ucidef_add_switch "switch0" \
+                       "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
+               ;;
        tplink,tl-wr842n-v2)
                ucidef_set_interface_wan "eth1"
                ucidef_add_switch "switch0" \
index 9d4306e66b8807f6bb58af30ca4b27ab39e2997e..863fdc842ababee5f3d57705286323ececfdd34d 100644 (file)
@@ -187,7 +187,9 @@ case "$FIRMWARE" in
        tplink,archer-c60-v2|\
        tplink,archer-c60-v3|\
        tplink,archer-c6-v2|\
-       tplink,archer-c6-v2-us)
+       tplink,archer-c6-v2-us|\
+       tplink,tl-wpa8630p-v2-eu|\
+       tplink,tl-wpa8630p-v2-int)
                caldata_extract "art" 0x5000 0x2f20
                ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1)
                ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
index 967eb2a7c3805062cb019eaca3a25d19d2bcff85..346944ab6f301c7a38137dfc5ec445f03d668000 100644 (file)
@@ -500,6 +500,28 @@ define Device/tplink_tl-wdr4900-v2
 endef
 TARGET_DEVICES += tplink_tl-wdr4900-v2
 
+define Device/tplink_tl-wpa8630p-v2
+  $(Device/tplink-safeloader)
+  SOC := qca9563
+  DEVICE_MODEL := TL-WPA8630P
+  IMAGE_SIZE := 6016k
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct
+endef
+
+define Device/tplink_tl-wpa8630p-v2-eu
+  $(Device/tplink_tl-wpa8630p-v2)
+  DEVICE_VARIANT := v2 (EU)
+  TPLINK_BOARD_ID := TL-WPA8630P-V2-EU
+endef
+TARGET_DEVICES += tplink_tl-wpa8630p-v2-eu
+
+define Device/tplink_tl-wpa8630p-v2-int
+  $(Device/tplink_tl-wpa8630p-v2)
+  DEVICE_VARIANT := v2 (Int.)
+  TPLINK_BOARD_ID := TL-WPA8630P-V2-INT
+endef
+TARGET_DEVICES += tplink_tl-wpa8630p-v2-int
+
 define Device/tplink_tl-wr1043nd-v1
   $(Device/tplink-8m)
   SOC := ar9132
index 0af1fe4c6e2ecf215591e0476459fea226e89949..fa0e0bb62dd2ed6f215f5efbb98181323b5fbe14 100644 (file)
@@ -1380,6 +1380,78 @@ static struct device_info boards[] = {
                .last_sysupgrade_partition = "file-system"
        },
 
+       /** Firmware layout for the TL-WPA8630P v2 (EU)*/
+       {
+               .id     = "TL-WPA8630P-V2-EU",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\n"
+                       "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n",
+               .support_trail = '\x00',
+               .soft_ver = NULL,
+
+               .partitions = {
+                       {"factory-uboot", 0x00000, 0x20000},
+                       {"fs-uboot", 0x20000, 0x20000},
+                       {"firmware", 0x40000, 0x5e0000},
+                       {"partition-table", 0x620000, 0x02000},
+                       {"default-mac", 0x630000, 0x00020},
+                       {"pin", 0x630100, 0x00020},
+                       {"device-id", 0x630200, 0x00030},
+                       {"product-info", 0x631100, 0x01000},
+                       {"extra-para", 0x632100, 0x01000},
+                       {"soft-version", 0x640000, 0x01000},
+                       {"support-list", 0x641000, 0x01000},
+                       {"profile", 0x642000, 0x08000},
+                       {"user-config", 0x650000, 0x10000},
+                       {"default-config", 0x660000, 0x10000},
+                       {"default-nvm", 0x670000, 0xc0000},
+                       {"default-pib", 0x730000, 0x40000},
+                       {"radio", 0x7f0000, 0x10000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
+       /** Firmware layout for the TL-WPA8630P v2 (INT)*/
+       {
+               .id     = "TL-WPA8630P-V2-INT",
+               .vendor = "",
+               .support_list =
+                       "SupportList:\n"
+                       "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n"
+                       "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n"
+                       "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n",
+               .support_trail = '\x00',
+               .soft_ver = NULL,
+
+               .partitions = {
+                       {"factory-uboot", 0x00000, 0x20000},
+                       {"fs-uboot", 0x20000, 0x20000},
+                       {"firmware", 0x40000, 0x5e0000},
+                       {"partition-table", 0x620000, 0x02000},
+                       {"extra-para", 0x632100, 0x01000},
+                       {"soft-version", 0x640000, 0x01000},
+                       {"support-list", 0x641000, 0x01000},
+                       {"profile", 0x642000, 0x08000},
+                       {"user-config", 0x650000, 0x10000},
+                       {"default-config", 0x660000, 0x10000},
+                       {"default-nvm", 0x670000, 0xc0000},
+                       {"default-pib", 0x730000, 0x40000},
+                       {"default-mac", 0x7e0000, 0x00020},
+                       {"pin", 0x7e0100, 0x00020},
+                       {"device-id", 0x7e0200, 0x00030},
+                       {"product-info", 0x7e1100, 0x01000},
+                       {"radio", 0x7f0000, 0x10000},
+                       {NULL, 0, 0}
+               },
+
+               .first_sysupgrade_partition = "os-image",
+               .last_sysupgrade_partition = "file-system"
+       },
+
        /** Firmware layout for the TL-WR1043 v5 */
        {
                .id     = "TLWR1043NV5",