From patchwork Tue Dec 13 22:15:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Schaper X-Patchwork-Id: 1715522 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=GxkGOAv5; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NWtF93mp6z23yy for ; Wed, 14 Dec 2022 09:18:52 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FwKntw4ElwjFRJ8YptrlT/b6mASUOZ4gpLXOQf5hTjQ=; b=GxkGOAv52PZ2Vo e2KRBG3m1jZjbVbVgUZIvev5ePmlw86gb4VPx0wYXa2SzqVorYgKbIarxplxkSEuNbnfJU03CWZgw +gbMTruKd9iynOqS8Oh/CAglpZObCxYiciTR3BU+PszGYeYGGbYQAoH5CaVs7u2dB1O4hK1nZKgo2 ibiqslhx42OnDVCunMbPbU+ZjRMmDnDEPgFc3g4xHBLmixLVCWXVHQOuxEOoXZtPXMtP1bx98DctO f04AidgNqtvyAsKJPbVG2Lfc/S6dPHygJzm2+s3Ai7FFhgYS4nXIIV1+NiyBGrZE8oV4h9wpNJlC8 ujeK2Q4Fzi2Dzk3q1RiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5DYk-007DAL-QE; Tue, 13 Dec 2022 22:15:34 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5DYg-007D53-3w for openwrt-devel@lists.openwrt.org; Tue, 13 Dec 2022 22:15:32 +0000 Received: from sebastian-msi.fritz.box ([91.17.82.53]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MeTHG-1oWzGT3Xjo-00aVYU; Tue, 13 Dec 2022 23:15:17 +0100 From: Sebastian Schaper To: openwrt-devel@lists.openwrt.org Cc: Jan-Niklas Burfeind , Sebastian Schaper Subject: [PATCH] ramips: add support for D-Link DAP-X1860 A1 Date: Tue, 13 Dec 2022 23:15:09 +0100 Message-Id: <20221213221509.16186-1-openwrt@sebastianschaper.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:76KfAJ5KYtlWJNJRPHiQqhafW8lQuxaB4NWfrIW0EtkPvcYbzCH sIhWY0zXzxYDDueFE5sVg2GNceWTwOQxhqgsC7xQqcZq6PNAXPwgVxic90ePMarJHz9Kqyz VE8ZrYhHoKqAyt9+BUlX+V6830Vu2UOnxdYEOxwxzc1vObu9k+88YzjhPmArQuHuB9i7Dcx uoaQuUv9ODfi3KFjVDmig== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:tHs7rWWKy+I=;DgYuE2/tQKyoYxEEHzzzqS153Sd i5erEaeGnq76DCdCNKexiCGuALoDJWx62Bs3hk4BWMFGoOpe2/U87IeL+5bwf4Ghjb/RGa0vB Ye8M/gv42rb8J0Yg/16X8CpMYG0d3fcb4T7YJ9DU6xypNj1czFfmOMSRFMbcg/WPXohkRF4JH DxP2JLMXrkaV5JI36j9TdQNwIFWdFCBiO4UDVFYLFplS3qxziBgoy9XYuTKoSRdAWGiUt0xup 4wRpAom4IxbUtd9fhW0luFNMLxFI84zHXHHmFYwnzArXf2whZd9TSrEMFTlOcsV29wg+5bz/n FezHqjlr3f5omqfuBV/H8wPaCnuQ2+J5D+Pm9ZTrHm3N2CXUOlTyBn2DGzekTgRViB2Qze5nC scxd7jhlE1KJfBla02/ser+KUWmpzEXOUQ1BWE05MQ89kiSokgCUWXxoV+936xq3Su6qf3/ug RbHn1VH2F5csdWqSjyXKbn17Do960f0PdAo7W+vtGTdvSUHwJZvZ2I6wawPHv3AM6QvE6SiVP 0Yo6AzC0iKHtKA0XgUBjmb3ISeFpfi58GLFcH5CMVz8unH+IgVCHAL2H1Wdut1Pwp9V/05xH/ 2Qx7v3JXjDgDtfG2D6mseFOScCXntw3I2reBbhDZorBiKWRSzc9Vv7dUFlPsjoGLwbKQ1Jw9L EJUiauaGhRSVJ90Si+t9D/YW7+z4nic0hZyapdxaTA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221213_141530_496893_C9ADB8AF X-CRM114-Status: GOOD ( 19.34 ) X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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/green), incorrectly populated red/ora [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [217.72.192.75 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.72.192.75 listed in wl.mailspike.net] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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/green), incorrectly populated red/orange status LEDs (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 --- I am not quite happy with the 4096K fixed-size kernel partition, but this is consistent with many other devices using UBI. If one day the kernel image will grow larger, this could be addressed simultaneously (e.g. using lzma-loader) for all devices. Do we even need UBI when there is NMBM? But probably better for redundancy. I see there are further options available for `mediatek,nmbm` in dts, i.e. `bmt-max-ratio` and `bmt-remap-range`, only used by those two NMBM devices. Do we need to set these as well, and how should the values be determined? RSSI bargraph is configured for the 5GHz interface `wlan1` to be consistent with other devices using the `rssileds` package, however in current master this is no longer working, since individual interfaces (e.g. `phy1-sta0`) will be created when connecting to a network. It seems this needs to be resolved within `rssileds`, rather than individually for this device. `uImage-relocate` is based on openwrt/staging/nbd from 977e37c0f23e ramips: add work-in-progress support for D-Link DIR-X1860 .../ramips/dts/mt7621_dlink_dap-x1860-a1.dts | 197 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 37 ++++ .../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, 250 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 +#include + +/ { + 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 = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + 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@0 { + label = "ubi"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + mediatek,nmbm; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x80000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + + partition@180000 { + label = "kernel"; + reg = <0x180000 0x0400000>; + }; + + fwconcat0: partition@580000 { + label = "fwconcat0"; + reg = <0x580000 0x3000000>; + }; + + partition@3580000 { + label = "manufacture"; + reg = <0x3580000 0x400000>; + read-only; + }; + + partition@3980000 { + label = "storage"; + reg = <0x3980000 0x680000>; + read-only; + }; + + fwconcat1: partition@4000000 { + label = "fwconcat1"; + reg = <0x4000000 0x3800000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@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@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 08aa592be8..beae1f929a 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -14,6 +14,23 @@ ifdef CONFIG_LINUX_5_10 DTS_CPPFLAGS += -DDTS_LEGACY endif +RELOCATE_LOADADDR = 0x81000000 + +define Build/uImage-relocate + mkimage \ + -A $(LINUX_KARCH) \ + -O linux \ + -T kernel \ + -C $(word 1,$(1)) \ + -a $(RELOCATE_LOADADDR) \ + -e $(RELOCATE_LOADADDR) \ + -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \ + $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \ + $(wordlist 2,$(words $(1)),$(1)) \ + -d $@ $@.new + mv $@.new $@ +endef + define Build/arcadyan-trx echo -ne "hsqs" > $@.hsqs $(eval trx_magic=$(word 1,$(1))) @@ -470,6 +487,26 @@ 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 := kernel-bin | append-dtb | relocate-kernel | lzma | \ + uImage-relocate lzma + 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 42e50451e3..626f048a85 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 @@ -50,6 +50,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 b7121db64f..40afa5879a 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 06a35077dc..15bab1958a 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|\