From patchwork Fri Dec 22 10:36:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1879615 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=Z1hX2Wqj; 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=bWxp17rL; 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 4SxPBT5zzpz20R1 for ; Fri, 22 Dec 2023 21:47:11 +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=ffQypQMD02UCQ3w+CCyFeXs3UcAwaS8QhlFx1uOd20Q=; b=Z1hX2WqjONnr8b 9CkMSbZSq9eGl5GZWBnjI1Jme91ok4QMOc74/gBuvheS2xqtu2lGWsPFdWNaEDgh/N1gKDlbeQPUX lGryOsm13umKIrhjpbHK6NkFB/+eTKSIdWzDTB/wNSg9Sgmt1WNvHgnI2uOl1yWipvlmItyM6cGNe 5bvqzrDSPN0Lf2JDRZBt/7pFxbf71kMKFWXWA0UzmkpA9BOau4J09zeEQB1S+a6ZYIBoL76UeyB1G 7nVQRwZPAtb6bqlYf7GAZBaUZjPVjO+FOlmPqOo39aoI3o/4bvdKVNVMplaFlN01HS/dUmIMnP21s 8LDDs7/O3qoUTqubk2+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGd1C-005ZaR-11; Fri, 22 Dec 2023 10:44:38 +0000 Received: from terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGd18-005Za5-17 for openwrt-devel@lists.openwrt.org; Fri, 22 Dec 2023 10:44:36 +0000 Received: from localhost.localdomain (unknown [212.106.161.103]) by terefe.re (Postfix) with ESMTPSA id 7D8B21FF3B; Fri, 22 Dec 2023 11:44:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1703241869; bh=MnkCnZjMKrF1FHtI6U3bnrKWkovewSsJbMccBc9x5G0=; h=From:To:Cc:Subject:Date:From; b=bWxp17rLtxFFrkflnN5LaEtK75MuhqlTCkz+w0WIIJZoXobxW5OVHz0A+Kk8EKk5s alk0NjP63f7OHgp9X93e1YzsZJ/A/FvoEEZh52PZF6gT+KBR21mQzmKTIrzXiO2c9s q66YRZOGmWj4wm7JPJu/cLRkS8gP8+bBWrcXS5G56LL9t4tI69WBMGw2nKLl/mQ163 ObXJCO89aQtRFBHzX5+z22GYs2oe0+WIVuh/zU5PSIFnY8AYJ6WRCHNg3LSIekexh1 19FElnp2EUC4CRB/M/gUA8O3qsqLATLNjm0OOWkUZ7zNviDdn+7FzBfs5X9A1OeLGp B+WRWBa2ZR+mg== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak Subject: [PATCH v2] ramips: mt76x8: add support for TP-Link RE365 v1 Date: Fri, 22 Dec 2023 11:36:55 +0100 Message-ID: <20231222104421.1823-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-20231222_024434_936844_A521B4DC X-CRM114-Status: GOOD ( 14.51 ) 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, one 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 --- v1 -> v2 correct commit message, obviously "2: Load system code then write to Flash via TFTP." will overwrite kernel, so replace it with intended content "1: Load system code to SDRAM via TFTP." .../ramips/dts/mt7628an_tplink_re365-v1.dts | 213 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 11 + .../mt76x8/base-files/etc/board.d/01_leds | 3 + .../mt76x8/base-files/etc/board.d/02_network | 1 + 4 files changed, 228 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..50999ab6b229 --- /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..db03e7720c64 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -666,6 +666,17 @@ 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 + 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|\