Philby,
I modified the nand_bbt.c like u-boot 1.2.0. the modification is only just
about the function create_bbt() :
*=============Partition line===============*
*the Italic is the Original and the bold is the modifictaion : *
static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct
nand_bbt_descr *bd, int chip)
{
struct nand_chip *this = mtd->priv;
int i, j, numblocks, len, scanlen;
int startblock;
loff_t from;
size_t readlen, ooblen;
printk (KERN_INFO "Scanning device for bad blocks\n");
if (bd->options & NAND_BBT_SCANALLPAGES)
len = 1 << (this->bbt_erase_shift - this->page_shift);
else {
if (bd->options & NAND_BBT_SCAN2NDPAGE)
len = 2;
else
len = 1;
}
*#if 0 /*the Orininal; modified by zsf*/
if (!(bd->options & NAND_BBT_SCANEMPTY)) {
/* We need only read few bytes from the OOB area */
scanlen = ooblen = 0;
readlen = bd->len;
} else {
/* Full page content should be read */
scanlen = mtd->oobblock + mtd->oobsize;
readlen = len * mtd->oobblock;
ooblen = len * mtd->oobsize;
}
#endif*
* scanlen = mtd->oobblock + mtd->oobsize;
readlen = len * mtd->oobblock;
ooblen = len * mtd->oobsize;*
if (chip == -1) {
/* Note that numblocks is 2 * (real numblocks) here, see i+=2 below as it
* makes shifting and masking less painful */
numblocks = mtd->size >> (this->bbt_erase_shift - 1);
startblock = 0;
from = 0;
} else {
if (chip >= this->numchips) {
printk (KERN_WARNING "create_bbt(): chipnr (%d) > available chips
(%d)\n",
chip + 1, this->numchips);
return -EINVAL;
}
numblocks = this->chipsize >> (this->bbt_erase_shift - 1);
startblock = chip * numblocks;
numblocks += startblock;
from = startblock << (this->bbt_erase_shift - 1);
}
*#if 0 /*the Orininal; modified by zsf*/
for (i = startblock; i < numblocks;) {
int ret;
if (bd->options & NAND_BBT_SCANEMPTY)
if ((ret = nand_read_raw (mtd, buf, from, readlen, ooblen)))
return ret;*
* for (j = 0; j < len; j++) {
if (!(bd->options & NAND_BBT_SCANEMPTY)) {
size_t retlen;
/* Read the full oob until read_oob is fixed to
* handle single byte reads for 16 bit buswidth */
ret = mtd->read_oob(mtd, from + j * mtd->oobblock,
mtd->oobsize, &retlen, buf);
if (ret)
return ret;*
* if (check_short_pattern (buf, bd)) {
this->bbt[i >> 3] |= 0x03 << (i & 0x6);
printk (KERN_WARNING "check_short_pattern:Bad eraseblock %d at
0x%08x\n",
i >> 1, (unsigned int) from);
break;
}
} else {
if (check_pattern (&buf[j * scanlen], scanlen, mtd->oobblock, bd)) {
this->bbt[i >> 3] |= 0x03 << (i & 0x6);
printk (KERN_WARNING "check_short_pattern: Bad eraseblock %d at
0x%08x\n",
i >> 1, (unsigned int) from);
break;
}
}
}
i += 2;
from += (1 << this->bbt_erase_shift);
}
*#endif
*#if 1 /*the modification; modified by zsf*/
for (i = startblock; i < numblocks;) {
nand_read_raw (mtd, buf, from, readlen, ooblen);
for (j = 0; j < len; j++) {
if (check_pattern (&buf[j * scanlen], scanlen, mtd->oobblock, bd)) {
this->bbt[i >> 3] |= 0x03 << (i & 0x6);
printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
i >> 1, (unsigned int) from);
break;
}
}
i += 2;
from += (1 << this->bbt_erase_shift);
}
#endif
* return 0;
}
*=============Partition line===============*
when I modified like the above, the kernel found out the few bad blocks:
*=============Partition line===============*
NAND device: Manufacturer ID: 0x20, Chip ID: 0xa1 (ST Micro NAND 128MiB 1,8V
8-bit)
Scanning device for bad blocks
Bad eraseblock 1 at 0x00020000
Bad eraseblock 2 at 0x00040000
Bad eraseblock 6 at 0x000c0000
Bad eraseblock 7 at 0x000e0000
Bad eraseblock 35 at 0x00460000
Bad eraseblock 36 at 0x00480000
Bad eraseblock 37 at 0x004a0000
Bad eraseblock 38 at 0x004c0000
Bad eraseblock 39 at 0x004e0000
Bad eraseblock 40 at 0x00500000
Bad eraseblock 41 at 0x00520000
Creating 5 MTD partitions on "nand_davinci.0":
0x00000000-0x00040000 : "bootloader"
0x00040000-0x00060000 : "params"
0x00060000-0x00460000 : "kernel"
0x00460000-0x00860000 : "FPGA-Config Image"
0x00860000-0x08000000 : "filesystem"
nand_davinci: hardware revision: 2.1
*=============Partition line===============*
and I will try as your advices later. If you have any new idea, please
connect with me freely. Thank you very much!
Best Wishes,
Zhang
2009/3/23 Philby John <[email protected]>
> Zhang,
>
> Please keep the mailing list in the loop, someone might have a
> solution
> or could use your solution.
>
> On Mon, 2009-03-23 at 11:18 +0800, shaofeng zhang wrote:
> > Dear Sir,
>
> Sorry, let me introduce myself, my name is Philby.
> >
> > I am sorry to reply your email lately. Because we were rendering our
> > lab's wall these days.
> >
> > And I try to define the YAFFS_IGNORE_TAGS_ECC in the
> > fs/yaffs2/yaffs_ecc.h
> > but there is still the error message:
> >
> > r...@xjtuipcevm:~# df -h
> > Filesystem Size Used Avail Use% Mounted on
> > rootfs 38G 28G 8.0G 78% /
> > /dev/root 38G 28G 8.0G 78% /
> > none 10M 2.5M 7.6M 25% /dev
> > tmpfs 59M 0 59M 0% /tmp
> > none 10M 2.5M 7.6M 25% /dev
> > tmpfs 59M 0 59M 0% /dev/shm
> > /dev/mtdblock4 120M 120M 0 100% /mnt/nand
> > And I should tell you that before I modified
> > the /drivers/mtd/nand/nand_bbt.c, there is a mistake when the linux
> > kernel is starting:
> > my board can automaticly boots from the NAND flash througth TI UBL and
> > U-boot 1.2.0. But when starting the linux kernel, there will be the
> > warning messages like this:
> > Starting kernel ...
> > Uncompressing
> >
> Linux.................................................................................................................................done.
> Booting the kernel.
> > ................(the pre-messages is omitted)
> > NAND device: Manufacturer ID: 0x20, Chip ID: 0xa1 (ST Micro NAND
> > 128MiB 1,8V 8-bit)
> > Scanning device for bad blocks
> > Bad eraseblock 0 at 0x00000000
> > Bad eraseblock 1 at 0x00020000
> > Bad eraseblock 2 at 0x00040000
> > ...........
> > Bad eraseblock 1020 at 0x07f80000
> > Bad eraseblock 1021 at 0x07fa0000
> > Bad eraseblock 1022 at 0x07fc0000
> > Bad eraseblock 1023 at 0x07fe0000
> > ...........
> > and My Nand Flash is STMICRO's product: NAND01GR3B2B, whose
> > infomation is the following tips: Manufacturer ID = 0x20, Device ID
> > = 0xA1,Pages Per Block = 0x40,Number of Blocks = 0x400,Bytes Per Page
> > = 0x800.
> >
> > I now that the UBL and U-boot can boot from the NAND flash, so I
> > changed the nand_bbt.c(/drivers/mtd/nand/nand_bbt.c) the same as the
> > u-boot/drives/nand/nand_bbt.c,and the kernel mesage shows that there
> > are few bad blocks in the nand flash.
>
> What modifications have you done in nand_bbt.c ? After your
> modifications, yaffs2 reports lesser error? How few are the reported bad
> blocks? All NAND based flash devices contain some bad blocks at
> manufacture, so if its really few then it shouldn't be a cause of worry.
>
> >
> > So what is your advice when you are facing this problem? I guess
> > there may be some faults in the nand_bbt.c(driveis/mtd/nand)? Is it?
>
> I have no idea. But here are some steps you could do to narrow the cause
> of your problem.
>
> 1) Switch to jffs2 to see if the problem goes away. If yes, you could
> use jffs2 or start debugging the yaffs2 fs code. Turn on debugging using
> echo all > /proc/yaffs before mounting the fs.
>
> 2) Switch to using btt on RAM instead of flash and see if the problem
> exists? You could so this by changing to this->options |=
> (NAND_USE_DATA_ADJACENT_OOB); in function nand_davinci_probe() -> case
> NAND_ECC_HW_SYNDROME:
> ie: get rid of the NAND_USE_FLASH_BBT option.
>
> 3)Erase mtdblock4 partition from Uboot specifying the offset to the
> start of your nand fs and the size of your fs (mtdblock4)
> eg: nand erase 0x2400000 0x5e00000
> This will clear all your previous factory marked bbt entries, so use
> this at your discretion.
>
>
> Regards,
> Philby
>
> >
> >
> > 2009/3/19 Philby John <[email protected]>
> > Zhang,
> >
> > You could try defining YAFFS_IGNORE_TAGS_ECC in
> > fs/yaffs2/yaffs_ecc.h
> > and give it a shot. If this works it would mean, h/w ECC uses
> > up the OOB
> > spare area leaving no space
> > for YAFFS2 to mark bad blocks hence showing 100% usage.
> >
> > Regards,
> > Philby
> >
> >
> >
> > On Wed, 2009-03-18 at 12:55 -0500, Narnakaje, Snehaprabha
> > wrote:
> > > Zhang,
> > >
> > >
> > >
> > > Which software codebase/release are you using here on DM6446
> > EVM?
> > >
> > >
> > >
> > > The default NAND configuration for DM6446 EVM is to use a
> > small block
> > > NAND flash (with page size = 512bytes) and 1-bit HW ECC. If
> > the driver
> > > configuration does not match with what the NAND device
> > expects, all
> > > blocks of the NAND device can come back as bad blocks. In
> > which case,
> > > the corresponding partition will have 100% space used.
> > >
> > >
> > >
> > > Thanks
> > >
> > > Sneha
> > >
> > >
> > >
> > >
> > >
> >
> ______________________________________________________________________
> > >
> > From:[email protected]<from%[email protected]>
> > >
> > [mailto:[email protected]]
> On
> > > Behalf Of shaofeng zhang
> > > Sent: Tuesday, March 17, 2009 11:22 PM
> > > To: [email protected]
> > > Subject: Problem with YAFFS2 on LargePage NAND
> > >
> > >
> > >
> > >
> > > Hi, All,
> > >
> > >
> > >
> > >
> > >
> > > I am using a 128MB LargePage Nand Flash on my DVEVM board
> > (DM6446),
> > > and when I mount the /dev/mtdblock4 throught YAFFS2 fs type,
> > I found
> > > that the use% of my nand is 100% as the following:
> > >
> > >
> > >
> > > Filesystem Size Used Avail Use% Mounted on
> > > rootfs 38G 28G 8.0G 78% /
> > > /dev/root 38G 28G 8.0G 78% /
> > > none 10M 2.5M 7.6M 25% /dev
> > > tmpfs 59M 0 59M 0% /tmp
> > > none 10M 2.5M 7.6M 25% /dev
> > > tmpfs 59M 0 59M 0% /dev/shm
> > > /dev/mtdblock4 120M 120M 0 100% /mnt/nand
> > >
> > >
> > >
> > >
> > >
> > > But I first use flash_eraseall to erase the /dev/mtd4 before
> > mounting
> > > the /dev/mtdblock4 with YAFFS2
> > >
> > >
> > >
> > >
> > >
> > > Could anyone tell me some info about the message?
> > >
> > >
> > > Thank you!
> > >
> > >
> > >
> > >
> > >
> > > Best Wishes,
> > >
> > >
> > > Zhang
> > >
> > >
> >
> > > _______________________________________________
> > > Davinci-linux-open-source mailing list
> > > [email protected]
> >
> > >
> >
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
> >
> >
>
>
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source