Hello all,
I have managed to get the latest MTD code to compile with a 2.4.27-vrs1 kernel.
I compiled the latest YAFFS code (from CVS) into the kernel. I mounted a 16MB
block of Smartmedia NAND and tried to create some files, I got a load of errors
, I reset the machine because it was obviously going crazy. I then noticed that
my NAND suddenly had a load of "bad blocks"
Can someone help me out here, or tell me what sorts of debug information I have
to provide? I have provide some debug information:
* kernel boot messages:
...
SmartMedia card inserted.
NAND device: Manufacturer ID: 0x98, Chip ID: 0x75 (Toshiba NAND 32MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 1 at 0x00004000
Bad eraseblock 2 at 0x00008000
... SNIP ...
Bad eraseblock 1022 at 0x00ff8000
Bad eraseblock 1023 at 0x00ffc000
Creating 2 MTD partitions on "NAND 32MiB 3,3V 8-bit":
0x00000000-0x01000000 : "NAND partition 1"
mtd: Giving out device 4 to NAND partition 1
0x01000000-0x02000000 : "NAND partition 2"
mtd: Giving out device 5 to NAND partition 2
* The kernel boot finishes and I mount the NAND
/root # mount -t yaffs /dev/mtdblock/5 /mnt/y2
mtdblock_open
ok
yaffs: dev is 7941 name is "1f:05"
nand_read_oob: from = 0x01004000, len = 16
nand_read_oob: from = 0x01004200, len = 16
nand_read_oob: from = 0x01004000, len = 16
nand_read_oob: from = 0x01008000, len = 16
nand_read_oob: from = 0x01008200, len = 16
nand_read_oob: from = 0x01008000, len = 16
... SNIP ...
nand_read_oob: from = 0x01ff8000, len = 16
nand_read_oob: from = 0x01ff8200, len = 16
nand_read_oob: from = 0x01ff8000, len = 16
nand_read_oob: from = 0x01ffc000, len = 16
nand_read_oob: from = 0x01ffc200, len = 16
nand_read_oob: from = 0x01ffc000, len = 16
* I check out the /proc entry
y2 # cat /proc/yaffs
YAFFS built:Dec 2 2004 15:20:31
$Id: yaffs_fs.c,v 1.35 2004/10/20 20:12:43 charles Exp $
$Id: yaffs_guts.c,v 1.37 2004/10/20 20:12:43 charles Exp $
Device yaffs
startBlock......... 1
endBlock........... 1023
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 1023
nTnodesCreated..... 0
nFreeTnodes........ 0
nObjectsCreated.... 100
nFreeObjects....... 97
nFreeChunks........ 32736
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 0
nGCCopies.......... 0
garbageCollections. 0
passiveGCs......... 0
nRetriedWrites..... 0
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 1023
cacheHits.......... 0
nDeletedFiles...... 0
nUnlinkedFiles..... 0
nBackgroudDeletions 0
useNANDECC......... 0
* I cd to the /mnt/y2 directory and try to create a file (all hell breaks loose)
/root # cd /mnt/y2
y2 # touch 1
nand_read_ecc: from = 0x01004000, len = 512
nand_read_oob: from = 0x01004000, len = 16
nand_write_ecc: to = 0x01004000, len = 512
nand_write_oob: to = 0x01004000, len = 16
nand_read_ecc: from = 0x01004000, len = 512
nand_read_ecc: Failed ECC read, page 0x00008020
nand_read_ecc: Failed ECC read, page 0x00008020
nand_read_oob: from = 0x01004000, len = 16
nand_write_oob: to = 0x01004000, len = 16
nand_read_ecc: from = 0x01004200, len = 512
nand_read_oob: from = 0x01004200, len = 16
nand_write_ecc: to = 0x01004200, len = 512
nand_write_oob: to = 0x01004200, len = 16
nand_read_ecc: from = 0x01004200, len = 512
nand_read_ecc: Failed ECC read, page 0x00008021
nand_read_ecc: Failed ECC read, page 0x00008021
... SNIP ...
nand_read_ecc: from = 0x0101aa00, len = 512
nand_read_oob: from = 0x0101aa00, len = 16
nand_write_ecc: to = 0x0101aa00, len = 512
nand_write_oob: to = 0x0101aa00, len = 16
nand_read_ecc: from = 0x0101aa00, len = 512
nand_read_ecc: Failed ECC read, page 0x000080d5
... at which point it never ends, so I reset it
* After I reboot I get a load of bad blocks!
NAND device: Manufacturer ID: 0x98, Chip ID: 0x75 (Toshiba NAND 32MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 1 at 0x00004000
Bad eraseblock 2 at 0x00008000
Bad eraseblock 3 at 0x0000c000
... SNIP
Bad eraseblock 1021 at 0x00ff4000
Bad eraseblock 1022 at 0x00ff8000
Bad eraseblock 1023 at 0x00ffc000
I know that these blocks aren't bad, this is a brand new Flash chip! Is there
software that will verify every block and correctly mark it bad or not?
I tried some operations on the YAFFS partition, but get loads of errors:
/ # cd /mnt/y1
y1 # ll
nand_read_ecc: from = 0x00203800, len = 512
nand_read_ecc: Failed ECC read, page 0x0000101c
nand_read_ecc: Failed ECC read, page 0x0000101c
nand_read_ecc: from = 0x00203200, len = 512
nand_read_ecc: Failed ECC read, page 0x00001019
nand_read_ecc: Failed ECC read, page 0x00001019
nand_read_ecc: from = 0x00203000, len = 512
nand_read_ecc: Failed ECC read, page 0x00001018
nand_read_ecc: Failed ECC read, page 0x00001018
drw-rw-rw- 1 root root 512 Dec 2 15:03 ./
drwxrwxr-x 9 root 100 4096 Nov 11 10:17 ../
-rw-rw-r-- 1 root root 0 Nov 19 12:47 c
-rw-rw-r-- 1 root root 0 Nov 18 10:39 d
-rw-rw-r-- 1 root root 0 Nov 18 10:39 e
drw-rw-rw- 1 root root 512 Dec 2 15:03 lost+found/
y1 # df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/root 102901816 76756844 20917824 79% /
tmpfs 15428 360 15068 2% /var
/dev/mtdblock/4 16368 8884 7484 54% /mnt/y1
/dev/mtdblock/5 16368 180 16188 1% /mnt/y2
y1 # cd /mnt/y2
y2 # ll
nand_read_ecc: from = 0x0101aa00, len = 512
nand_read_ecc: Failed ECC read, page 0x000080d5
nand_read_ecc: Failed ECC read, page 0x000080d5
drw-rw-rw- 1 root root 512 Dec 2 15:08 ./
drwxrwxr-x 9 root 100 4096 Nov 11 10:17 ../
-rw-rw-r-- 1 root root 0 Dec 2 14:31 1
drw-rw-rw- 1 root root 512 Dec 2 15:08 lost+found/
y2 # df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/root 102901816 76756844 20917824 79% /
tmpfs 15428 364 15064 2% /var
/dev/mtdblock/4 16368 8884 7484 54% /mnt/y1
/dev/mtdblock/5 16368 180 16188 1% /mnt/y2
y2 #
You can see that there is loads of memory missing from /dev/mtdblock/4 !
* my linux/fs/yaffs directory
root@gentoo linux-2.4.27-vrs1-yaffs # ll fs/yaffs/
total 492
drwxrwxr-x 2 arasv users 4096 Dec 2 15:20 .
drwxrwxr-x 49 arasv users 4096 Dec 2 15:20 ..
-rw-rw-r-- 1 arasv users 7692 Dec 2 15:18 .depend
-rw-rw-r-- 1 root root 177 Dec 2 15:20 .yaffs.o.flags
-rw-rw-r-- 1 root root 610 Dec 2 15:20 .yaffs_ecc.o.flags
-rw-rw-r-- 1 root root 607 Dec 2 15:20 .yaffs_fs.o.flags
-rw-rw-r-- 1 root root 613 Dec 2 15:20 .yaffs_guts.o.flags
-rw-rw-r-- 1 root root 616 Dec 2 15:20 .yaffs_mtdif.o.flags
-rw-rw-r-- 1 root root 616 Dec 2 15:20 .yaffs_ramem.o.flags
-rw-rw-r-- 1 arasv users 4536 Dec 1 11:34 Makefile
-rw-rw-r-- 1 arasv users 4393 Dec 1 10:57 Makefile.old
-rw-r--r-- 1 arasv users 6139 Dec 1 14:35 devextras.h
-rw-rw-r-- 1 root root 62546 Dec 2 15:20 yaffs.o
-rw-r--r-- 1 arasv users 5537 Dec 1 11:15 yaffs_ecc.c
-rw-r--r-- 1 arasv users 970 Dec 1 11:15 yaffs_ecc.h
-rw-rw-r-- 1 root root 2132 Dec 2 15:20 yaffs_ecc.o
-rw-r--r-- 1 arasv users 42100 Dec 1 10:54 yaffs_fs.c
-rw-rw-r-- 1 root root 23080 Dec 2 15:20 yaffs_fs.o
-rw-r--r-- 1 arasv users 113357 Dec 1 10:54 yaffs_guts.c
-rw-r--r-- 1 arasv users 15691 Dec 1 14:35 yaffs_guts.h
-rw-rw-r-- 1 root root 38484 Dec 2 15:20 yaffs_guts.o
-rw-r--r-- 1 arasv users 4028 Dec 1 10:54 yaffs_mtdif.c
-rw-r--r-- 1 arasv users 1010 Dec 1 14:35 yaffs_mtdif.h
-rw-rw-r-- 1 root root 2000 Dec 2 15:20 yaffs_mtdif.o
-rw-r--r-- 1 arasv users 5173 Dec 1 11:20 yaffs_ramem.c
-rw-rw-r-- 1 root root 832 Dec 2 15:20 yaffs_ramem.o
-rw-r--r-- 1 arasv users 14604 Dec 1 11:15 yaffsdev.c
-rw-r--r-- 1 arasv users 53248 Dec 1 11:15 yaffsdev.proj
-rw-r--r-- 1 arasv users 659 Dec 1 10:54 yaffsinterface.h
-rw-r--r-- 1 arasv users 3032 Dec 1 14:35 yportenv.h
* This is the object list from the Makefile
obj-y := yaffs_fs.o yaffs_guts.o yaffs_ramem.o yaffs_mtdif.o yaffs_ecc.o
obj-m := $(O_TARGET)
I'm not entirely sure what options I should include in the Makefile either. I
want to use the latest MTD code with a NAND/Smartmedia device. Which options
should I include?
Thanks in advance!
regards,
Aras