Other Parts Discussed in Thread: AM3359, TPS65910, TPS65217
Hi,
My board is using Micron MT29F4G16ABADAWP-IT with AM3359.
I've divided the NAND FLASH of 512MiB to two partitions, 256MiB each. So the first NAND partition address is 0 - 0FFFFFFF.
I've followed the instructions on http://processors.wiki.ti.com/index.php/UBIFS_Support
Creating ubifs.img and ubi.img:
sudo mkfs.ubifs -r /local/lizq/local/rootfs_min/ -F -o ubifs.img -m 2KiB -e 124KiB -c 1975 -v
sudo ubinize -o ubi.img -p 128KiB -m 2048 -s 512 -O 2048 ubinize.cfg -v
ubinize.cfg
--------------------------------------
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=239MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
"-c 1975" Calculation details
---------------------------------------------------------------------------------------------------
Symbol Meaning Value for XO test case
SP PEB Size (Physical Erase Block Size) 128KiB
SL LEB Size (Logic Erase Block Size) 128KiB - 2 * 2KiB = 124 KiB (=126976) (-e)
P Total number of PEBs on the MTD device 250MiB / 128KiB = 2000 //only use 250MiB out of 256MiB
B Number of PEBs reserved for bad PEB handling 1% of P = 20
O The overhead related to storing EC and VID headers in bytes, i.e. O = SP - SL 4KiB
UBI Overhead = (B + 4) * SP + O * (P - B - 4)
= (20 + 4) * 128KiB + 4 KiB * (2000 - 20 - 4)
= 3072KiB + 7904KiB
= 10976 KiB
= 85.75 PEBs (round to 86)
User Data
= 2000 - 86 = 1914 PEBs
= 1914 * 128KiB ~= 239MiB
-c <xxxx> xxxx = 1914 PEBs * 128KiB / 124KiB = 1975.74 = 1975 LEBs
In u-boot, use the commands to upgrade it on NAND FLASH (the ubi.img filesize is 0x1160000, fixed...):
tftp 82000000 ubi.img; mw.b 82000000 FF $filesize; nandecc hw 2; nand erase 0 10000000; nand write 82000000 0 $filesize;
Boot with the following bootargs:
console=ttyO0,115200n8 run_hardware_tests root=ubi0:rootfs rw ubi.mtd=11,2048 noinitrd rootfstype=ubifs rootwait=1 ip=none
boot log:
=========================================================
[ 0.938171] omap2-nand driver initializing
[ 0.942779] ONFI flash detected
[ 0.946411] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xcc (Micron NAND 512MiB 3,3V 16-bit)
[ 0.955780] Creating 2 MTD partitions on "omap2-nand.0":
[ 0.961334] 0x000000000000-0x000010000000 : "File System (Bank-A)"
[ 1.075286] 0x000010000000-0x000020000000 : "File System (Bank-B)"
[ 1.189117] OneNAND driver initializing
[ 1.193572] UBI: attaching mtd11 to ubi0
[ 1.197723] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1.204254] UBI: logical eraseblock size: 126976 bytes
[ 1.209869] UBI: smallest flash I/O unit: 2048
[ 1.214782] UBI: sub-page size: 512
[ 1.219604] UBI: VID header offset: 2048 (aligned 2048)
[ 1.225860] UBI: data offset: 4096
[ 1.494384] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 139:0, read 64 bytes
[ 1.508483] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 139:2048, read 512 bytes
[ 1.523071] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 140:0, read 64 bytes
[ 1.537170] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 140:2048, read 512 bytes
[ 1.551788] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 141:0, read 64 bytes
[ 1.565887] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 141:2048, read 512 bytes
[ 1.580505] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 142:0, read 64 bytes
[ 1.594604] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 142:2048, read 512 bytes
[ 1.609222] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 143:0, read 64 bytes
[ 1.623321] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 143:2048, read 512 bytes
[ 1.637908] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 144:0, read 64 bytes
[ 1.652008] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 144:2048, read 512 bytes
[ 1.666625] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 145:0, read 64 bytes
[ 1.680725] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 145:2048, read 512 bytes
[ 1.695343] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 146:0, read 64 bytes
[ 1.709442] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 146:2048, read 512 bytes
[ 1.724029] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 147:0, read 64 bytes
[ 1.738128] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 147:2048, read 512 bytes
[ 1.752746] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 148:0, read 64 bytes
[ 1.766845] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 148:2048, read 512 bytes
[ 1.781463] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 149:0, read 64 bytes
[ 1.795562] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 149:2048, read 512 bytes
[ 1.810180] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 150:0, read 64 bytes
[ 1.824279] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 150:2048, read 512 bytes
In Linux, got the same bad result by the following commands:
Create 10MiB ubi partition on /dev/mtd11
#############################################
ubiformat /dev/mtd11 -s 512 -O 2048
ubiattach /dev/ubi_ctrl -m 11 -O 2048
ubimkvol /dev/ubi0 -N ubifs_volume -s 10MiB
mount -t ubifs ubi0:ubifs_volume /mnt
BUUUUUT, when i burn the ubi.img in u-boot with "nandecc sw" and change "pdata->ecc_opt =OMAP_ECC_BCH8_CODE_HW" to "pdata->ecc_opt =OMAP_ECC_HAMMING_CODE_DEFAULT" in xxx_nand_init() in board-xxxx.c, the ubifs on NAND FLASH works well.
That is, HW ECC BCH8 failed while SW ECC works well with the same ubi.img on the NAND FLASH of the board.
Please help find what's wrong with HW ECC or my settings. Thank you!
