Meraki MR18 Porting issue with ubiattatch

Hi, I am In the process of porting the Meraki MR18 from V19.07.7 on the ar71xx target to v21.02 ath79 target. I have managed to get the device booting with networking/LED's on an initramfs image build on the ath79 target using Device Tree Files (DTS).

The issue I am encountering is ubiattach fails on v21.02 when the ubi volume has a subpage size of 512 and VID Header of 512.
This is the error which is shown for all PBI's on v21.02:
87.417684] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.124 #0
[ 87.423595] Stack : 80700000 806a7a28 00000000 00000000 806a6bec 87c2dc44 87c28300 806e0d03
[ 87.432080] 8063cf04 00000001 80fb32d8 020a0000 00000000 00000001 87c2dbf8 a59b5b53
[ 87.440561] 00000000 00000000 80fe0000 00002d5c 00000030 00000000 2e342e31 32342023
[ 87.449044] 00002d5c 47043aa8 00000000 00065f94 00000000 87cc4000 00000040 00000105
[ 87.457528] 00000000 020a0000 00000000 00000000 00000001 80382bfc 00000000 80fb0000
[ 87.466001] ...
[ 87.468483] Call Trace:
[ 87.470974] [<80069864>] show_stack+0x30/0x100
[ 87.475481] [<803e88cc>] ubi_io_read+0x274/0x3a0
[ 87.480183] [<803e8c88>] ubi_io_read_ec_hdr+0x64/0x294
[ 87.485394] [<803ee554>] ubi_attach+0x35c/0x154c
[ 87.490090] [<803e2418>] ubi_attach_mtd_dev+0x4d4/0xb78
[ 87.495405] [<80717ba8>] ubi_init+0x180/0x3e4
[ 87.499840] [<800609f8>] do_one_initcall+0x7c/0x1dc
[ 87.504802] [<80703e30>] kernel_init_freeable+0x14c/0x230
[ 87.510293] [<805a86d8>] kernel_init+0x10/0xf0
[ 87.514804] [<80064cb8>] ret_from_kernel_thread+0x14/0x1c
[ 87.521028] ubi0 warning: ubi_io_read: error -77 (ECC error) while reading 576 bytes from PEB 261:0, read only 576 bytes, retry
[ 87.533403] ubi0 warning: ubi_io_read: error -77 (ECC error) while reading 576 bytes from PEB 261:0, read only 576 bytes, retry
[ 87.545774] ubi0 warning: ubi_io_read: error -77 (ECC error) while reading 576 bytes from PEB 261:0, read only 576 bytes, retry
[ 87.558146] ubi0 error: ubi_io_read: error -77 (ECC error) while reading 576 bytes from PEB 261:0, read 576 bytes

Note: on v19 the ubi defaults to a sub-page size of 512, VID offset: 512. Hence the reason for trying to keep this on v21.02.
[ 3.057121] ubi0: attached mtd3 (name "ubi", size 111 MiB)
[ 3.062690] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[ 3.069699] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[ 3.076508] ubi0: VID header offset: 512 (aligned 512), data offset: 2048

Any help/pointer would be appreciated.

Managed to resolve the issue found the nand is using ecc-soft-bch..

From v19.07.7 mach-mr18.c

/* NAND */|
ath79_nfc_set_ecc_mode(**AR934X_NFC_ECC_SOFT_BCH**);|
ath79_register_nfc();|

For v21.02
Updated nand\config-default with:
CONFIG_MTD_NAND_ECC_SW_BCH=y

updated DTS with:

nand-ecc-mode = "soft";
nand-ecc-algo = "bch";

Log now correct and can access UBI's with no ECC errors.

root@OpenWrt:/# dmesg | grep -i ubi
[    0.619489] 0x000001080000-0x000007f80000 : "ubi"
[    1.639521] UBI: auto-attach mtd3
[    1.642907] ubi0: attaching mtd3
[    2.806398] ubi0: scanning is finished
[    2.827177] ubi0: attached mtd3 (name "ubi", size 111 MiB)
[    2.832749] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[    2.839744] ubi0: min./max. I/O unit sizes: 2048/2048, **sub-page size 512**
[    2.846536] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
[    2.853429] ubi0: good PEBs: 888, bad PEBs: 0, corrupted PEBs: 0
[    2.859527] ubi0: user volume: 9, internal volumes: 1, max. volumes count: 128
[    2.866848] ubi0: max/mean erase counter: 16/14, WL threshold: 4096, image sequence number: 1101292258
[    2.876291] ubi0: available PEBs: 0, total reserved PEBs: 888, PEBs reserved for bad PEB handling: 20
[    2.885723] ubi0: background thread "ubi_bgt0d" started, PID 345
[    2.895260] block ubiblock0_7: created from ubi0:7(rootfs)
[    2.900863] ubiblock: device ubiblock0_7 (rootfs) set to be root filesystem

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.