在调试nand flash时遇到这样一个奇怪问题,发帖求助一下,请各位大神帮忙分析一下:
环境:
CPU0: P2020E, Version: 2.1, (0x80ea0021)
Core: E500, Version: 5.1, (0x80211051)
CPU0:800 MHz, CPU1:800 MHz,
uboot 2011.09 + linux 3.1.2
Nand Flash: K9K8G08UOE-SCBO
片选BR6/OR6: 0xdff0c21/0xFFFC7FE
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit) Options: 1431d
Creating 4 MTD partitions on "dff00000.flash":
0x000000000000-0x000010000000 : "data0"
ftl_cs: FTL header not found.
0x000010000000-0x000020000000 : "data1"
ftl_cs: FTL header not found.
0x000020000000-0x000030000000 : "data2"
ftl_cs: FTL header not found.
0x000030000000-0x000040000000 : "data3"
ftl_cs: FTL header not found.
eLBC NAND device at 0xdff00000, bank 6
linux下:
mkfs.jffs2 -b -o rootfs.jffs2 -r jffs2/ -p -s 0x800 -e 0x20000 -n
flash_eraseall /dev/mtd/mtd6
dd if=rootfs.jffs2 of=/dev/mtdblock/mtdblock6
256+0 records in
256+0 records out
131072 bytes (131 kB) copied, 1.24495 s, 105 kB/s
mount -t jffs2 /dev/mtdblock/mtdblock6 /mnt
这些步骤都没有问题,读映射后的目录/mnt 中文件也没有问题,但是往里面拷贝文件就报错了,
cp rootfs.jffs2 /mnt
fsl-lbc fffe05000.localbus: Parity or Uncorrectable ECC error: LTESR 0x20000001
jffs2_flush_wbuf(): Write failed with -5
Write of 1966 bytes at 0x0000a074 failed. returned -5, retlen 0
Not marking the space at 0x0000a074 as dirty because the flash driver returned retlen zero
经过加打印,发现数据只有部分写进去了,
nand_do_write_ops:02216=>realpage 20 page 20 blockmask 63 pagebuf 19
nand_do_write_ops:02229=>writelen 2048 bytes 2048 cached 0 wbuf df21f800
nand_do_write_ops:02250=>page 20 cached 0 mode 0 oob (null)
orig data comp:
19 85 e0 02 00 00 00 44 a4 ef 22 3e 00 00 00 03
00 00 00 01 00 00 81 ed 00 00 00 00 00 00 00 00
00 00 01 27 00 00 01 27 00 00 01 27 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
error data:
19 85 ff ff 00 00 ff ff a4 ef ff ff ff ff ff ff
00 00 ff ff 00 00 ff ff 00 00 00 00 00 00 00 00
00 00 ff ff 00 00 01 27 ff ff ff ff ff ff 00 00
00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00
用nanddump /dev/mtd/mtd6 -s 0x2800 -n -p -l 0x800 -o 看确实该page内容只有部分写进去了。而看用dd写进去的内容却是正确的。 他们都调用
nand_write_page函数来写flash的,传入的参数也差不多,但就是dd能写进去,cp不行。
请各位大神支支招。
flash |