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

Tomasz Maciej Nowak tmn505 at gmail.com
Sun Jan 7 07:49:04 PST 2024


W dniu 7.01.2024 o 14:06, Sander Vanheule pisze:
> Hi Tomasz,
> 
> On Fri, 2023-12-22 at 11:36 +0100, Tomasz Maciej Nowak wrote:
>> From: Tomasz Maciej Nowak <tmn505 at gmail.com>
>>
>> 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
> 
> Ouch.

Indeed

> 
>> 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.
> 
> [...]
> 
>> +
>> +	virtual_flash {
>> +		compatible = "mtd-concat";
>> +		devices = <&fwconcat0 &fwconcat1>;
> 
> Both have the same representation in the resulting DTB, but this is a list, so:
> 	devices = <&fwconcat0>, <&fwconcat1>;

ACK.

> 
> [...]
> 
>> +&spi0 {
>> +	status = "okay";
>> +
>> +	flash at 0 {
>> +		compatible = "jedec,spi-nor";
>> +		reg = <0>;
>> +		spi-max-frequency = <10000000>;
>> +
>> +		partitions {
>> +			compatible = "fixed-partitions";
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +
>> +			partition at 0 {
>> +				label = "u-boot";
>> +				reg = <0x0 0x20000>;
>> +				read-only;
>> +			};
>> +
>> +			fwconcat0: partition at 20000 {
>> +				label = "fwconcat0";
>> +				reg = <0x20000 0x5e0000>;
>> +			};
> 
> Since this is where the bootloader is going to look for a kernel, I'm pretty sure the
> kernel will need to be contained entirely in this partition (or you need a kernel loader).
> That would mean it must fit inside 6016 kiB.

Yes, I forgot to limit the kernel size. TBF I don't think our kernel loader has 
support for split kerne chunks.

> 
> [...]
> 
>> +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
> 
> So you will probably need two check-size calls here:
> 
> 	IMAGE/sysupgrade.bin := append-kernel | check-size 6016k | \
> 		append-rootfs | pad-rootfs | check-size | append-metadata

I'll add KERNEL_SIZE, should be sufficient. Will need to check if it'll work
as I think it does, or I did miss something.

> Side note: You're definitely not the only one with flash constraints on mt76x8, so I
> wonder if a small-flash configuration/package selection would make sense.

Yes, that is really needed. There is already a report for RE305[1] which has same
vendor partition layout, where overlay is too small. If I add LuCI to current
master, factory image isn't created for RE365 (I'll need to backport this patch
to 23.05, so there will be a permanent factory image for initial installation).

1. https://github.com/openwrt/openwrt/issues/14215

> 
> Best,
> Sander

Thank for the review. I'll send v3 after testing and will check how much we gain
when small flash is set.

-- 
TMN




More information about the openwrt-devel mailing list