Chinaunix首页 | 论坛 | 博客
  • 博客访问: 455474
  • 博文数量: 724
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 14:47
文章分类

全部博文(724)

文章存档

2011年(1)

2008年(723)

我的朋友

分类:

2008-10-13 16:57:23

Yaffs2的ecc校验

 

S3C2410的一个板子上移植内核2.6.14和yaffs2文件系统,但ecc校验总是设置不对,总是警告未使用ecc校验,内核配置如下

Device Drivers --->
Memory Technology Devices (MTD) --->
   NAND Flash Device Drivers --->

·  NAND Device Support

[ ] Verify NAND page writes

·  NAND Flash support for S3C2410/S3C2440 SoC

·  S3C2410 NAND driver debug

[ ] S3C2410 NAND Hardware ECC

File systems --->
    Miscellaneous filesystems --->

·  YAFFS2 file system support

 --- 512 byte / page devices

·  Lets Yaffs do its own ECC

·  Use the same ecc byte order as Steven Hill's nand_ecc.c

 --- 2048 byte (or larger) / page devices 

·  Autoselect yaffs2 format 

·  Disable lazy loading 

·  Turn off wide tnodes 

·  Turn off debug chunk erase check 

·  Cache short names in RAM

 

drivers/mtd/nand/s3c2410.c中使用chip->eccmode = NAND_ECC_SOFT;

kernel启动没有出现警告,通过nfs启动后,安装文件系统

mount -t yaffs /dev/mtdblock/3 /mnt
cd mnt
tar xvzf /fa-yaffs-v5.tgz

然后就出现如下警告
./
Reading data from NAND FLASH without ECC is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
./bin/
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
……………………………………………………………………
省略几千行

 

耐心等文件系统解压完后,使用/dev/mtdblock/3能正常启动,但只要读/写文件系统内容就会出现上述的警告,看着真是不爽。

上网查看说去掉这种警告有两种方法

1.  去掉警告信息(~掩耳盗铃@_@)

2.  使用MTDecc校验,而不使用yaffs2ecc校验(不知道到底为什么)

在内核选项中去掉Lets Yaffs do its own ECC这个选项,果然成功了。

察看yaffs2源码

yaffs_mtdif.c有如下内容:

if (data && spare) {

        if (dev->useNANDECC) {  /* 配置了Lets Yaffs do its own ECC选项 */

            retval =

                mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,

                      &dummy, data, spareAsBytes,

                      &yaffs_oobinfo);

        } else {

            retval =

                mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,

                      &dummy, data, spareAsBytes,

                      &yaffs_noeccinfo);

        }

mtd关于nand的驱动中nand_base.c有如下内容:

static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,

              size_t * retlen, u_char * buf, u_char * oob_buf, struct nand_oobinfo *oobsel)

{

    /* use userspace supplied oobinfo, if zero */

    if (oobsel == NULL) /* 当使用yaffs_noeccinfo时,条件语句为真 */

        oobsel = &mtd->oobinfo;

    return nand_do_read_ecc(mtd, from, len, retlen, buf, oob_buf, oobsel, 0xff);

}

nand_do_read_ecc函数中有

eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE;

 

在使用yaffs2的ecc校验时在这句就把eccmode赋值为NAND_ECC_NONE(要不就不会出现警告),也就是说oobsel->useecc的值为0,真不知道对不对,使用yaffs2自己的ecc校验时怎么会把这个选项置为0呢?但是从实验看这个猜测应该是对的!

 

真不知道yaffs2的ECC校验和MTD的ECC校验之间到底是个什么样的关系!不知道大家有什么意见!

 


--------------------next---------------------
你好,下面是我的启动信息,我开了yaffs ecc校验,挂载的mtdblock3,但是flash里面还没有烧文件系统映象,这样正常么?
VIVI version 0.1.4 (root@capdev) (gcc version 2.95.3 20010315 (release)) #0.1.4 五 6月 10 00:59:48 CST 2005
MMU table base address = 0x33DFC000
Succeed memory mapping.
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Found saved vivi parameters.
Press Return to start the LINUX now, any other key for vivi
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x00100000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0"
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux................................................................. done, booting the kernel.
Linux version 2.6.11.1 (root@DaleYoungLinux) (gcc version 3.4.1) #5 Tue Dec 26 21:16:51 CST 2006
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410 (id 0x32410000)
S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C2410 Clock control, (c) 2004 Simtec Electronics
Built 1 zonelists
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
irq: clearing subpending status 00000002
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64MB = 64MB total
Memory: 62752KB available (1619K code, 327K data, 92K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410: Initialising architecture
S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
NetWinder Floating Point Emulator V0.97 (double precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: devfs_debug: 0x0
devfs: boot_options: 0x1
yaffs Dec 26 2006 20:35:19 Installing. 
Console: switching to colour frame buffer device 80x25
fb0: Virtual frame buffer device, using 1024K of video memory
s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
--------------------next---------------------
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)
eth0: CS8900A rev C at 0xe0000300 irq=53, no eeprom , addr: 08: 0:3E:26:0A:5B
S3C2410 NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand: mapped registers at c4980000
s3c2410-nand: timing: Tacls 30ns, Twrph0 70ns, Twrph1 30ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 77 at 0x00134000
Bad eraseblock 78 at 0x00138000
Bad eraseblock 79 at 0x0013c000
Bad eraseblock 80 at 0x00140000
Bad eraseblock 81 at 0x00144000
Bad eraseblock 82 at 0x00148000
Creating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00020000 : "vivi"
0x00020000-0x00030000 : "param"
0x00030000-0x00130000 : "kernel"
0x00130000-0x01a30000 : "root"
0x01a30000-0x04000000 : "user"
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
NET: Registered protocol family 1
end_request: I/O error, dev mtdblock3, sector 2
EXT2-fs: unable to read superblock
end_request: I/O error, dev mtdblock3, sector 0
romfs: unable to read superblock
yaffs: dev is 32505859 name is "mtdblock3"
yaffs: Attempting MTD mount on 31.3, "mtdblock3"
block 2 is bad
block 3 is bad
block 4 is bad
block 5 is bad
block 6 is bad
block 7 is bad
Reading data from NAND FLASH without ECC is not recommended
**>>yaffs ecc error unfixed on chunk 1017:0
**>>yaffs ecc error unfixed on chunk 1017:1
**>>Block 31 marked for retirement
**>>yaffs ecc error unfixed on chunk 1019:1
**>>Block 31 marked for retirement
...........................................
--------------------next---------------------

阅读(425) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~