From 8e384ba8307742b54b2be326697a5dc2dec6880b Mon Sep 17 00:00:00 2001 From: Pramod Pancha Date: Fri, 5 Jul 2019 13:45:19 -0400 Subject: ath79: add support for Trendnet TEW-823DRU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trendnet TEW-823DRU is a dual-band AC1750 router. The router is based on Qualcomm/Atheros QCA9558 + QCA9880. Specification: 720 MHz CPU 256 MB of RAM 16 MB of FLASH 3T3R 2.4 GHz 3T3R 5 GHz 5x 10/100/1000 Mbps Ethernet Firmware can be flashed from the web interface. Tested on 3 routers with no issues. Signed-off-by: Pramod Pancha [whitespace fixes] Signed-off-by: Petr Štetiar --- target/linux/ath79/base-files/etc/board.d/01_leds | 3 + .../linux/ath79/base-files/etc/board.d/02_network | 7 +- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 8 + .../ath79/dts/qca9558_trendnet_tew-823dru.dts | 216 +++++++++++++++++++++ target/linux/ath79/image/generic.mk | 16 ++ 5 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts (limited to 'target/linux/ath79') diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds index 054863b1ba..238dda18f6 100755 --- a/target/linux/ath79/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/base-files/etc/board.d/01_leds @@ -193,6 +193,9 @@ tplink,tl-wr842n-v2) ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10" ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02" ;; +trendnet,tew-823dru) + ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0" + ;; ubnt,bullet-m|\ ubnt,bullet-m-xw|\ ubnt,nanostation-m|\ diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index 029aadc3eb..2413b1f4bc 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -64,7 +64,8 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" ;; - buffalo,bhr-4grv2) + buffalo,bhr-4grv2|\ + trendnet,tew-823dru) ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0" ;; @@ -363,6 +364,10 @@ ath79_setup_macs() base_mac=$(mtd_get_mac_binary u-boot 130048) wan_mac=$(macaddr_add "$base_mac" 1) ;; + trendnet,tew-823dru) + lan_mac=$(mtd_get_mac_text mac 4) + wan_mac=$(mtd_get_mac_text mac 24) + ;; ubnt,routerstation|\ ubnt,routerstation-pro) wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa) diff --git a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index bf3e14aa9c..d9c3fe7440 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -34,6 +34,14 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ k2t_get_mac "lan_mac" > /sys${DEVPATH}/macaddress ;; + trendnet,tew-823dru) + # set the 2.4G interface mac address to LAN MAC + [ "$PHYNBR" -eq 1 ] && \ + mtd_get_mac_text mac 4 > /sys${DEVPATH}/macaddress + # set the 5G interface mac address to WAN MAC + 1 + [ "$PHYNBR" -eq 0 ] && \ + macaddr_add "$(mtd_get_mac_text mac 24)" 1 > /sys${DEVPATH}/macaddress + ;; *) ;; esac diff --git a/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts new file mode 100644 index 0000000000..ca9847fab9 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_trendnet_tew-823dru.dts @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "qca9557.dtsi" + +/ { + compatible = "trendnet,tew-823dru", "qca,qca9558"; + model = "TRENDNET TEW-823DRU"; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + aliases { + led-boot = &system; + led-failsafe = &system; + led-running = &system; + led-upgrade = &system; + }; + + leds { + compatible = "gpio-leds"; + + power_orange { + label = "trendnet:orange:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + system: power_green { + label = "trendnet:green:power"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + planet_green { + label = "trendnet:green:planet"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + planet_orange { + label = "trendnet:orange:planet"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "WPS button"; + linux,code = ; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + +}; + +&pcie0 { + status = "okay"; +}; + +&pcie1 { + status = "okay"; +}; + +&uart { + status = "okay"; +}; + +&gpio { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + hub_port0: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&usb_phy1 { + status = "okay"; +}; + +&usb1 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + hub_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&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 0x030000>; + read-only; + }; + + partition@30000 { + label = "nvram"; + reg = <0x030000 0x010000>; + read-only; + }; + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0xef0000>; + }; + + partition@f30000 { + label = "lang"; + reg = <0xf30000 0x030000>; + read-only; + }; + + partition@f60000 { + label = "my-dlink"; + reg = <0xf60000 0x080000>; + read-only; + }; + + mac: partition@fe0000 { + label = "mac"; + reg = <0xfe0000 0x010000>; + read-only; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 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 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6 STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; + pll-data = <0x56000000 0x00000101 0x00001616>; + + gmac-config { + device = <&gmac>; + rgmii-enabled = <1>; + }; +}; + +ð1 { + status = "okay"; + + pll-data = <0x03000101 0x00000101 0x00001616>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; +}; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 3c679fb480..51adedd6ce 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -775,6 +775,22 @@ define Device/rosinson_wr818 endef TARGET_DEVICES += rosinson_wr818 +define Device/trendnet_tew-823dru + ATH_SOC := qca9558 + DEVICE_VENDOR := Trendnet + DEVICE_MODEL := TEW-823DRU + DEVICE_VARIANT := v1.0R + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct + SUPPORTED_DEVICES += tew-823dru + IMAGE_SIZE := 15296k + IMAGES := factory.bin sysupgrade.bin + IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs + IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ + append-string 00AP135AR9558-RT-131129-00 | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += trendnet_tew-823dru + define Device/wd_mynet-n750 $(Device/seama) ATH_SOC := ar9344 -- cgit v1.2.3