NAND drivers for MT7620 Soc

Hello, I am trying to add support for my router - Linksys EA-6100 - to OpenWRT. I've successfully compiled an image, but I noticed that doing:

cat /proc/mtd

yields no partitions even though I've defined it in the DTS file corresponding to the router. I've searched around a bit and apparently NAND support has been missing from the kernel.

This patch is missing from the current branch of both LEDE and OpenWRT.

My question is: why is this not included in the upstream branch anymore?

Edit: forgot to mention, I'm running the initramfs and loading the image straight to RAM via tftpboot

Not knowing the exact content of the patch and not being familiar with the ralink platform, it may be due to an upstream insistence that the new SPI NAND framework be used, which is not present in Kernel 4.14 (but will be in 4.19, the next LTS Kernel).

See, for example,

mkresin commented on Nov 26, 2018

But it requires 4.19 to not have to backport pretty much the whole MTD and SPI subsystems

Please re-spin the patch as soon as we have kernel 4.19 support. The approach was already NAK'ed upstream and I don't see much gain in adding the hack if the next major kernel in OpenWrt will provide a suitable solution.

Hmm. Hopefully, this makes support for NAND chips less hacky and consistent across the board once OpenWRT gets updated to 4.19.

Regardless, I don't see a huge benefit for removing the patch entirely, in fact, looking back at the thread for the Xiaomi Mi Wifi 3, someone else ran into a similar issue. Due to missing NAND support, a fully supported working image was never completed with a couple of people turning to that patch in hopes that it works.

I'll experiment with the patch and see if I can get it working with the current Kernel. If anyone else has a more elegant alternative, I'm all for it.

show the NAND part of your DTS. i've also managed to make system detect NAND in EA2750 using old patch with 4.14 kernel and boot ramdisk but bricked the damn thing before assembled flashable image...

        nand {
                status = "okay";
                compatible = "mtk,mt7620-nand";

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "Bootloader"; //Note: Bootloader = u-boot
                                reg = <0x000000 0x080000>;

                                label = "Config";
                                reg = <0x080000 0x0c0000>;

                        factory: partition@c0000 {
                                label = "Factory";
                                reg = <0x0c0000 0x100000>;

                        partition@100000 {
                                label = "s_env"; //Note: s_env = u-boot-env
                                reg = <0x100000 0x140000>;

                        partition@140000 {
                                label = "devinfo";
                                reg = <0x140000 0x180000>;

                        partition@180000 {
                                compatible = "denx,uimage";
                                label = "firmware"; //Note:firmware=kernel+rootfs
                                reg = <0x180000 0x2980000>;

                        partition@5180000 {
                                label = "syscfg";
                                reg = <0x5180000 0x8000000>;

...Which I got from the default bootlog...

0x000000000000-0x000000080000 : "Bootloader" //u-boot
0x000000080000-0x0000000c0000 : "Config"
0x0000000c0000-0x000000100000 : "Factory"
0x000000100000-0x000000140000 : "s_env" //essentially u-boot env
0x000000140000-0x000000180000 : "devinfo"
0x000000180000-0x000002980000 : "kernel" //kernel + roofts
0x000000380000-0x000002980000 : "rootfs" //= firmware
0x000002980000-0x000005180000 : "alt_kernel"
0x000002b80000-0x000005180000 : "alt_rootfs"
0x000005180000-0x000008000000 : "syscfg"

Ignore the comments, I just added them to help me keep track of what was going on :stuck_out_tongue:

I won't be able to test out any changes until I get home though which will be in a couple of hours

i think this should be named ubi, remove read-only flag and fix length:
reg = <0x5180000 0x2e80000>;

Sorry, been busy with school assignments haha.

i think this should be named ubi, remove read-only flag and fix length:
reg = <0x5180000 0x2e80000>;

So you say it should be named ubi? But then why is it named "syscfg" in the partition table shown at bootup? The ending address is also less than the starting address, so I'm not too sure about that. I don't have the full bootup log with me, but someone else already posted it on the dd-wrt support tracker. Here

Once I get more time, I'll startup this project again

it's named syscfg because it's OEM fw. dts format is < startaddr length >
not startaddr endaddr

It seems to me that the patch 39 might work for mt7620 if it wasnt limited to 7621?
@raisins4u Did you have to use the 38 patch in the end?