Xiaomi mi wifi 3 support

root@LEDE:/tmp# sysupgrade lede-ramips-mt7620-miwifi-r3-squashfs-sysupgrade.tar
Invalid image type.
Image check 'platform_check_image' failed.

Note: The internal lan (br-lan) is connected to the wrong interface. The router has 2 lan ports and 1 wan port. At the moment, br-lan is linked to the wan port.

Most likely board name or model are set wrong.
What does cat /proc/cpuinfo return?
I did not check how ports were connected because I assumed that they are same as is Mi Wifi Mini,but that can be solved.
First we need to get it working at all

Update (cpuinfo + sysupgrade -F)

root@LEDE:/tmp# cat /proc/cpuinfo
system type             : MediaTek MT7620A ver:2 eco:6
machine                 : Xiaomi MiWiFi R3
processor               : 0
cpu model               : MIPS 24KEc V5.0
BogoMIPS                : 385.84
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16 dsp
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

root@LEDE:/tmp# sysupgrade -n -F lede-ramips-mt7620-miwifi-r3-squashfs-sysupgrad
e.tar
Invalid image type.
Image check 'platform_check_image' failed but --force given - will update anyway!
killall: watchdog: no process killed
Commencing upgrade. All shell sessions will be closed now.
Watchdog handover: fd=3
- watchdog -
killall: telnetd: no process killed
Sending TERM to remaining processes ... ubusd logd netifd odhcpd ntpd dnsmasq
Sending KILL to remaining processes ...
Performing system upgrade...
Could not open mtd device: firmware
Can't open device for writing!
Upgrade completed
Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource [   65.851351] reboot: Restarting system
busy
umount: can't unmount /: Invalid argument

I have a feeling that sysupgrade is being denied because partitions do not match ones in sysupgrade.
Can you try following instructions for manual flash posted earlier in this thread?

I should get one R3 tommorow so I can also test

I guess sysupgrade fails, because there are no mtd-devices in /dev. Even the block-device for the nand flash is not visible.

It is most likely due to my bad port of NAND support from MT7621.
Problem is that patch that had NAND driver for MT7620 was dropped when kernel was updated to 4.9

We really need someone who knows more than me.

@dissent1 Any time to help?

1 Like

Try this layout in mi3 dts and remove it from 7620.dtsi

But I haven't found a driver that parses it, so if it doesn't work, try copying and adjusting this patch

I have copied the patch but unfortunately it will require adjustments as it spews out errors.
Unfortunately,I have no idea where to start

according to this patch oobavail is in struct 'mtd' and not in 'ecclayout' anymore

But in ramips patch it points to ecclayout still

Seems like you need to make 1 more pointer to point to mtd->ooblayout, but that may require more work

In functions where you find 'ra->oob->oobavail'
Add the pointer 'struct mtd_info *mtd'

And then replace ''ra->oob->oobavail'' with 'mtd->oobavail'

Let's see how it goes

Or try just replacing it with 'ranfc_mtd->oobavail' without additional structs


Ok,I will try it.

I tried to follow your instructions but failed.
Any chance you are willing to make those changes.
You can make a PR or tell me your github email to grant you access.

Okay, let's go the way around. Revert all your changes and replace every 'ra->oob->oobavail' with 'RA_CHIP_OOB_AVAIL' throughout the patch

Tried that,unfortunately there are still errors.

Copy


To line 67 or somewhere near

Ok,copied.
Trying to build it now.

Don't forget to increment


Should be 2137 now

I think it will not change as I used empty line that was already added

Unfortunately,the same error is present

Also,kernel was bumped to 4.9 although lack of NAND support was known

It's 1 error less now, will see if I can workaround this one