Mikrotik RB2011 UiAS missing ESMT NAND flash support

Hi there,
I have a problem with a mikrotik RB 2011 UiAS-IN v3. The strange thing is, that I have multiple of these devices and it seems, that there are multiple nand controllers out there within the same serial number.
The Problem is, that the second NAND Controller is not recognized in in any version of openWRT.
I did a tftp boot of the device, it starts just fine, but when i logged in, dmesg says:

OpenWrt 19.07.10, r11427-9ce6aa9d8d
[    4.480677] bootconsole [early0] disabled
[    4.495941] m25p80 spi0.0: found gd25d05, expected m25p80
[    4.503442] m25p80 spi0.0: gd25d05 (64 Kbytes)
[    4.548895] Creating 4 MTD partitions on "spi0.0":
[    4.553862] 0x000000000000-0x00000000c000 : "routerboot"
[    4.581228] 0x00000000c000-0x00000000d000 : "hard_config"
[    4.608663] 0x00000000d000-0x00000000e000 : "bios"
[    4.635603] 0x00000000e000-0x00000000f000 : "soft_config"
[    4.664361] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xf1
[    4.670974] nand: ESMT NAND 128MiB 3,3V 8-bit
[    4.675491] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 32
**[    4.683316] ar934x-nfc ar934x-nfc: unsupported OOB size: 32 bytes**
**[    4.689632] ar934x-nfc ar934x-nfc: init tail failed, err:-6**
[    4.842029] switch0: Atheros AR8327 rev. 4 switch registered on ag71xx-mdio.0

So, there is no sensible mtd config:

cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 0000c000 00001000 "routerboot"
mtd1: 00001000 00001000 "hard_config"
mtd2: 00001000 00001000 "bios"
mtd3: 00001000 00001000 "soft_config"

Consequently, a sysupgrade fail (silently) potentially due to missing NAND support and UBI mtd config.

On my RB2011UiAS-2HnD things work just fine with Atheros AR9344 rev 3, but not with my RB 2011 UiAS-IN v3.

But within 2HnD model, the NAND could be configured correctly, so I think that is the problem.

OpenWrt 19.07.10, r11427-9ce6aa9d8d
[    0.834830] m25p80 spi0.0: found w25x05, expected m25p80
[    0.851610] m25p80 spi0.0: w25x05 (64 Kbytes)
[    0.856635] Creating 4 MTD partitions on "spi0.0":
[    0.861608] 0x000000000000-0x00000000c000 : "routerboot"
[    0.868846] 0x00000000c000-0x00000000d000 : "hard_config"
[    0.875831] 0x00000000d000-0x00000000e000 : "bios"
[    0.882800] 0x00000000e000-0x00000000f000 : "soft_config"
[    0.891276] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xf1
[    0.897897] nand: Toshiba NAND 128MiB 3,3V 8-bit
[    0.902671] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.910539] Scanning device for bad blocks
[    0.920530] random: fast init done
[    1.023438] Bad eraseblock 768 at 0x000006000000
[    1.063306] Creating 3 MTD partitions on "ar934x-nfc":
[    1.068684] 0x000000000000-0x000000040000 : "booter"
[    1.075477] 0x000000040000-0x000000400000 : "kernel"
[    1.082093] 0x000000400000-0x000008000000 : "ubi"
[    1.092377] libphy: Fixed MDIO Bus: probed

So, is there anything that could be done to get the NAND mtd setup right in my mikrotik RB 2011 UiAS-IN model ? It seems that there are differnt NAND controllers out there and not all are supported by openWRT :frowning: Thank you for any advice.

It's the NAND itself, not the controller. It is probably misdetected, according to this thread [WIP] Porting Mikrotik RB2011 to ath79 - testers needed this happened also for other chips.

Keep in mind that you are still using a 19.07 version with the ar71xx target which has been replaced by the ath79 target. Unfortunately, the RB2011 was not ported.

Okay, thank you for pointing that out. It seems, my RB-UiAS v3 has a ESMT NAND chip, that was not correctly configured in the related DTB s for openWRT.
I tried to tftp boot the ath79 version (kindly provided by user g6094199) from your suggested WIP Porting thread, but got pretty much the same problem:

[    5.384707] printk: bootconsole [early0] disabled
[    5.405226] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xf1
[    5.411797] nand: ESMT NAND 128MiB 3,3V 8-bit
[    5.416351] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 32
[    5.424178] ar934x-nand 1b000200.nand: unsupported OOB size: 32 bytes
[    5.430848] ar934x-nand 1b000200.nand: nand_scan failed, err:-6
[    5.439991] spi-nor spi0.0: gd25d05 (64 Kbytes)
[    5.444765] 1 fixed-partitions partitions found on MTD device spi0.0
[    5.451326] Creating 1 MTD partitions on "spi0.0":
[    5.456321] 0x000000000000-0x000000010000 : "RouterBoot"
[    5.464098] 4 routerbootpart partitions found on MTD device RouterBoot
[    5.470892] Creating 4 MTD partitions on "RouterBoot":
[    5.476234] 0x000000000000-0x00000000c000 : "bootloader1"
[    5.482809] 0x00000000c000-0x00000000d000 : "hard_config"
[    5.489431] 0x00000000d000-0x00000000e000 : "bios"
[    5.495409] 0x00000000e000-0x00000000f000 : "soft_config"

The ESMT Nand seems to have an unsupported OOB Size of 32..

[    5.424178] ar934x-nand 1b000200.nand: unsupported OOB size: 32 bytes
[    5.430848] ar934x-nand 1b000200.nand: nand_scan failed, err:-6

As written there, other UiAS NANDs seem to have missing DT configs, too.

I do not have insight in openwrt development and so it may be a naiv question, but could it be a
temporary fix, to netboot an owrt image, manually set up to the controller/nand config to work from
ssh/commandline and than with sane NAND config, use sysupgrade to make it permanent for usage ?

I'd love to use these devices but do not see a red line to follow, how this could be accopmlished for me.
If someone has a hint or directions, it would be welcome :slight_smile:

There is no such thing as a NAND config. The driver (i.e. the Linux kernel) tries to auto-detect the NAND based on its ID. This autodetection fails for some chips and then a quirk needs to be added to the NAND driver. So the only option is to recompile OpenWrt with a patched NAND driver.

See this thread for your specific NAND: Mikrotik rb951ui-2hnd unsupported nand
Looks like your NAND is actually a GigaDevices NAND and there is no direct support for it.

Okay, in the moment I have no resources to drop in that deep in development, also I'd like this kind of work.
When I understand your reply right, there are only two situations my devices with GigaDevices NAND will start "working" with owrt.

  1. the linux kernel some day starts to recognize the flash correctly and finds its way to a future owrt dist..
  2. or somebody adds a fixed gigadevice driver for this RB UiAS device tree

As the relevance of this MK RBUiAS issue seem to be rather low compared to other stuff, I assume, (2) will probably not happen in near future. Maybe I will start over (1) if I manage to have more resources, but for now, I will stick with a better supported device. Thank you for your Help :slight_smile:

Got zero experience of Mikrotik, so this is a loooong shot, but you might be able to
boot openwrt from a USB flash drive, if the boot loader would let you.

Would probably require a custom kernel though, with added usb storage support.

That's going to be more effort than porting this device to ath79 properly, including the NAND quirk.

There is already a PR but the NAND quirk is missing: https://github.com/openwrt/openwrt/pull/3729
It's a good base, you just have to add the ID from above to nand_ids.c and you should be good to go.