ath79: add support for WD My Net N750
authorRyan Mounce <ryan@mounce.com.au>
Sat, 25 May 2019 12:36:05 +0000 (22:06 +0930)
committerPetr Štetiar <ynezz@true.cz>
Mon, 27 May 2019 20:44:08 +0000 (22:44 +0200)
SoC: AR9344
RAM: 128MB
Flash: 16MiB Winbond 25Q128BVFG SPI NOR
5GHz WiFi: AR9380 PCIe 3x3:3 802.11n
2.4GHz WiFi: AR9344 (SoC) AHB 2x2:2 802.11n

5x Gigabit ethernet via AR8327N switch (green + amber LEDs)
2x USB 2.0 via GL850G hub
4x front LEDs from SoC GPIO
1x front WPS button from SoC GPIO
1x bottom reset button from SoC GPIO

Known issues:
AR8327N LEDs only have default functionality, not presented in sysfs.
This is a regression from ar71xx.

UART header JP1, 115200 no parity 1 stop
TX
GND
VCC
(N/P)
RX

See https://openwrt.org/toh/wd/n750 for flashing detail.
Procedures unchanged from ar71xx.

Tested sysupgrade + factory flash from WD Emergency Recovery

Signed-off-by: Ryan Mounce <ryan@mounce.com.au>
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/base-files/etc/uci-defaults/04_led_migration
target/linux/ath79/dts/ar9344_wd_mynet-n750.dts [new file with mode: 0644]
target/linux/ath79/image/generic.mk

index 7b89274ccf296e11d38cf20c9a06f8f4cc56439a..c2e994530d6a8959f7c8f5a999a0443fee4458ec 100755 (executable)
@@ -126,7 +126,8 @@ ath79_setup_interfaces()
        iodata,wn-ac1600dgr|\
        iodata,wn-ac1600dgr2|\
        iodata,wn-ag300dgr|\
-       pcs,cr5000)
+       pcs,cr5000|\
+       wd,mynet-n750)
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
        ;;
@@ -290,7 +291,8 @@ ath79_setup_macs()
                wan_mac=$(mtd_get_mac_text "mac" 24)
                ;;
        dlink,dir-859-a1|\
-       nec,wg1200cr)
+       nec,wg1200cr|\
+       wd,mynet-n750)
                lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
                wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
                ;;
index 3321f28bcc05cbba4c7470ee133dc182b7ec4746..ce4df2521b317ea51549697ed866cbb95fb79c82 100644 (file)
@@ -105,7 +105,9 @@ case "$FIRMWARE" in
                ath9k_eeprom_extract "art" 4096 1088
                ath9k_patch_fw_mac_crc $(mtd_get_mac_text "mac" 4) 2
                ;;
-       dlink,dir-859-a1)
+       dlink,dir-859-a1|\
+       nec,wg1200cr|\
+       wd,mynet-n750)
                ath9k_eeprom_extract "art" 4096 1088
                ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 2
                ;;
@@ -121,10 +123,6 @@ case "$FIRMWARE" in
                ath9k_eeprom_extract "art" 4096 1088
                ath9k_patch_fw_mac $(mtd_get_mac_ascii u-boot-env ethaddr) 2
                ;;
-       nec,wg1200cr)
-               ath9k_eeprom_extract "art" 4096 1088
-               ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata wlan24mac) 2
-               ;;
        nec,wg800hp)
                ath9k_eeprom_extract "art" 4096 1088
                ath9k_patch_fw_mac $(mtd_get_mac_text board_data 1664) 2
@@ -184,6 +182,10 @@ case "$FIRMWARE" in
        ubnt,unifi)
                ath9k_eeprom_extract "art" 4096 2048
                ;;
+       wd,mynet-n750)
+               ath9k_eeprom_extract "art" 20480 1088
+               ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan5mac") 2
+               ;;
        wd,mynet-wifi-rangeextender)
                ath9k_eeprom_extract "art" 4096 4096
                ath9k_patch_fw_mac_crc $(nvram get wl0_hwaddr) "$mac" 2
index d9c61f8103487f34c28128e81c079331f1d5b7b4..fe4a9c3cc06df51e1ec4988cd9347ed59b3e9cd9 100644 (file)
@@ -12,6 +12,9 @@ engenius,epg5000)
 tplink,archer-c7-v5)
        migrate_leds "archer-c7-v5:=tp-link:"
        ;;
+wd,mynet-n750)
+       migrate_leds "wd:=mynet-n750:"
+       ;;
 esac
 
 migrations_apply system
diff --git a/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts b/target/linux/ath79/dts/ar9344_wd_mynet-n750.dts
new file mode 100644 (file)
index 0000000..a9f7e6e
--- /dev/null
@@ -0,0 +1,216 @@
+// 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 "ar9344.dtsi"
+
+/ {
+       model = "Western Digital My Net N750";
+       compatible = "wd,mynet-n750", "qca,ar9344";
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8";
+       };
+
+       aliases {
+               led-boot = &power;
+               led-failsafe = &power;
+               led-running = &power;
+               led-upgrade = &power;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               wifi {
+                       label = "mynet-n750:blue:wireless";
+                       gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+               };
+
+               internet {
+                       label = "mynet-n750:blue:internet";
+                       gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+               };
+
+               wps {
+                       label = "mynet-n750:blue:wps";
+                       gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+               };
+
+               power: power {
+                       label = "mynet-n750:blue:power";
+                       gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+               };
+
+               wps {
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&ref {
+       clock-frequency = <40000000>;
+};
+
+&uart {
+       status = "okay";
+};
+
+&gpio {
+       status = "okay";
+
+       gpio_ext_lna0 {
+               gpio-hog;
+               gpios = <15 0>;
+               output-high;
+               line-name = "mynet-n750:ext:lna0";
+       };
+
+       gpio_ext_lna1 {
+               gpio-hog;
+               gpios = <18 0>;
+               output-high;
+               line-name = "mynet-n750:ext:lna1";
+       };
+};
+
+&spi {
+       num-cs = <1>;
+
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <25000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "bootloader";
+                               reg = <0x000000 0x40000>;
+                               read-only;
+                       };
+
+                       partition@40000 {
+                               label = "bdcfg";
+                               reg = <0x040000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@50000 {
+                               label = "devdata";
+                               reg = <0x050000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@60000 {
+                               label = "devconf";
+                               reg = <0x060000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@70000 {
+                               compatible = "seama";
+                               label = "firmware";
+                               reg = <0x070000 0xf80000>;
+                       };
+
+                       art: partition@ff0000 {
+                               label = "art";
+                               reg = <0xff0000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&usb {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+
+       port@1 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               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";
+
+       wifi@0,0 {
+               compatible = "pci168c,0033";
+               reg = <0x0000 0 0 0 0>;
+               qca,no-eeprom;
+       };
+};
+
+&wmac {
+       status = "okay";
+       qca,no-eeprom;
+};
+
+&mdio0 {
+       status = "okay";
+       phy-mask = <0>;
+
+       switch0@1f {
+               compatible = "qca,ar8327";
+               reg = <0x1f>;
+
+               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>;
+
+       phy-mode = "rgmii";
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+};
index b8558a59f0cc6f737d3b8b7597e86992661bfb14..1585379f837f44cebf8c866daf5be840f2791d78 100644 (file)
@@ -655,6 +655,17 @@ define Device/rosinson_wr818
 endef
 TARGET_DEVICES += rosinson_wr818
 
+define Device/wd_mynet-n750
+  $(Device/seama)
+  ATH_SOC := ar9344
+  DEVICE_TITLE := Western Digital My Net N750
+  IMAGE_SIZE := 15872k
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+  SEAMA_SIGNATURE := wrgnd13_wd_av
+  SUPPORTED_DEVICES += mynet-n750
+endef
+TARGET_DEVICES += wd_mynet-n750
+
 define Device/wd_mynet-wifi-rangeextender
   ATH_SOC := ar9344
   DEVICE_TITLE := Western Digital My Net Wi-Fi Range Extender