ybl_bj,
On Friday 08 June 2007 05:54,
ygl_bj@163.com wrote:
> 1. i use K9F1G08U0A(2048+64,64page/block,1024blocks/chip), in
> nand flash datasheet says "Samsung makes sure that either the
> 1st or 2nd page of every invalid block has non-FFh data at the
> column address of 2048". i port yaffs2 to vc++ 2005 and
> implement a simulation driver on pc. I find yaffs2 check bad
> block only checked the 1st page's 2048 byte. do yaffs2 already
> check the 2nd page's 2048 byte?
We also use a large page device with Yaffs, but with MTD, not the
direct interface. However I too saw a similar description of the
bad block marking for large page STMicroElectronics NAND01GW3B2AN6
chip. I added the function included below to our MTD nand driver to
implement this test. I also brought this up on the Yaffs list in 8/2005
but nobody agreed with my interpretation of the data-sheet text,
see
http://lists.aleph1.co.uk/pipermail/yaffs/2005q3/001413.html
and the next few messages that thread. Looking at both the
first and second pages certainly is not incorrect.
-imcd
/* Examine the 1st and 6th byte of the oob area in the 1st page of
* the specified block. Ref. STMicroelectronics datasheet page 36.
*/
static int
nand_large_block_bad(struct mtd_info *mtd, loff_t ofs, int dummy)
{
const struct nand_chip *chip = mtd->priv;
int addr = (int)ofs & ~(mtd->erasesize-1); /* 1st page in block */
int page = addr >> chip->page_shift;
unsigned char buf[6];
chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
chip->read_buf(mtd, buf, 6);
return (buf[0] != 0xff || buf[5] != 0xff);
}