ath79: add support for TP-Link TL-WA901ND v4 and v5
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Wed, 15 Apr 2020 12:01:34 +0000 (14:01 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Mon, 18 May 2020 11:35:38 +0000 (13:35 +0200)
This ports support for the TL-WA901ND v4 and v5 from ar71xx to ath79.
They are similar to the TP9343-based TL-WR940N v3/v4 and TL-WR941ND v6.

Specifications:
  SoC: TP9343
  Flash/RAM: 4/32 MiB
  CPU: 750 MHz
  WiFi: 2.4 GHz b/g/n
  Ethernet: 1 port (100M)

Flashing instructions:
  Upload the factory image via the vendor firmware upgrade option.

Flash instruction (TFTP):
  1. Set PC to fixed ip address 192.168.0.66
  2. Download *-factory.bin image and rename it to * (see below)
  3. Start a tftp server with the image file 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.

  * The image name for TFTP recovery is wa901ndv4_tp_recovery.bin for
  both variants.

In ar71xx, a MAC address with offset 1 was used for ethernet port.
That's probably wrong, but this commit sticks to it until we know
the correct value.

Like in ar71xx, this builds the default factory.bin with EU country
code.

Thanks to Leonardo Weiss for testing on the v5.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ath79/dts/tp9343_tplink_tl-wa901nd-v4.dts [new file with mode: 0644]
target/linux/ath79/dts/tp9343_tplink_tl-wa901nd-v5.dts [new file with mode: 0644]
target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi [new file with mode: 0644]
target/linux/ath79/dts/tp9343_tplink_tl-wr94x.dtsi
target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi [new file with mode: 0644]
target/linux/ath79/image/tiny-tp-link.mk
target/linux/ath79/tiny/base-files/etc/board.d/01_leds
target/linux/ath79/tiny/base-files/etc/board.d/02_network

diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd-v4.dts b/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd-v4.dts
new file mode 100644 (file)
index 0000000..69080fe
--- /dev/null
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "tp9343_tplink_tl-wa901nd.dtsi"
+
+/ {
+       compatible = "tplink,tl-wa901nd-v4", "qca,tp9343";
+       model = "TP-Link TL-WA901ND v4";
+};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd-v5.dts b/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd-v5.dts
new file mode 100644 (file)
index 0000000..7d9e8e8
--- /dev/null
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "tp9343_tplink_tl-wa901nd.dtsi"
+
+/ {
+       compatible = "tplink,tl-wa901nd-v5", "qca,tp9343";
+       model = "TP-Link TL-WA901ND v5";
+};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi b/target/linux/ath79/dts/tp9343_tplink_tl-wa901nd.dtsi
new file mode 100644 (file)
index 0000000..992c148
--- /dev/null
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "tp9343_tplink_tl-wx.dtsi"
+
+/ {
+       aliases {
+               led-boot = &led_system;
+               led-failsafe = &led_system;
+               led-running = &led_system;
+               led-upgrade = &led_system;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "Reset button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_system: system {
+                       label = "tp-link:green:system";
+                       gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+               };
+
+               qss {
+                       label = "tp-link:green:qss";
+                       gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+               };
+
+               lan {
+                       label = "tp-link:green:lan";
+                       gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan {
+                       label = "tp-link:green:wlan";
+                       gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+};
+
+&eth1 {
+       compatible = "syscon", "simple-mfd";
+};
index aeb552530890d87766e887741bf2c5cae36f5b32..ea30d3b311d1a8c09aad644bb299fd108440434e 100644 (file)
@@ -1,19 +1,8 @@
 // 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"
+#include "tp9343_tplink_tl-wx.dtsi"
 
 / {
-       chosen {
-               bootargs = "console=ttyS0,115200n8";
-       };
-
-       aliases {
-               label-mac-device = &wmac;
-       };
-
        keys {
                compatible = "gpio-keys";
 
                };
        };
 };
-
-&spi {
-       status = "okay";
-       num-cs = <1>;
-
-       flash@0 {
-               compatible = "jedec,spi-nor";
-               reg = <0>;
-               spi-max-frequency = <25000000>;
-
-               partitions {
-                       compatible = "fixed-partitions";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-
-                       uboot:  partition@0 {
-                               label = "u-boot";
-                               reg = <0x000000 0x020000>;
-                               read-only;
-                       };
-
-                       partition@20000 {
-                               compatible = "tplink,firmware";
-                               label = "firmware";
-                               reg = <0x020000 0x3d0000>;
-                       };
-
-                       art: partition@3f0000 {
-                               label = "art";
-                               reg = <0x3f0000 0x010000>;
-                               read-only;
-                       };
-               };
-       };
-};
-
-&uart {
-       status = "okay";
-};
-
-&eth0 {
-       status = "okay";
-
-       phy-handle = <&swphy4>;
-
-       mtd-mac-address = <&uboot 0x1fc00>;
-       mtd-mac-address-increment = <1>;
-};
-
-&eth1 {
-       status = "okay";
-};
-
-&wmac {
-       status = "okay";
-
-       mtd-cal-data = <&art 0x1000>;
-       mtd-mac-address = <&uboot 0x1fc00>;
-};
diff --git a/target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi b/target/linux/ath79/dts/tp9343_tplink_tl-wx.dtsi
new file mode 100644 (file)
index 0000000..5050c8c
--- /dev/null
@@ -0,0 +1,76 @@
+// 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 {
+               label-mac-device = &wmac;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+       };
+};
+
+&spi {
+       status = "okay";
+
+       num-cs = <1>;
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <25000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       uboot:  partition@0 {
+                               label = "u-boot";
+                               reg = <0x000000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@20000 {
+                               compatible = "tplink,firmware";
+                               label = "firmware";
+                               reg = <0x020000 0x3d0000>;
+                       };
+
+                       art: partition@3f0000 {
+                               label = "art";
+                               reg = <0x3f0000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&uart {
+       status = "okay";
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&swphy4>;
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       mtd-mac-address-increment = <1>;
+};
+
+&eth1 {
+       status = "okay";
+};
+
+&wmac {
+       status = "okay";
+
+       mtd-cal-data = <&art 0x1000>;
+       mtd-mac-address = <&uboot 0x1fc00>;
+};
index 481329938ac2ab112887732a206996c218d802f3..a5a76edd059ae5c155ff25cc2bcbd1bed55c4f29 100644 (file)
@@ -170,6 +170,28 @@ define Device/tplink_tl-wa901nd-v2
 endef
 TARGET_DEVICES += tplink_tl-wa901nd-v2
 
+define Device/tplink_tl-wa901nd-v4
+  $(Device/tplink-4mlzma)
+  SOC := tp9343
+  DEVICE_MODEL := TL-WA901ND
+  DEVICE_VARIANT := v4
+  TPLINK_HWID := 0x09010004
+  SUPPORTED_DEVICES += tl-wa901nd-v4
+  IMAGE/factory.bin := tplink-v1-image factory -C EU
+endef
+TARGET_DEVICES += tplink_tl-wa901nd-v4
+
+define Device/tplink_tl-wa901nd-v5
+  $(Device/tplink-4mlzma)
+  SOC := tp9343
+  DEVICE_MODEL := TL-WA901ND
+  DEVICE_VARIANT := v5
+  TPLINK_HWID := 0x09010005
+  SUPPORTED_DEVICES += tl-wa901nd-v5
+  IMAGE/factory.bin := tplink-v1-image factory -C EU
+endef
+TARGET_DEVICES += tplink_tl-wa901nd-v5
+
 define Device/tplink_tl-wr703n
   $(Device/tplink-4mlzma)
   SOC := ar9331
index 30773db332ecf0e023e746a9972881a15b4424c2..3588278b0102d8906cb4e7da15138b87c5d52ffc 100755 (executable)
@@ -47,7 +47,9 @@ tplink,tl-wa730re-v1|\
 tplink,tl-wa801nd-v1|\
 tplink,tl-wa830re-v1|\
 tplink,tl-wa860re-v1|\
-tplink,tl-wa901nd-v1)
+tplink,tl-wa901nd-v1|\
+tplink,tl-wa901nd-v4|\
+tplink,tl-wa901nd-v5)
        ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
        ;;
 tplink,tl-mr3420-v2|\
index 53e2a1ebd4cb2f984ad437683e6326be998744bc..5e559363b2a6967d8438b95cb027c5f0b0fedba1 100755 (executable)
@@ -41,6 +41,8 @@ ath79_setup_interfaces()
        tplink,tl-wa860re-v1|\
        tplink,tl-wa901nd-v1|\
        tplink,tl-wa901nd-v2|\
+       tplink,tl-wa901nd-v4|\
+       tplink,tl-wa901nd-v5|\
        tplink,tl-wr703n)
                ucidef_set_interface_lan "eth0"
                ;;