[OpenWrt-Devel] ath79: NAND bad eraseblocks in MikroTik RouterBOARD 922UAGS-5HPacD

Michal Cieslakiewicz michal.cieslakiewicz at wp.pl
Thu Jan 30 17:30:39 EST 2020

On Thu, 30 Jan 2020 21:40:43 +0100
"Roger Pueyo Centelles | Guifi.net" <roger.pueyo at guifi.net> wrote:

> Hi Michal,
> El 29/1/20 a les 20:07, Michal Cieslakiewicz ha escrit:
> > Please try adding 'qca,nand-swap-dma;' to '&nand' section in
> > router dts file. This in theory should fix endianness problem.  
> Yes, that worked! I also had to set nand-ecc-mode = "soft";, as
> two-byte blocks were still swapped.
> > By looking at C file, I have also found that this router uses
> > model-specific ath79_nfc_set_scan_fixup() routine - a functionality
> > that is not implemented in ath79, because there was no need for such
> > quirks, at least not until now.  
> Could this be related to the fact that the detected chip has 128 MiB,
> but it is only usable up to 64 MiB?
> [    0.774760] nand: Samsung NAND 128MiB 3,3V 8-bit
> [    0.779480] nand: 128 MiB, SLC, erase size: 128 KiB, page size:
> 2048, OOB size: 64
> [    0.787178] Scanning device for bad blocks
> [    0.797061] random: fast init done
> [    0.927117] 3 fixed-partitions partitions found on MTD device
> ar934x-nand [    0.934024] Creating 3 MTD partitions on "ar934x-nand":
> [    0.939338] 0x000000000000-0x000000040000 : "booter"
> [    0.945095] 0x000000040000-0x000000400000 : "kernel"
> [    0.950898] 0x000004000000-0x00000bc00000 : "ubi"
> [    0.955673] mtd: partition "ubi" extends beyond the end of device
> "ar934x-nand" -- size truncated to 0x4000000
> Kind regards,
> Roger

Hello Roger,

Glad to see progress in your struggle! 

'qca,nand-swap-dma', looking at the driver code, works for 32-bit words
so 16-bit swaps are kinda weird... ECC mode in ath79 defaults to HW
while for ar71xx indeed it may be software-controlled.

IMHO, there is still some work to be done on ar934x-nand driver side. I
was porting it to ath79 for WNDR4300, that router does not require any
special programming, and I'm no expert in NAND controllers. Anyway,
code that has been left back in ar71xx may have to be included here for
your Routerboard. As I've written before, mach-rb*.c files in ar71xx
tree set some OOB ECC regions, apparently that functionality should be
introduced as another qca-specific dts property. 
With this code in place, hopefully you will be able to use all 128
MiB flash space.

Best regards

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list