Re: [PATCH v3] ramips: mt76x8: add support for TP-Link RE365 v1

2024-01-10 Thread Sander Vanheule
Hi Tomasz,

On Wed, 2024-01-10 at 16:39 +0100, Tomasz Maciej Nowak wrote:
> 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 0x4,
> while kernel starts from 0x2.
> 
> Signed-off-by: Tomasz Maciej Nowak 
> ---
> v2 -> v3
> - list virtual flash devices as separate objects
> - add kernel size restriction

Thanks for the update!


[...]

> + groups = "refclk", "wdt", "p0led_an", "p1led_an", "p2led_an",
> "p3led_an", "p4led_an";

I'll wrap this line (it's one measly character over the 100 limit) and apply 
the patch to
main.


Best,
Sander

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v3] ramips: mt76x8: add support for TP-Link RE365 v1

2024-01-10 Thread Tomasz Maciej Nowak
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 0x4,
while kernel starts from 0x2.

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 ..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 = _power;
+   led-failsafe = _power;
+   led-running = _power;
+   led-upgrade = _power;
+   label-mac-device = 
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   button-led {
+   label = "led";
+   gpios = < 44 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   button-power {
+   label = "power";
+   gpios = < 11 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   button-reset {
+   label = "reset";
+   gpios = < 37 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   button-wps {
+   label = "wps";
+   gpios = < 38 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-lan {
+   color = ;
+   function = LED_FUNCTION_LAN;
+   gpios = < 4 GPIO_ACTIVE_LOW>;
+   };
+
+   led_power: led-power {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = < 39 GPIO_ACTIVE_LOW>;
+   panic-indicator;
+   };
+
+   led-rssi-bad {
+   color = ;
+   function = LED_FUNCTION_INDICATOR;
+   gpios = < 43 GPIO_ACTIVE_HIGH>;
+   };
+
+   led-rssi-good {
+   color = ;
+   function = LED_FUNCTION_INDICATOR;
+   gpios = < 42 GPIO_ACTIVE_HIGH>;
+   };
+
+