Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ath79: preliminary support for TP-Link WDR3600 / WDR4300 (AR9344) #964

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions target/linux/ath79/base-files/etc/board.d/02_network
Expand Up @@ -13,6 +13,12 @@ ath79_setup_interfaces()
ucidef_set_interface_lan "eth0"
;;

"tplink,tl-wdr3600"|\
"tplink,tl-wdr4300")
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
;;

"tplink,tl-wr1043nd-v1")
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
Expand Down
4 changes: 3 additions & 1 deletion target/linux/ath79/base-files/etc/diag.sh
Expand Up @@ -2,6 +2,8 @@

. /lib/functions/leds.sh

status_led="$(get_dt_led status)"

get_status_led() {
local board=$(board_name)
local boardname="${board##*,}"
Expand All @@ -23,7 +25,7 @@ get_status_led() {
}

set_state() {
get_status_led
[ -z "$status_led" ] && get_status_led

case "$1" in
preinit)
Expand Down
Expand Up @@ -50,6 +50,10 @@ case "$FIRMWARE" in
"avm,fritz300e")
ath9k_eeprom_extract_reverse "urloader" 5441 1088
;;
"tplink,tl-wdr3600"|\
"tplink,tl-wdr4300")
ath9k_eeprom_extract "art" 20480 1088
;;
"ubnt,unifi")
ath9k_eeprom_extract "art" 4096 2048
;;
Expand Down
32 changes: 32 additions & 0 deletions target/linux/ath79/dts/ar9344.dtsi
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "ar934x.dtsi"

/ {
compatible = "qca,ar9344";
};

&apb {
pcie: pcie-controller@180c0000 {
compatible = "qcom,ar9340-pci", "qcom,ar7240-pci";
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x0 0x0>;
reg = <0x180c0000 0x1000>, /* CRP */
<0x180f0000 0x100>, /* CTRL */
<0x14000000 0x1000>; /* CFG */
reg-names = "crp_base", "ctrl_base", "cfg_base";
ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 /* pci memory */
0x1000000 0 0x00000000 0x0000000 0 0x000001>; /* io space */
interrupt-parent = <&cpuintc>;
interrupts = <2>;

interrupt-controller;
#interrupt-cells = <1>;

interrupt-map-mask = <0 0 0 1>;
interrupt-map = <0 0 0 0 &pcie 0>;

status = "disabled";
};
};
9 changes: 9 additions & 0 deletions target/linux/ath79/dts/ar9344_tl-wdr3600.dts
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "ar9344_tl-wdr4300.dtsi"

/ {
model = "TP-Link WDR3600";
compatible = "tplink,tl-wdr3600";
};
9 changes: 9 additions & 0 deletions target/linux/ath79/dts/ar9344_tl-wdr4300.dts
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "ar9344_tl-wdr4300.dtsi"

/ {
model = "TP-Link WDR4300";
compatible = "tplink,tl-wdr4300";
};
240 changes: 240 additions & 0 deletions target/linux/ath79/dts/ar9344_tl-wdr4300.dtsi
@@ -0,0 +1,240 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

#include "ar9344.dtsi"

/ {
model = "TP-Link WDR4300";
compatible = "tplink,tl-wdr4300";

aliases {
led-status = &system;
};

memory@0 {
device_type = "memory";
reg = <0x0 0x8000000>;
};

leds {
compatible = "gpio-leds";

usb1 {
label = "tp-link:green:usb1";
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
default-state = "off";
trigger-sources = <&hub_port1>;
linux,default-trigger = "usbport";
};

usb2 {
label = "tp-link:green:usb2";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
default-state = "off";
trigger-sources = <&hub_port2>;
linux,default-trigger = "usbport";
};

wlan2g {
label = "tp-link:green:wlan2g";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
default-state = "off";
linux,default-trigger = "phy0tpt";
};

system: system {
label = "tp-link:green:system";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
default-state = "on";
};

qss {
label = "tp-link:green:qss";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
default-state = "off";
};
};

ath9k-leds {
compatible = "gpio-leds";

wlan5g {
label = "tp-link:green:wlan5g";
gpios = <&ath9k 0 GPIO_ACTIVE_LOW>;
default-state = "off";
linux,default-trigger = "phy1tpt";
};
};

keys {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;

button@0 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};

button@1 {
label = "wifi";
linux,code = <KEY_RFKILL>;
linux,input-type = <EV_SW>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};

gpio-export {
compatible = "gpio-export";
#size-cells = <0>;

gpio_usb1_power {
gpio-export,name = "tp-link:power:usb1";
gpio-export,output = <1>;
gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
};

gpio_usb2_power {
gpio-export,name = "tp-link:power:usb2";
gpio-export,output = <1>;
gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
};

gpio_ext_lna0 {
gpio-export,name = "tp-link:ext:lna0";
gpio-export,output = <1>;
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
};

gpio_ext_lna1 {
gpio-export,name = "tp-link:ext:lna1";
gpio-export,output = <1>;
gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
};
};
};

&ref {
clock-frequency = <40000000>;
};

&uart {
status = "okay";
};

&gpio {
status = "okay";
};

&spi {
num-cs = <1>;

status = "okay";

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>;
};

partition@7f0000 {
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
};
};
};
};

&usb {
status = "okay";

port@1 {
reg = <1>;
#trigger-source-cells = <0>;

hub_port1: port@1 {
reg = <1>;
#trigger-source-cells = <0>;
};

hub_port2: port@2 {
reg = <2>;
#trigger-source-cells = <0>;
};
};
};

&usb_phy {
status = "okay";
};

&pcie {
status = "okay";

ath9k: wifi@168c,0033 {
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
mtd-mac-address = <&uboot 0x1fc00>;
qca,no-eeprom;
#gpio-cells = <2>;
gpio-controller;
};
};

&mdio0 {
status = "okay";

phy-mask = <0>;

phy0: ethernet-phy@0 {
reg = <0>;
phy-mode = "rgmii";

qca,ar8327-initvals = <
0x04 0x07600000 /* PORT0 PAD MODE CTRL */
0x10 0x80000080 /* POWER_ON_STRIP */
0x50 0xc737c737 /* LED_CTRL0 */
0x54 0x00000000 /* LED_CTRL1 */
0x58 0x00000000 /* LED_CTRL2 */
0x5c 0x0030c300 /* LED_CTRL3 */
0x7c 0x0000007e /* PORT0_STATUS */
>;
};
};

&eth0 {
status = "okay";

/* default for ar934x, except for 1000M */
pll-data = <0x06000000 0x00000101 0x00001616>;

mtd-mac-address = <&uboot 0x1fc00>;
mtd-mac-address-increment = <(-2)>;

phy-mode = "rgmii";
phy-handle = <&phy0>;
};