ath79: add support for tl-wr1043nd v2/v3
authorLucian Cristian <lucian.cristian@gmail.com>
Mon, 18 Jun 2018 17:22:13 +0000 (19:22 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 18 Jun 2018 18:29:38 +0000 (20:29 +0200)
Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
target/linux/ath79/base-files/etc/board.d/02_network
target/linux/ath79/dts/qca9557.dtsi
target/linux/ath79/dts/qca9558_tl-wr1043nd-v2.dts [new file with mode: 0644]
target/linux/ath79/dts/qca9558_tl-wr1043nd-v3.dts [new file with mode: 0644]
target/linux/ath79/dts/qca9558_tl-wr1043nd.dtsi [new file with mode: 0644]
target/linux/ath79/image/generic-tp-link.mk

index bfea621c1256b8b5dff773e50bc1fb3b1f6f48b7..f734518f69778af537db7612cf72d7a8dc2c792a 100755 (executable)
@@ -57,6 +57,12 @@ ath79_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
                ;;
+       "tplink,tl-wr1043nd-v2"|\
+       "tplink,tl-wr1043nd-v3")
+               ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
+               ucidef_add_switch "switch0" \
+                       "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
+               ;;
        "netgear,wndr3800")
                ucidef_set_interfaces_lan_wan "eth0" "eth1"
                ucidef_add_switch "switch0" \
index 60585523724d9b6e9ba92009fd4d5b64e73fb19c..3600d69cab417e40162b2aea96d64a2408505a01 100644 (file)
 
                cpu@0 {
                        device_type = "cpu";
-                       compatible = "mips,mips24Kc";
+                       compatible = "mips,mips74Kc";
                        clocks = <&pll ATH79_CLK_CPU>;
                        reg = <0>;
                };
        };
 
+       extosc: ref {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-output-names = "ref";
+               clock-frequency = <40000000>;
+       };
+
        ahb {
                apb {
                        ddr_ctrl: memory-controller@18000000 {
                                status = "disabled";
                        };
 
+                       usb_phy0: usb-phy@18030000 {
+                               compatible ="qca,qca9550-usb-phy", "qca,ar7200-usb-phy";
+
+                               reset-names = "usb-phy", "usb-suspend-override";
+                               resets = <&rst 4>, <&rst 3>;
+
+                               #phy-cells = <0>;
+
+                               status = "disabled";
+                       };
+
+                       usb_phy1: usb-phy {
+                               compatible = "qca,qca9550-usb-phy", "qca,ar7200-usb-phy";
+
+                               reset-names = "usb-phy", "usb-suspend-override";
+                               resets = <&rst2 4>, <&rst2 3>;
+
+                               #phy-cells = <0>;
+
+                               status = "disabled";
+                       };
+
                        gpio: gpio@18040000 {
                                compatible = "qca,ar9557-gpio",
                                                "qca,ar9340-gpio";
                        pll: pll-controller@18050000 {
                                compatible = "qca,ar9557-pll",
                                                "qca,qca9550-pll";
-                               reg = <0x18050000 0x20>;
+                               reg = <0x18050000 0x50>;
 
                                #clock-cells = <1>;
                                clock-output-names = "cpu", "ddr", "ahb";
+
+                               clocks = <&extosc>;
                        };
 
                        wdt: wdt@18060008 {
                        };
 
                        rst: reset-controller@1806001c {
-                               compatible = "qca,ar9557-reset",
+                               compatible = "qca,qca9550-reset",
                                                "qca,ar7100-reset",
                                                 "simple-bus";
                                reg = <0x1806001c 0x4>;
                                #reset-cells = <1>;
                                interrupt-parent = <&cpuintc>;
 
-                               intc2: interrupt-controller@2 {
-                                       compatible = "qcom,qca9556-intc";
-
-                                       interrupts = <2>;
-
-                                       interrupt-controller;
-                                       #interrupt-cells = <1>;
-
-                                       qcom,pending-bits = <0x1f0>,    /* pcie rc1 */
-                                                           <0xf>;      /* wmac */
-                               };
-
                                intc3: interrupt-controller@3 {
                                        compatible = "qcom,qca9556-intc";
 
                                        interrupt-controller;
                                        #interrupt-cells = <1>;
 
-                                       qcom,pending-bits = <0x1f000>,          /* pcie rc2 */
+                                       qcom,pending-bits = <0x1f000>,          /* pcie rc */
                                                            <0x1000000>,        /* usb1 */
                                                            <0x10000000>;       /* usb2 */
                                };
                        };
 
-                       pcie0: pcie-controller@180c0000 {
+                       rst2: reset-controller@180600c0 {
+                               compatible = "qca,qca9550-reset",
+                                               "qca,ar7100-reset",
+                                                "simple-bus";
+                               reg = <0x180600c0 0x4>;
+
+                               #reset-cells = <1>;
+                       };
+
+                       pcie: pcie-controller@18250000 {
                                compatible = "qcom,ar7240-pci";
                                #address-cells = <3>;
                                #size-cells = <2>;
                                bus-range = <0x0 0x0>;
-                               reg = <0x180c0000 0x1000>, /* CRP */
-                                     <0x180f0000 0x100>,  /* CTRL */
-                                     <0x14000000 0x1000>; /* CFG */
+                               reg = <0x18250000 0x1000>, /* CRP */
+                                     <0x18280000 0x100>,  /* CTRL */
+                                     <0x16000000 0x1000>; /* CFG */
                                reg-names = "crp_base", "ctrl_base", "cfg_base";
-                               ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000        /* pci memory */
+                               ranges = <0x2000000 0 0x12000000 0x12000000 0 0x02000000        /* pci memory */
                                          0x1000000 0 0x00000000 0x0000000 0 0x000001>;         /* io space */
-                               interrupt-parent = <&intc2>;
+                               interrupt-parent = <&intc3>;
                                interrupts = <0>;
 
                                interrupt-controller;
                                #interrupt-cells = <1>;
 
                                interrupt-map-mask = <0 0 0 1>;
-                               interrupt-map = <0 0 0 0 &pcie0 0>;
+                               interrupt-map = <0 0 0 0 &pcie 0>;
+                               status = "disabled";
+                       };
+
+                       wmac: wmac@18100000 {
+                               compatible = "qca,qca9550-wmac";
+                               reg = <0x18100000 0x10000>;
+
+                               interrupt-parent = <&cpuintc>;
+                               interrupts = <2>;
+
                                status = "disabled";
                        };
                };
 
+               usb0: usb@1b000000 {
+                       compatible = "generic-ehci";
+                       reg = <0x1b000000 0x1fc>;
+
+                       interrupt-parent = <&intc3>;
+                       interrupts = <1>;
+                       resets = <&rst 5>;
+                       reset-names = "usb-host";
+
+                       has-transaction-translator;
+                       caps-offset = <0x100>;
+
+                       phy-names = "usb-phy0";
+                       phys = <&usb_phy0>;
+
+                       status = "disabled";
+               };
+
+               usb1: usb@1b400000 {
+                       compatible = "generic-ehci";
+                       reg = <0x1b400000 0x1fc>;
+
+                       interrupt-parent = <&intc3>;
+                       interrupts = <2>;
+                       resets = <&rst2 5>;
+                       reset-names = "usb-host";
+
+                       has-transaction-translator;
+                       caps-offset = <0x100>;
+
+                       phy-names = "usb-phy1";
+                       phys = <&usb_phy1>;
+
+                       status = "disabled";
+       };
+
                spi: spi@1f000000 {
                        compatible = "qca,ar9557-spi", "qca,ar7100-spi";
                        reg = <0x1f000000 0x10>;
diff --git a/target/linux/ath79/dts/qca9558_tl-wr1043nd-v2.dts b/target/linux/ath79/dts/qca9558_tl-wr1043nd-v2.dts
new file mode 100644 (file)
index 0000000..0cfc486
--- /dev/null
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "qca9558_tl-wr1043nd.dtsi"
+
+/ {
+       compatible = "tplink,tl-wr1043nd-v2", "qca,qca9557";
+       model = "TP-Link TL-WR1043ND Version 2";
+};
diff --git a/target/linux/ath79/dts/qca9558_tl-wr1043nd-v3.dts b/target/linux/ath79/dts/qca9558_tl-wr1043nd-v3.dts
new file mode 100644 (file)
index 0000000..c411298
--- /dev/null
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "qca9558_tl-wr1043nd.dtsi"
+
+/ {
+       compatible = "tplink,tl-wr1043nd-v3", "qca,qca9557";
+       model = "TP-Link TL-WR1043ND Version 3";
+};
diff --git a/target/linux/ath79/dts/qca9558_tl-wr1043nd.dtsi b/target/linux/ath79/dts/qca9558_tl-wr1043nd.dtsi
new file mode 100644 (file)
index 0000000..1abee23
--- /dev/null
@@ -0,0 +1,194 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "qca9557.dtsi"
+
+/ {
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x4000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+       };
+
+       aliases {
+               led-status = &system;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               system: system {
+                       label = "tp-link:green:system";
+                       gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+
+               usb {
+                       label = "tp-link:green:usb";
+                       gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       trigger-sources = <&hub_port0>;
+                       linux,default-trigger = "usbport";
+               };
+
+               wifi_green {
+                       label = "tp-link:green:wlan";
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               wifi_wps {
+                       label = "tp-link:green:wps";
+                       gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reset {
+                       label = "Reset button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               wifi {
+                       label = "RFKILL button";
+                       linux,code = <KEY_RFKILL>;
+                       gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               gpio_usb_power {
+                       gpio-export,name = "tp-link:power:usb";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&uart {
+       status = "okay";
+};
+
+&gpio {
+       status = "okay";
+};
+
+&usb_phy0 {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+
+       hub_port0: port@1 {
+               reg = <1>;
+               #trigger-source-cells = <0>;
+       };
+};
+
+&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 {
+                               label = "u-boot";
+                               reg = <0x000000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@20000 {
+                               label = "firmware";
+                               reg = <0x020000 0x7d0000>;
+                       };
+
+                       art: partition@7f0000 {
+                               label = "art";
+                               reg = <0x7f0000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&mdio0 {
+       status = "okay";
+
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+               qca,ar8327-initvals = <
+                   0x04 0x00080080 /* PORT0 PAD MODE CTRL */
+                   0x0c 0x07600000 /* PORT6 PAD MODE CTRL */
+                   0x10 0x81000080 /* POWER_ON_STRIP */
+                   0x50 0xcc35cc35 /* LED_CTRL0 */
+                   0x54 0xca35ca35 /* LED_CTRL1 */
+                   0x58 0xc935c935 /* LED_CTRL2 */
+                   0x5c 0x03ffff00 /* LED_CTRL3 */
+                   0x7c 0x0000007e /* PORT0_STATUS */
+                   0x94 0x0000007e /* PORT6 STATUS */
+               >;
+       };
+};
+
+&mdio1 {
+       status = "okay";
+
+       phy1: ethernet-phy@1 {
+               reg = <1>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       mtd-mac-address-increment = <1>;
+       phy-handle = <&phy0>;
+};
+
+&eth1 {
+       status = "okay";
+
+       mtd-mac-address = <&uboot 0x1fc00>;
+       phy-handle = <&phy1>;
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+};
+
+&wmac {
+       status = "okay";
+       mtd-cal-data = <&art 0x1000>;
+       mtd-mac-address = <&uboot 0x1fc00>;
+};
index c9469708181b0c119557cd2abee210f2a20b6785..467e2c4c42c54db9cae587f8ecb087ba29a91969 100644 (file)
@@ -28,6 +28,26 @@ define Device/tl-wr1043nd-v1
 endef
 TARGET_DEVICES += tl-wr1043nd-v1
 
+define Device/tl-wr1043nd-v2
+  $(Device/tplink-8mlzma)
+  ATH_SOC := qca9558
+  DEVICE_TITLE := TP-LINK TL-WR1043N/ND v2
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x10430002
+  SUPPORTED_DEVICES := tplink,tl-wr1043nd-v2 tl-wr1043nd-v2
+endef
+TARGET_DEVICES += tl-wr1043nd-v2
+
+define Device/tl-wr1043nd-v3
+  $(Device/tplink-8mlzma)
+  ATH_SOC := qca9558
+  DEVICE_TITLE := TP-LINK TL-WR1043N/ND v3
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
+  TPLINK_HWID := 0x10430003
+  SUPPORTED_DEVICES := tplink,tl-wr1043nd-v3 tl-wr1043nd-v3
+endef
+TARGET_DEVICES += tl-wr1043nd-v3
+
 define Device/tl-wr1043nd-v4
   $(Device/tplink)
   ATH_SOC := qca9563