Mikrotik 450G NAND changed

I have been using Mikrotik 450G routerboards with LEDE with no issues, but we recently bought some new boards and cannot install due to the NAND not being writen/read properly. After investigation Mikrotik has change the NAND from a Spansion S34ML04G1 to a Toshiba TC58BVG2S0HTA00. The log show that it has been detected and erases the device but nothing is written correctly to it.
Whilst booting from LEDE from the network, the storage page indicates there is 0 storage.

The Array organization seems to be very different. Can someone give me some clues to fix the NAND driver to be able to use either NAND device (or indeed just for the Toshiba NAND)?

Cheers ... Matt

It looks like there is a driver but it was never merged into Linux.
You can try patching it in.

1 Like

That's great news, I just now need to read up on how to use a patch.

The patch failed as the nand.h and nand_base.c files have change since the patch was conceived. I manually edited the patch to work around the changes in the two files, but now wont compile as I believe the struct nand_ecclayout has been deprecated.

Is there any information to migrate the old code to use the newer mtd_ooblayout_ops struct?

Yeah, ecclayout was deprecated in 4.9 I believe.
MT7620 had the same issue.

I have now got it building, by switching back to Linux 4.4 in the Makefile. i.e. KERNEL_PATCHVER:=4.4
But it does not seem to be using the driver. I'm trying to put some debug in to see whats happening, but I'm very new to both Linux and compiling LEDE/OpenWRT or any Linux distro for that matter.

I will post back if i make anymore progress.

Well,you gotta also select it

I just assumed looking at the code when the extended chip ID was decoded in nand_base.c, the chip->ecc.mode was set to NAND_ECC_BENAND and then in nand_scan_tail function the ecc was setup?

How would I select it?

You gotta use make menuconfig and then select the driver to be built and included

Could you point me in the general area in menuconfig? because i have have looked several times, even in kernel_menuconfig but nothing looks right.
When I kick a build off with the patch, it does ask me if I wish to enable the Toshiba BENAND, to which I choose yes, I would have thought this to be sufficient?

It should be under kernel modules, MTD

It asks you that since kernel config does not have that option disabled or enabled

There does not seem to be an MTD option.

I have now found a set of patches that might work for v4.14 of the kernel, as in version 4.12 a file for nand_toshiba.c was introduced, which these files patch.

so I may try going down that route now?

Thanks for your help so far, its been very useful.

It is under one of those submenus.
You gotta dig around.

I think using kernel 4.14 maybe a non-starter as the ar71xx platform is not supported for anything above 4.9


So back to trying kernel 4.4 and the Toshiba BENAND with hardware ECC

Hi @mattholt do you have any update on this?

Sorry for the delay in answering. At the moment I have not found a solution to get it working with the Toshiba BENAND flash chips. I have resorted to soldering on another chip that works, but in the long term I need to fix this issue.

Are you affected by this same issue? and have you made any progress?

Most likely current NAND driver is interfering with Toshiba one.
Also,pins used could have changed easily

Hi Robert,

I have checked the datasheets and believe the pin outs to be identical. As for the current NAND interfering, I have not looked too deep at that, and only tried the patches that Yoshitake Kobayashi had submitted. I'm currently working on something completely different at the moment, but i am due to pick this up soon with some help.

I will report back if we have success.

It most likely will interfere as from what I remember guys wrote custom NAND driver for the previus NAND that was used.
So it will interfere

Hi Matt. Yes, I'm affected by this issue, but as I'm not a developer I can't help writing the driver. I can help testing the driver if you want to.