ath79: add support for more AR7241 TP-Link boards
authorDmytro Smyrnov <dioptimizer@hotmail.com>
Tue, 26 Jun 2018 14:01:47 +0000 (17:01 +0300)
committerMathias Kresin <dev@kresin.me>
Thu, 28 Jun 2018 18:31:47 +0000 (20:31 +0200)
Its common AP99(AR7241) platform with following devices:

  TP-Link TL-WR841N/ND v7 (SoC AR7241 / Wifi AR9287 / without USB)
  TP-Link TL-MR3220 v1 (SoC AR7241 / Wifi AR9285 / USB support)
  TP-Link TL-MR3420 v1 (SoC AR7241 / Wifi AR9287 / USB support)

Signed-off-by: Dmytro Smyrnov <dioptimizer@hotmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
target/linux/ath79/base-files/etc/board.d/02_network
target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/dts/ar7241_tl-mr3220-v1.dts [new file with mode: 0644]
target/linux/ath79/dts/ar7241_tl-mr3420-v1.dts [new file with mode: 0644]
target/linux/ath79/dts/ar7241_tl-mr3x20.dtsi [new file with mode: 0644]
target/linux/ath79/dts/ar7241_tl-wr841-v7.dts [new file with mode: 0644]
target/linux/ath79/dts/ar7241_tp-link.dtsi [new file with mode: 0644]
target/linux/ath79/image/tiny-tp-link.mk

index d60406e163aa45eead2b93b771070d2927f59880..5601c789b05bb9e8f6d6604826626b66df56d049 100755 (executable)
@@ -50,6 +50,13 @@ ath79_setup_interfaces()
                ucidef_set_interface_lan "eth0.1"
                ucidef_add_switch "switch0" "0@eth0" "1:lan"
                ;;
+       "tplink,tl-mr3220-v1"|\
+       "tplink,tl-mr3420-v1"|\
+       "tplink,tl-wr841-v7")
+               ucidef_set_interface_wan "eth0"
+               ucidef_add_switch "switch0" \
+                       "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
+               ;;
        "tplink,tl-wdr3600"|\
        "tplink,tl-wdr4300")
                ucidef_add_switch "switch0" \
index 7023fa5e587ccbb09ca9619b17ee81fc854b8529..37df2579fc4336473992ab254077f8d8b88b9680 100644 (file)
@@ -56,7 +56,10 @@ case "$FIRMWARE" in
                ;;
        "netgear,wnr612-v2"|\
        "on,n150r"|\
+       "tplink,tl-mr3220-v1"|\
+       "tplink,tl-mr3420-v1"|\
        "tplink,tl-wr740n-v2"|\
+       "tplink,tl-wr841-v7"|\
        "tplink,tl-wr2543-v1"|\
        "ubnt,unifi")
                ath9k_eeprom_extract "art" 4096 2048
diff --git a/target/linux/ath79/dts/ar7241_tl-mr3220-v1.dts b/target/linux/ath79/dts/ar7241_tl-mr3220-v1.dts
new file mode 100644 (file)
index 0000000..c970c25
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7241_tl-mr3x20.dtsi"
+
+/ {
+       compatible = "tplink,tl-mr3220-v1", "qca,ar7241";
+       model = "TP-Link TL-MR3220 v1";
+
+       ath9k-leds {
+               compatible = "gpio-leds";
+
+               wlan {
+                       label = "tp-link:green:wlan";
+                       gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+};
diff --git a/target/linux/ath79/dts/ar7241_tl-mr3420-v1.dts b/target/linux/ath79/dts/ar7241_tl-mr3420-v1.dts
new file mode 100644 (file)
index 0000000..e4c49f9
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7241_tl-mr3x20.dtsi"
+
+/ {
+       compatible = "tplink,tl-mr3420-v1", "qca,ar7241";
+       model = "TP-Link TL-MR3420 v1";
+
+       ath9k-leds {
+               compatible = "gpio-leds";
+
+               wlan {
+                       label = "tp-link:green:wlan";
+                       gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+};
diff --git a/target/linux/ath79/dts/ar7241_tl-mr3x20.dtsi b/target/linux/ath79/dts/ar7241_tl-mr3x20.dtsi
new file mode 100644 (file)
index 0000000..bd83cdb
--- /dev/null
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar7241_tp-link.dtsi"
+
+/ {
+       gpio-export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               gpio_usb_power {
+                       gpio-export,name = "tp-link:power:usb";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&gpio_leds {
+       led3g {
+               label = "tp-link:green:3g";
+               gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+               default-state = "off";
+               trigger-sources = <&hub_port>;
+               linux,default-trigger = "usbport";
+       };
+};
+
+&usb {
+       status = "okay";
+
+       hub_port: port@1 {
+               reg = <1>;
+               #trigger-source-cells = <0>;
+       };
+};
+
+&usb_phy {
+       status = "okay";
+};
diff --git a/target/linux/ath79/dts/ar7241_tl-wr841-v7.dts b/target/linux/ath79/dts/ar7241_tl-wr841-v7.dts
new file mode 100644 (file)
index 0000000..980809f
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7241_tp-link.dtsi"
+
+/ {
+       compatible = "tplink,tl-wr841-v7", "qca,ar7241";
+       model = "TP-LINK TL-WR841N/ND v7";
+
+       ath9k-leds {
+               compatible = "gpio-leds";
+
+               wlan {
+                       label = "tp-link:green:wlan";
+                       gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+};
diff --git a/target/linux/ath79/dts/ar7241_tp-link.dtsi b/target/linux/ath79/dts/ar7241_tp-link.dtsi
new file mode 100644 (file)
index 0000000..3846d81
--- /dev/null
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar7241.dtsi"
+
+/ {
+       aliases {
+               led-status = &led_system;
+       };
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               qss {
+                       label = "qss";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       gpio_leds: gpio-leds {
+               compatible = "gpio-leds";
+
+               led_system: system {
+                       label = "tp-link:green:system";
+                       gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+               };
+
+               qss {
+                       label = "tp-link:green:qss";
+                       gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&spi {
+       status = "okay";
+       num-cs = <1>;
+
+       flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <25000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       uboot: partition@0 {
+                               reg = <0x0 0x20000>;
+                               label = "u-boot";
+                               read-only;
+                       };
+
+                       partition@20000 {
+                               reg = <0x20000 0x3d0000>;
+                               label = "firmware";
+                       };
+
+                       partition@3f0000 {
+                               reg = <0x3f0000 0x10000>;
+                               label = "art";
+                               read-only;
+                       };
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+
+       ath9k: wifi@0 {
+               reg = <0x0000 0 0 0 0>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               qca,no-eeprom;
+               mtd-mac-address = <&uboot 0x1fc00>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&phy4>;
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       mtd-mac-address-increment = <(-1)>;
+};
+
+&eth1 {
+       status = "okay";
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       mtd-mac-address-increment = <1>;
+};
+
+&mdio0 {
+       status = "okay";
+
+       phy4: ethernet-phy@4 {
+               reg = <4>;
+               phy-mode = "mii";
+       };
+};
+
+&gpio {
+       status = "okay";
+};
+
+&uart {
+       status = "okay";
+};
index 1dfed48dbad4b182853d89374b6c144573ebdcd2..0004eb20188a2e707dd27bec716029d4a642a63d 100644 (file)
@@ -21,6 +21,26 @@ define Device/tl-mr3020-v1
 endef
 TARGET_DEVICES += tl-mr3020-v1
 
+define Device/tl-mr3220-v1
+  $(Device/tplink-4m)
+  ATH_SOC := ar7241
+  DEVICE_TITLE := TP-Link TL-MR3220 v1
+  TPLINK_HWID := 0x32200001
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+  SUPPORTED_DEVICES := tplink,tl-mr3220-v1 tl-mr3220-v1
+endef
+TARGET_DEVICES += tl-mr3220-v1
+
+define Device/tl-mr3420-v1
+  $(Device/tplink-4m)
+  ATH_SOC := ar7241
+  DEVICE_TITLE := TP-Link TL-MR3420 v1
+  TPLINK_HWID := 0x34200001
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+  SUPPORTED_DEVICES := tplink,tl-mr3420-v1 tl-mr3420-v1
+endef
+TARGET_DEVICES += tl-mr3420-v1
+
 define Device/tl-wr703n
   $(Device/tplink-4mlzma)
   ATH_SOC := ar9331
@@ -39,3 +59,12 @@ define Device/tl-wr740n-v2
   SUPPORTED_DEVICES := tplink,tl-wr740n-v2 tl-wr740n-v2
 endef
 TARGET_DEVICES += tl-wr740n-v2
+
+define Device/tl-wr841-v7
+  $(Device/tplink-4m)
+  ATH_SOC := ar7241
+  DEVICE_TITLE := TP-LINK TL-WR841N/ND v7
+  TPLINK_HWID := 0x08410007
+  SUPPORTED_DEVICES := tplink,tl-wr841-v7 tl-wr841-v7
+endef
+TARGET_DEVICES += tl-wr841-v7