ath79: add support for D-Link DIR-859 A3
authorShiji Yang <yangshiji66@qq.com>
Fri, 5 May 2023 01:50:36 +0000 (01:50 +0000)
committerChristian Lamparter <chunkeey@gmail.com>
Mon, 22 May 2023 12:45:03 +0000 (14:45 +0200)
Specifications:
  SOC:      QCA9563 775 MHz + QCA9880
  Switch:   QCA8337N-AL3C
  RAM:      Winbond W9751G6KB-25 64 MiB
  Flash:    Winbond W25Q128FVSG 16 MiB
  WLAN:     Wi-Fi4 2.4 GHz 3*3 + 5 GHz 3*3
  LAN:      LAN ports *4
  WAN:      WAN port *1
  Buttons:  reset *1 + wps *1
  LEDs: ethernet *5, power, wlan, wps

MAC Address:
  use      address               source1          source2
  label    40:9b:xx:xx:xx:3c     lan && wlan      u-boot,env@ethaddr
  lan      40:9b:xx:xx:xx:3c     devdata@0x3f     $label
  wan      40:9b:xx:xx:xx:3f     devdata@0x8f     $label + 3
  wlan2g   40:9b:xx:xx:xx:3c     devdata@0x5b     $label
  wlan5g   40:9b:xx:xx:xx:3e     devdata@0x76     $label + 2

Install via Web UI:
  Apply factory image in the stock firmware's Web UI.

Install via Emergency Room Mode:
  DIR-859 A1 will enter recovery mode when the system fails to boot
  or press reset button for about 10 seconds.

  First, set computer IP to 192.168.0.5 and Gateway to 192.168.0.1.
  Then we can open http://192.168.0.1 in the web browser to upload
  OpenWrt factory image or stock firmware. Some modern browsers may
  need to turn on compatibility mode.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
package/boot/uboot-envtools/files/ath79
target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts [new file with mode: 0644]
target/linux/ath79/dts/qca9563_dlink_dir-8x9-a1.dtsi
target/linux/ath79/generic/base-files/etc/board.d/01_leds
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum
target/linux/ath79/image/generic.mk

index 38fc663e70917eb8ea7b28f1049a97933690645d..7c30aa052a6b39da4432752391fc2dbfc260eea2 100644 (file)
@@ -28,6 +28,7 @@ arduino,yun|\
 buffalo,bhr-4grv2|\
 devolo,magic-2-wifi|\
 dlink,dir-859-a1|\
+dlink,dir-859-a3|\
 dlink,dir-869-a1|\
 engenius,eap1200h|\
 engenius,eap1750h|\
diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts b/target/linux/ath79/dts/qca9563_dlink_dir-859-a3.dts
new file mode 100644 (file)
index 0000000..164e080
--- /dev/null
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca9563_dlink_dir-8x9-a1.dtsi"
+
+#include <dt-bindings/leds/common.h>
+
+/ {
+       compatible = "dlink,dir-859-a3", "qca,qca9563";
+       model = "D-Link DIR-859 A3";
+
+       aliases {
+               label-mac-device = &wmac;
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       label = "green:power";
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_POWER;
+                       gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+               };
+
+               wan {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WAN;
+                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WLAN;
+                       gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               wps {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WPS;
+                       gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&ath10k {
+       nvmem-cells = <&calibration_ath10k>, <&macaddr_bdcfg_ethaddr 2>;
+       nvmem-cell-names = "calibration", "mac-address";
+};
+
+&bdcfg {
+       macaddr_bdcfg_ethaddr: ethaddr {
+               #nvmem-cell-cells = <1>;
+       };
+};
+
+&wmac {
+       nvmem-cells = <&calibration_ath9k>, <&macaddr_bdcfg_ethaddr 0>;
+       nvmem-cell-names = "calibration", "mac-address";
+};
index 754fcd415d9789dc5fba7a45e5dbdf49b006aafe..3fd9790c4a23828b90f65b9398968da1b2b4ae76 100644 (file)
@@ -28,7 +28,7 @@
 &pcie {
        status = "okay";
 
-       wifi@0,0 {
+       ath10k: wifi@0,0 {
                compatible = "qcom,ath10k";
                reg = <0x0000 0 0 0 0>;
 
@@ -56,7 +56,7 @@
                                read-only;
                        };
 
-                       partition@40000 {
+                       bdcfg: partition@40000 {
                                compatible = "u-boot,env";
                                label = "bdcfg";
                                reg = <0x040000 0x010000>;
index d3508049baa9ab3371c965032037e24e671843ac..2ee4ed2544d97d5b27bf8135c8fdce27d5adc26a 100644 (file)
@@ -234,6 +234,9 @@ dlink,dap-1365-a1)
 dlink,dir-859-a1)
        ucidef_set_led_switch "internet" "WAN" "green:internet" "switch0" "0x20"
        ;;
+dlink,dir-859-a3)
+       ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20"
+       ;;
 engenius,ens202ext-v1|\
 engenius,enstationac-v1)
        ucidef_set_rssimon "wlan0" "200000" "1"
index 487467cd598d9b965db5b443a658deff217d072a..4f535f8a648e6c3e51cf6f22f358754355b8a6ec 100644 (file)
@@ -291,6 +291,7 @@ ath79_setup_interfaces()
        dlink,dir-842-c2|\
        dlink,dir-842-c3|\
        dlink,dir-859-a1|\
+       dlink,dir-859-a3|\
        dlink,dir-869-a1|\
        engenius,epg5000|\
        engenius,esr1200|\
@@ -661,6 +662,10 @@ ath79_setup_macs()
                lan_mac=$(mtd_get_mac_text "devdata" 0xc9)
                wan_mac=$(mtd_get_mac_text "devdata" 0x79)
                ;;
+       dlink,dir-859-a3)
+               lan_mac=$(get_mac_label)
+               wan_mac=$(macaddr_add "$lan_mac" 3)
+               ;;
        qihoo,c301|\
        wd,mynet-n600|\
        wd,mynet-n750)
index ad3db95a0c67d960bbbe71b4260c9ea3352991cf..0ea81a8dc3ac53a3852a5bff416720779e68b5e3 100644 (file)
@@ -23,6 +23,7 @@ dlink,dap-3662-a1)
        ;;
 dlink,dir-629-a1|\
 dlink,dir-859-a1|\
+dlink,dir-859-a3|\
 dlink,dir-869-a1|\
 qihoo,c301)
        fix_seama_header
index f8969a919c91207da399e59cbbe0c88ddc23b3eb..788520120de5ba0f1b4ea77ef7358e65fc255269 100644 (file)
@@ -1143,18 +1143,28 @@ define Device/dlink_dir-842-c3
 endef
 TARGET_DEVICES += dlink_dir-842-c3
 
-define Device/dlink_dir-859-a1
+define Device/dlink_dir-859-ax
   $(Device/seama)
   SOC := qca9563
   DEVICE_VENDOR := D-Link
   DEVICE_MODEL := DIR-859
-  DEVICE_VARIANT := A1
   IMAGE_SIZE := 15872k
   DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
   SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859
 endef
+
+define Device/dlink_dir-859-a1
+  $(Device/dlink_dir-859-ax)
+  DEVICE_VARIANT := A1
+endef
 TARGET_DEVICES += dlink_dir-859-a1
 
+define Device/dlink_dir-859-a3
+  $(Device/dlink_dir-859-ax)
+  DEVICE_VARIANT := A3
+endef
+TARGET_DEVICES += dlink_dir-859-a3
+
 define Device/dlink_dir-869-a1
   $(Device/seama)
   SOC := qca9563