[PATCH v2] ramips: add support for D-Link DAP-X1860 A1
Sebastian Schaper
openwrt at sebastianschaper.net
Sat Jan 7 03:56:10 PST 2023
The DAP-X1860 is a wall-plug AX1800 repeater.
Specifications:
- MT7621, 256 MiB RAM, 128 MiB SPI NAND
- MT7915 + MT7975 2x2 802.11ax (DBDC)
- Ethernet: 1 port 10/100/1000
- LED RSSI bargraph (2x green, 1x red/orange), status
and RSSI LEDs are incorrectly populated red/orange
(should be red/green according to documentation)
Installation:
- Keep reset button pressed during plug-in
- Web Recovery Updater is at 192.168.0.50
- Upload factory.bin, confirm flashing
(seems to work best with Chromium-based browsers)
Revert to OEM firmware:
- tar -xvf DAP-X1860_RevA_Firmware_101b94.bin
- openssl enc -d -md md5 -aes-256-cbc -in FWImage.st2 \
-out FWImage.st1 -k MB0dBx62oXJXDvt12lETWQ==
- tar -xvf FWImage.st1
- flash kernel_DAP-X1860.bin via Recovery
Signed-off-by: Sebastian Schaper <openwrt at sebastianschaper.net>
---
v2:
* drop uImage-relocate in favor of KERNEL_LOADADDR 0x82000000
* use fit image for kernel + dtb
* rebased to latest master
.../ramips/dts/mt7621_dlink_dap-x1860-a1.dts | 197 ++++++++++++++++++
target/linux/ramips/image/mt7621.mk | 21 ++
.../mt7621/base-files/etc/board.d/01_leds | 7 +
.../mt7621/base-files/etc/board.d/02_network | 1 +
.../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 7 +
.../mt7621/base-files/lib/upgrade/platform.sh | 1 +
6 files changed, 234 insertions(+)
create mode 100644 target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
diff --git a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
new file mode 100644
index 0000000000..8c156c17ce
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
@@ -0,0 +1,197 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "dlink,dap-x1860-a1", "mediatek,mt7621-soc";
+ model = "D-Link DAP-X1860 A1";
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ aliases {
+ label-mac-device = &gmac0;
+ led-boot = &led_power_orange;
+ led-failsafe = &led_power_red;
+ led-running = &led_power_orange;
+ led-upgrade = &led_power_red;
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ wps {
+ label = "wps";
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_WPS_BUTTON>;
+ };
+
+ reset {
+ label = "reset";
+ gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_power_red: power_red {
+ label = "red:power";
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ led_power_orange: power_orange {
+ label = "orange:power";
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };
+
+ rssihigh {
+ label = "green:rssihigh";
+ gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
+ };
+
+ rssimedium {
+ label = "green:rssimedium";
+ gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
+ };
+
+ rssilow_orange {
+ label = "orange:rssilow";
+ gpios = <&gpio 26 GPIO_ACTIVE_LOW>;
+ };
+
+ rssilow_green {
+ label = "green:rssilow";
+ gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ virtual_flash {
+ compatible = "mtd-concat";
+
+ devices = <&fwconcat0 &fwconcat1>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "ubi";
+ reg = <0x0 0x0>;
+ };
+ };
+ };
+};
+
+&nand {
+ status = "okay";
+
+ mediatek,nmbm;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "bootloader";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ partition at 80000 {
+ label = "config";
+ reg = <0x80000 0x80000>;
+ read-only;
+ };
+
+ factory: partition at 100000 {
+ label = "factory";
+ reg = <0x100000 0x80000>;
+ read-only;
+
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_factory_4: macaddr at 4 {
+ reg = <0x4 0x6>;
+ };
+ };
+
+ partition at 180000 {
+ label = "kernel";
+ reg = <0x180000 0x0400000>;
+ };
+
+ fwconcat0: partition at 580000 {
+ label = "fwconcat0";
+ reg = <0x580000 0x3000000>;
+ };
+
+ partition at 3580000 {
+ label = "manufacture";
+ reg = <0x3580000 0x400000>;
+ read-only;
+ };
+
+ partition at 3980000 {
+ label = "storage";
+ reg = <0x3980000 0x680000>;
+ read-only;
+ };
+
+ fwconcat1: partition at 4000000 {
+ label = "fwconcat1";
+ reg = <0x4000000 0x3800000>;
+ };
+ };
+};
+
+&pcie {
+ status = "okay";
+};
+
+&pcie1 {
+ wifi at 0,0 {
+ compatible = "mediatek,mt76";
+ reg = <0x0000 0 0 0 0>;
+ mediatek,mtd-eeprom = <&factory 0x0>;
+ mediatek,disable-radar-background;
+ };
+};
+
+ðernet {
+ pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>;
+};
+
+&gmac0 {
+ nvmem-cells = <&macaddr_factory_4>;
+ nvmem-cell-names = "mac-address";
+};
+
+&switch0 {
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ ports {
+ port at 0 {
+ status = "okay";
+ label = "lan";
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "uart2";
+ function = "gpio";
+ };
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index dd49583bf4..6492748aed 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -479,6 +479,27 @@ define Device/cudy_x6
endef
TARGET_DEVICES += cudy_x6
+define Device/dlink_dap-x1860-a1
+ $(Device/dsa-migration)
+ IMAGE_SIZE := 53248k
+ DEVICE_VENDOR := D-Link
+ DEVICE_MODEL := DAP-X1860
+ DEVICE_VARIANT := A1
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ KERNEL_SIZE := 4096k
+ KERNEL_LOADADDR := 0x82000000
+ KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \
+ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ IMAGES += factory.bin
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
+ check-size | elx-header 011b0060 8844A2D168B45A2D
+ DEVICE_PACKAGES := kmod-mt7915e rssileds
+endef
+TARGET_DEVICES += dlink_dap-x1860-a1
+
define Device/dlink_dir-8xx-a1
$(Device/dsa-migration)
IMAGE_SIZE := 16000k
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
index 9e0eaac941..5fafb9b50a 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
@@ -56,6 +56,13 @@ jcg,y2|\
xzwifi,creativebox-v1)
ucidef_set_led_netdev "internet" "internet" "blue:internet" "wan"
;;
+dlink,dap-x1860-a1)
+ ucidef_set_rssimon "wlan1" "200000" "1"
+ ucidef_set_led_rssi "rssilow" "RSSILOW" "orange:rssilow" "wlan1" "1" "25"
+ ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "green:rssilow" "wlan1" "26" "100"
+ ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:rssimedium" "wlan1" "51" "100"
+ ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan1" "76" "100"
+ ;;
dlink,dir-1960-a1|\
dlink,dir-2640-a1|\
dlink,dir-2660-a1)
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index dea433dec4..9a8e385a31 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -11,6 +11,7 @@ ramips_setup_interfaces()
ampedwireless,ally-00x19k|\
asus,rp-ac56|\
asus,rp-ac87|\
+ dlink,dap-x1860-a1|\
edimax,re23s|\
mikrotik,ltap-2hnd|\
mikrotik,routerboard-m11g|\
diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 69ecaefd27..161bd942db 100644
--- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -22,6 +22,13 @@ case "$board" in
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
macaddr_add $hw_mac_addr "$PHYNBR" > /sys${DEVPATH}/macaddress
;;
+ dlink,dap-x1860-a1)
+ hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
+ [ "$PHYNBR" = "0" ] && \
+ macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && \
+ macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress
+ ;;
dlink,dir-853-a3)
[ "$PHYNBR" = "0" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index fd856e6b3a..53ff9c016c 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -59,6 +59,7 @@ platform_do_upgrade() {
beeline,smartbox-giga|\
beeline,smartbox-turbo|\
belkin,rt1800|\
+ dlink,dap-x1860-a1|\
dlink,dir-1960-a1|\
dlink,dir-2640-a1|\
dlink,dir-2660-a1|\
--
2.34.1
More information about the openwrt-devel
mailing list