Support for Mi Router 3A (R3A)

I would like to port OpenWrt to this router.

Features are:

It originally ran the stock firmware, in Chinese.
There shouldn't be too many difficulties: in the past I've already tried the version for the 4A model (Chinese version, 100 Mb) and it worked. Now I should fix the mtd partitions.

Over the years I have done various tests, changing bootloader (Breed) and type of firmware (Padavan, Keenetic) and, more or less, it has always worked.

In this days I realized that the 5 GHz wireless no longer works, not even by reinstalling the stock bootloader and firmware.

Maybe it got damaged, or maybe there's some other problem.

With OpenWrt the PCI bus is not correctly recognized (mt7620-pci: probe of 10140000.pcie failed with error -1 or something similar). To this bus, if I understood correctly, the 5 Ghz wireless chip is connected, which is therefore not recognized.

In the past, the 5 GHz wireless worked, both with stock firmware and with OpenWrt (in the log the MT7612EN chip was recognized by its module, its firmware was loaded, etc.), albeit with poor performance.

Investigating, I realized that the Factory partition is corrupted (don't ask me how this happened).

I noticed this because MAC addresses were randomly assigned,

So I ask:
Does anyone have a Factory partition dump for this model? I tried that from a 4A router, but even if the MAC addresses are fixed, the 5GHz section is still not seen.

The dump is a file 0x10000 (65536) bytes long, and start with the hex values 0x76 0x01

Alternatively, a dump of the whole memory (about 16MB).

In order to be sure that the 5 GHz section is still working. Then I will continue with the development of a dedicated OpenWrt firmware.

I found a factory partition dump of another 3A router, with SN and MAC close to mine.
Now the MAC address is correctly reported (no errors in boot log and MAC address correctly reported in luci)
But 5 GHz still doesn't work since the PCI bus doesn't recognize the MT7612EN chip:

[ 0.249735] mt7620-pci 10140000.pcie: Port 0 N_FTS = 1b105000
[ 0.410808] mt7620-pci 10140000.pcie: PCIE0 no card, disable it(RST&CLK)
[ 0.417254] mt7620-pci: probe of 10140000.pcie failed with error -1

I tried to restore the original Xiaomi firmware, with the similar results:

[ 0.800000] *************** MT7628 PCIe RC mode *************
[ 1.300000] PCIE0 no card, disable it(RST&CLK)

I conclude that probably or the MT7612EN chip or the PCI bus has some hardware problem.

There are still a couple of things I need to check:

  1. that the U-Boot bootloader is the original one
  2. how much the Factory partition dump affects the initialization of the MT7612EN chip; I understand from the code that only the MAC address is read

&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
};
};

&wmac {
status = "okay";

mediatek,mtd-eeprom = <&factory 0x0>;
};

Indeed, in the Factory file, at offset 0x8000 + 0x4, I found the MAC address of the router (increased by 1). Not detecting the 5 GHz chip, this MAC is not assigned

The bootloader, also isn't that provided with router, is right (upgraded from stock firmware 2.18.15).

Other informations:
I tried OpenWRTInvasion exploit with listed below firmware, and I confirm that works

miwifi_r3a_all_ee173_2.18.15.bin
miwifi_r3a_firmware_8de62_2.12.8.bin
miwifi_r3a_all_da132_2.18.40.bin
miwifi_r3a_firmware_f2608_2.18.45.bin

using Docker and the external server (option 2).

It doesn't always work on the first try, but after 2 or 3 tries it does.

mtd write works on versions 2.12.8 and 2.18.45 (if right remember: not works on 2.18.15, but I'm not sure)

However, downgrading the firmware is always possible