 /* Apply delay or wait for ready/busy pin * Do this before the AUTOINCR check, so no problems * arise if a chip which does auto increment * is marked as NOAUTOINCR by the board driver. */ if (!this->dev_ready) udelay (this->chip_delay); else nand_wait_ready(mtd); 
static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf){	int i, col, page, chipnr;	struct nand_chip *this = mtd->priv;	int	blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;	DEBUG (MTD_DEBUG_LEVEL3, "nand_read_oob: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);	/* Shift to get page */	page = (int)(from >> this->page_shift);	chipnr = (int)(from >> this->chip_shift);		/* Mask to get column */	col = from & (mtd->oobsize - 1);	/* Initialize return length value */	*retlen = 0;	/* Do not allow reads past end of device */	if ((from + len) > mtd->size) {		DEBUG (MTD_DEBUG_LEVEL0, "nand_read_oob: Attempt read beyond end of device\n");		*retlen = 0;		return -EINVAL;	}	/* Grab the lock and see if the device is available */	nand_get_device (this, mtd , FL_READING);	/* Select the NAND device */	this->select_chip(mtd, chipnr);	/* Send the read command */	this->cmdfunc (mtd, NAND_CMD_READOOB, col, page & this->pagemask);	/* 	 * Read the data, if we read more than one page	 * oob data, let the device transfer the data !	 */	i = 0;	while (i < len) {		int thislen = mtd->oobsize - col;		thislen = min_t(int, thislen, len);		this->read_buf(mtd, &buf[i], thislen);		i += thislen;				/* Apply delay or wait for ready/busy pin 		 * Do this before the AUTOINCR check, so no problems		 * arise if a chip which does auto increment		 * is marked as NOAUTOINCR by the board driver.		*/		if (!this->dev_ready) 			udelay (this->chip_delay);		else			nand_wait_ready(mtd);		/* Read more ? */		if (i < len) {			page++;			col = 0;			/* Check, if we cross a chip boundary */			if (!(page & this->pagemask)) {				chipnr++;				this->select_chip(mtd, -1);				this->select_chip(mtd, chipnr);			}							/* Check, if the chip supports auto page increment 			 * or if we have hit a block boundary. 			*/ 			if (!NAND_CANAUTOINCR(this) || !(page & blockcheck)) {				/* For subsequent page reads set offset to 0 */			        this->cmdfunc (mtd, NAND_CMD_READOOB, 0x0, page & this->pagemask);			}		}	}	/* Deselect and wake up anyone waiting on the device */	nand_release_device(mtd);	/* Return happy */	*retlen = len;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/19870da7ea2fc483bf73a189046a430fd9b01391/nand_base.c/clean/drivers/mtd/nand/nand_base.c