From patchwork Wed Jan 10 15:39:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1885029 X-Patchwork-Delegate: sander@svanheule.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=hyHq82eV; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=j97HKiJx; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T9CGm1ZFdz1xqk for ; Thu, 11 Jan 2024 03:01:51 +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=WkF3feOnEdCB9OtJKdBmM6mv2t2F1uMJrG59VJg2qeU=; b=hyHq82eVxh4uaP 1N1D14VAm3iKi+Nn2L0V5ss6mdGCXF6ksw1t3f0BEjWEIUkl/4J8wvOellCTMX8/CvLsAhloQ0An+ IL1zDaU+o45HAiXX0n4mE5wjJ6XgVjHqVbl+0H4cTiBzoQOFcJgkgi+bhiiK3qsq8q1JteQQesl29 n7yB6gAdow+axeivRyoqErV+AQiokF9YOcoMuioo4fTOHe5aroMbflAQz8oPoe0u/UcHIZ/3ZFS2r JDjbctt3WIamFaNGQYvG2XqIqrHGZAssvpXgBBN1Y+psFqM9bzJ27x4vsOvmT06msLZjFE0WwIR9Q FRPKikrJYWDueNaceTmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNayv-00CjbF-2G; Wed, 10 Jan 2024 15:59:05 +0000 Received: from terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNayq-00CjZ6-1z for openwrt-devel@lists.openwrt.org; Wed, 10 Jan 2024 15:59:03 +0000 Received: from localhost.localdomain (unknown [212.106.161.103]) by terefe.re (Postfix) with ESMTPSA id 2790F1FFD8; Wed, 10 Jan 2024 16:58:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1704902332; bh=Nu98GthzkS5kZniGpiSUuaN2qyQPp5ArAUzzQK/5e8Q=; h=From:To:Cc:Subject:Date:From; b=j97HKiJxiUb76d3avWJ/bVnb3SbAITv3AYOBKB76Jxr1joT852NV8mfX99oqKfh8y NB+4vQxLozqWUrMARjDqsRPmZnVjIgfI1ppRz31he3RSm8yIjTXkys1gNlilgwYCDL INAqsyJUsdPcwWgGfRNo2zs9wUtyycEIB0JS4fdmpIDiNKVYGKHGN3k6XFfRfGDQxp bjBAyJaWcZxrg4/N9tOKXnzRmxYMdzpAhE6+oCG/j87fxqkUFQQTQEY1ZYUzyN5bTQ EPhCLiC4PZ1N2IMOq7d+R3TD06AvMJyzu5UGas+KA2Nu0O93dz3yP38BTgiMqMOb5d bYLtTrPqIQb6g== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org, Sander Vanheule Cc: Tomasz Maciej Nowak Subject: [PATCH v3] ramips: mt76x8: add support for TP-Link RE365 v1 Date: Wed, 10 Jan 2024 16:39:57 +0100 Message-ID: <20240110155837.2785-1-tmn505@terefe.re> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_075901_230198_45444A82 X-CRM114-Status: GOOD ( 14.99 ) X-Spam-Score: -0.2 (/) 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: From: Tomasz Maciej Nowak TP-Link RE365 is a wireless range extender, hardware-wise resembles RE305 with slight changes regarding buttons and LEDs. Specification SoC: MediaTek MT7628AN RAM: 64 MiB DDR2 Flash: 8 MiB SPI NOR WiFi: 2.4 GHz 2T2R integrated 5 GHz 2T2R MediaTek MT7612EN conncted to PCIe lanes Ethernet: 1x 10/100 Mbps integrated LEDs: 6 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 From: Tomasz Maciej Nowak TP-Link RE365 is a wireless range extender, hardware-wise resembles RE305 with slight changes regarding buttons and LEDs. Specification SoC: MediaTek MT7628AN RAM: 64 MiB DDR2 Flash: 8 MiB SPI NOR WiFi: 2.4 GHz 2T2R integrated 5 GHz 2T2R MediaTek MT7612EN conncted to PCIe lanes Ethernet: 1x 10/100 Mbps integrated LEDs: 6x GPIO controlled Buttons: 4x GPIO controlled UART: row of 4 holes marked on PCB as J1, starting count from white triangle 1. VCC (3.3V), 2. GND, 3. RX, 4. TX baud: 57600, parity: none, flow control: none Installation 1. Open web management interface. 2. Go to Settings > System Tools > Firmware upgrade. 3. Select "Browse" and select the OpenWrt image with factory.bin suffix. 4. After selecting "Upgrade" firmware writing process will start. 5. Wait till device reboots, power LED should stay solid when it's fully booted, then it's ready for configuration through LAN port. Additional information With how device manufacturer patrtitioned the flash memory, it's possible that with default packages set, initial factory.bin image won't be created. In such case, try to reduce packages amount or use older release for initial conversion to OpenWrt. Later You can use sysupgrade.bin image with full set of packages because OpenWrt uses unpartitioned flash memory space unused by vendor firmware. Reverting to vendor firmware involves converting firmware using tplink-safeloader with -z option (can be found in ImageBuilder or SDK) and forcibly applying converted firmware as sysupgrade. Known issues WARNING: after removing casing of the device one is exposed to high voltage and is in a risk of being electrocuted. Caution when interfacing whith bootloader, saving its environment either by issuing "saveenv" or selecting option "1: Load system code to SDRAM via TFTP." in boot menu, any of those will lead to overwriting part of kernel. This will lead to need of firmware recovery. The cause of this issue is bootloader having environment offset on flash at 0x40000, while kernel starts from 0x20000. Signed-off-by: Tomasz Maciej Nowak --- v2 -> v3 - list virtual flash devices as separate objects - add kernel size restriction .../ramips/dts/mt7628an_tplink_re365-v1.dts | 213 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 12 + .../mt76x8/base-files/etc/board.d/01_leds | 3 + .../mt76x8/base-files/etc/board.d/02_network | 1 + 4 files changed, 229 insertions(+) create mode 100644 target/linux/ramips/dts/mt7628an_tplink_re365-v1.dts diff --git a/target/linux/ramips/dts/mt7628an_tplink_re365-v1.dts b/target/linux/ramips/dts/mt7628an_tplink_re365-v1.dts new file mode 100644 index 000000000000..5743ae1bbc5c --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_tplink_re365-v1.dts @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + model = "TP-Link RE365 v1"; + compatible = "tplink,re365-v1", "mediatek,mt7628an-soc"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + label-mac-device = ðernet; + }; + + keys { + compatible = "gpio-keys"; + + button-led { + label = "led"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + button-power { + label = "power"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + button-wps { + label = "wps"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-lan { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_power: led-power { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + panic-indicator; + }; + + led-rssi-bad { + color = ; + function = LED_FUNCTION_INDICATOR; + gpios = <&gpio 43 GPIO_ACTIVE_HIGH>; + }; + + led-rssi-good { + color = ; + function = LED_FUNCTION_INDICATOR; + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-wlan2g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-wlan5g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <5>; + gpios = <&gpio 40 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&fwconcat0>, <&fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_config_10008 0>; + nvmem-cell-names = "mac-address"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + nvmem-cells = <&eeprom_radio_8000>, <&macaddr_config_10008 2>; + nvmem-cell-names = "eeprom", "mac-address"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + fwconcat0: partition@20000 { + label = "fwconcat0"; + reg = <0x20000 0x5e0000>; + }; + + partition@600000 { + label = "config"; + reg = <0x600000 0x50000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_10008: macaddr@10008 { + compatible = "mac-base"; + reg = <0x10008 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + fwconcat1: partition@650000 { + label = "fwconcat1"; + reg = <0x650000 0x1a0000>; + }; + + partition@7f0000 { + label = "radio"; + reg = <0x7f0000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_radio_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_radio_8000: eeprom@8000 { + reg = <0x8000 0x200>; + }; + }; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "refclk", "wdt", "p0led_an", "p1led_an", "p2led_an", "p3led_an", "p4led_an"; + function = "gpio"; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&eeprom_radio_0>, <&macaddr_config_10008 1>; + nvmem-cell-names = "eeprom", "mac-address"; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 8a6bccfba63b..9a458d38f392 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -666,6 +666,18 @@ define Device/tplink_re305-v3 endef TARGET_DEVICES += tplink_re305-v3 +define Device/tplink_re365-v1 + $(Device/tplink-safeloader) + DEVICE_MODEL := RE365 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-mt76x2 + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata + IMAGE_SIZE := 7680k + KERNEL_SIZE := 6016k + TPLINK_BOARD_ID := RE365 +endef +TARGET_DEVICES += tplink_re365-v1 + define Device/tplink_tl-mr3020-v3 $(Device/tplink-v2) IMAGE_SIZE := 7808k diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index c4301737b28b..5a0e0ab2148e 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -91,6 +91,9 @@ tplink,tl-mr3020-v3|\ tplink,tl-wa801nd-v5) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; +tplink,re365-v1) + ucidef_set_led_netdev "lan" "lan" "blue:lan" "eth0" + ;; tplink,tl-mr3420-v5|\ tplink,tl-wr840n-v4|\ tplink,tl-wr842n-v5) diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index fe3ac9193ff9..63abb14d1391 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -27,6 +27,7 @@ ramips_setup_interfaces() tplink,re220-v2|\ tplink,re305-v1|\ tplink,re305-v3|\ + tplink,re365-v1|\ tplink,tl-wr802n-v4|\ tplink,tl-wa801nd-v5|\ tplink,tl-wr902ac-v4|\