[Yaffs] YAFFS2 on LP NAND (still trying to make it work)

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Boris Deschenes
Date:  
To: yaffs
Subject: [Yaffs] YAFFS2 on LP NAND (still trying to make it work)
Hi guys,



Here's what I did up to now:



* Integrated latest MTD in my 2.6.17 linux

* Wrote a NAND device driver from scratch for our large page NAND.



This looks ok as far as I can tell (bus activity is what it should be
according to data book)

I can do nandwrite/nanddump and I have consistent stuff, I can even build
yaffs with the yaffs-for-latest-mtd patch posted by Vitali but I still have
problems sometimes



(writing a file sometimes results in a complaint about chunk not being
erased and the resulting file will have invalid checksum)



In the following trace, I flash_erase, mount, copy a file and unmount a
partition, the write has trouble with 2 chunks and the resulting file is
invalid (bad checksum). Sometimes, doing the exact same operation will
result in a valid file.



I am also worried about the tags values listed in the unmount block.



I should say that as of now, my low level driver does not pass any
information about OOB to the MTD. Should my low level driver tells MTD how
to handle OOB? I'm lost guys, if one of you can point me in the right
direction that would be greatly appreciated.



# flash_eraseall /dev/mtd0

Erasing 128 Kibyte @ 7e0000 -- 98 % complete.



# mount /dev/mtdblock0 /mnt

[4294777.821000] yaffs: dev is 32505856 name is "mtdblock0"

[4294777.827000] yaffs_read_super: Using yaffs1

[4294777.831000] yaffs_read_super: block size 4096

[4294777.836000] yaffs: Attempting MTD mount on 31.0, "mtdblock0"

[4294777.842000] erase 8027beb0

[4294777.845000] read 8027b8f0

[4294777.848000] write 8027bc48

[4294777.851000] readoob 8027bafc

[4294777.854000] writeoob 8027bd70

[4294777.857000] block_isbad 8027c074

[4294777.861000] block_markbad 8027c0c0

[4294777.865000] eccsize 0

[4294777.867000] oobsize 64

[4294777.870000] erasesize 131072

[4294777.873000] size 8388608

[4294777.876000] yaffs: auto selecting yaffs2

[4294777.880000] yaffs: yaffs_GutsInitialise()

[4294777.884000] restore entry: isCheckpointed 0

[4294777.889000] nandmtd2_ReadChunkWithTagsFromNAND chunk 0 data 00000000
tags 8490dac0

[4294777.897000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294777.903000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294777.911000] nandmtd2_ReadChunkWithTagsFromNAND chunk 64 data 00000000
tags 8490dac0

[4294777.919000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294777.925000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294777.933000] nandmtd2_ReadChunkWithTagsFromNAND chunk 128 data 00000000
tags 8490dac0

[4294777.941000] packed tags obj 65535 chunk 65535 byte -1 seq -1



[last block repeated many times]



[4294779.319000] found no more checkpt blocks

[4294779.323000] checkpoint byte count 0

[4294779.327000] restore exit: isCheckpointed 0

[4294779.332000] yaffs_ScanBackwards starts intstartblk 1 intendblk 64...

[4294779.338000] nandmtd2_QueryNANDBlock 0

[4294779.342000] nandmtd2_ReadChunkWithTagsFromNAND chunk 0 data 00000000
tags 8490db78

[4294779.350000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294779.356000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294779.364000] block is bad seq 0 state 3

[4294779.368000] Block scanning block 1 state 3 seq 0

[4294779.373000] Block empty

[4294779.376000] nandmtd2_QueryNANDBlock 1

[4294779.380000] nandmtd2_ReadChunkWithTagsFromNAND chunk 64 data 00000000
tags 8490db78

[4294779.388000] packed tags obj 65535 c[4294781.779000] 0 blocks to be
scanned

[4294781.783000] yaffs_ScanBackwards ends

[4294781.787000] yaffs: yaffs_GutsInitialise() done.

[4294781.787000]

[4294781.793000] yaffs_read_super: guts initialised OK

[4294781.798000] yaffs_read_super: got root inode

[4294781.803000] yaffs_read_super: d_alloc_root done

[4294781.808000] yaffs_read_super: done



# cd /mnt



# cp /tmp/file ./

[4294793.669000] yaffs_mknod: making oject for maiplayer, mode 81ed dev 0

[4294793.676000] yaffs: Tnodes added

[4294793.679000] Allocated block 1, seq 4097, 63 left

[4294793.684000] nandmtd2_ReadChunkWithTagsFromNAND chunk 0 data 8494c800
tags 84959b60

[4294793.692000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294793.698000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294793.706000] Writing chunk 0 tags 261 0

[4294793.710000] nandmtd2_WriteChunkWithTagsToNAND chunk 0 data 8114b000
tags 84959c08

[4294793.718000] packed tags obj 261 chunk 1 byte 0 seq 4097

[4294793.724000] ext.tags eccres 0 blkbad 0 chused 1 obj 261 chunk0 byte 0
del 0 ser 1 seq 4097

[4294793.738000] nandmtd2_ReadChunkWithTagsFromNAND chunk 1 data 8114b000
tags 84959af0

[4294793.748000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294793.754000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294793.762000] Writing chunk 1 tags 261 1hunk 65535 byte -1 seq -1

[4294779.394000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294779.402000] block is bad seq 0 state 3

[4294779.406000] Block scanning block 2 state 3 seq 0

[4294779.411000] Block empty

[.]

[4294793.813000] Writing chunk 2 tags 261 2

[4294793.817000] nandmtd2_WriteChunkWithTagsToNAND chunk 2 data 84943800
tags 84959be0

[4294793.825000] packed tags obj 261 chunk 2 byte 2048 seq 4097

[4294793.831000] ext.tags eccres 0 blkbad 0 chused 1 obj 261 chunk2 byte
2048 del 0 ser 1 seq 4097

[4294793.841000] nandmtd2_ReadChunkWithTagsFromNAND chunk 3 data 8114b000
tags 84959af0

[4294793.858000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294793.864000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294793.873000] Chunk 67 not erased

[4294793.876000] **>> yaffs chunk 67 was not erased

[4294793.881000] line 413 delete of chunk 67

[4294793.885000] nandmtd2_ReadChunkWithTagsFromNAND chunk 4 data 8114b000
tags 84959af0

[4294793.895000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294793.901000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294793.909000] Writing chunk 4 tags 261 3

[4294793.913000] nandmtd2_WriteChunkWithTagsToNAND chunk 4 data 84966000
tags 84959be0

[4294793.921000] packed tags obj 261 chunk 3 byte 2048 seq 4097

[4294793.926000] ext.tags eccres 0 blkbad 0 chused 1 obj 261 chunk3 byte
2048 del 0 ser 1 seq 4097

[4294793.936000] **>> yaffs write required 2 attempts

[.]

[4294794.175000] nandmtd2_WriteChunkWithTagsToNAND chunk 9 data 84968800
tags 84959be0

[4294794.183000] packed tags obj 261 chunk 8 byte 2048 seq 4097

[4294794.189000] ext.tags eccres 0 blkbad 0 chused 1 obj 261 chunk8 byte
2048 del 0 ser 1 seq 4097

[4294794.201000] nandmtd2_ReadChunkWithTagsFromNAND chunk 10 data 8114b000
tags 84959af0

[4294794.223000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294794.229000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294794.237000] Chunk 74 not erased

[4294794.241000] **>> yaffs chunk 74 was not erased

[4294794.245000] line 413 delete of chunk 74

[4294794.250000] nandmtd2_ReadChunkWithTagsFromNAND chunk 11 data 8114b000
tags 84959af0

[4294794.259000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294794.265000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[4294794.274000] Writing chunk 11 tags 261 9

[4294794.278000] nandmtd2_WriteChunkWithTagsToNAND chunk 11 data 84978000
tags 84959be0

[4294794.286000] packed tags obj 261 chunk 9 byte 2048 seq 4097

[4294794.291000] ext.tags eccres 0 blkbad 0 chused 1 obj 261 chunk9 byte
2048 del 0 ser 1 seq 4097

[4294794.301000] **>> yaffs write required 2 attempts

[.]

[4294796.413000] Writing chunk 52 tags 261 50

[4294796.418000] nandmtd2_WriteChunkWithTagsToNAND chunk 52 data 8498c800
tags 84959be0

[4294796.426000] packed tags obj 261 chunk 50 byte 2048 seq 4097

[4294796.431000] ext.tags eccres 0 blkbad 0 chused 1 obj 261 chunk50 byte
2048 del 0 ser 1 seq 4097

[4294796.441000] Chunk -1 not found zero instead

[4294796.446000] Chunk -1 not found zero instead

[4294796.451000] nandmtd2_ReadChunkWithTagsFromNAND chunk 53 data 8114b000
tags 84959af0

[4294796.461000] packed tags obj 65535 chunk 65535 byte -1 seq -1

[4294796.467000] ext.tags eccres 0 blkbad 0 chused 0 obj 0 chunk0 byte 0 del
0 ser 0 seq 0

[.]



# cd /



# umount /mnt

[4294809.072000] yaffs_put_inode: ino 261, count 1

[4294809.077000] yaffs_put_inode: ino 1, count 1

[4294809.082000] yaffs_put_inode: ino 261, count 1

[4294809.086000] yaffs_clear_inode: ino 1, count 0 object exists

[4294809.092000] yaffs_clear_inode: ino 261, count 0 object exists

[4294809.098000] save entry: isCheckpointed 0

[4294809.103000] checkpt blocks available = 58

[4294809.107000] checking blocks 0 to 63

[4294809.111000] allocating checkpt block 1

[4294809.115000] nandmtd2_WriteChunkWithTagsToNAND chunk 64 data 8495d000
tags 84959d38

[4294809.123000] packed tags obj 2 chunk 1 byte 2048 seq 33

[4294809.128000] ext.tags eccres 0 blkbad 48 chused -2129274880 obj 2 chunk1
byte 2048 del 0 ser -2070884308 seq 33

[4294809.139000] checkpoint byte count 1412

[4294809.143000] save exit: isCheckpointed 1