Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4496
b: refs/heads/master
c: 3b88775
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and Thomas Gleixner committed May 23, 2005
1 parent 58eee04 commit ba28680
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dfd61294403cce7ca2263674f420c3417093cb56
refs/heads/master: 3b88775c7504dfdedd5f267cb8f02999e380222a
37 changes: 26 additions & 11 deletions trunk/drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* The AG-AND chips have nice features for speed improvement,
* which are not supported yet. Read / program 4 pages in one go.
*
* $Id: nand_base.c,v 1.133 2005/02/16 09:39:35 gleixner Exp $
* $Id: nand_base.c,v 1.134 2005/02/22 21:56:46 gleixner Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -509,6 +509,22 @@ static int nand_block_checkbad (struct mtd_info *mtd, loff_t ofs, int getchip, i
return nand_isbad_bbt (mtd, ofs, allowbbt);
}

/*
* Wait for the ready pin, after a command
* The timeout is catched later.
*/
static void nand_wait_ready(struct mtd_info *mtd)
{
struct nand_chip *this = mtd->priv;
unsigned long timeo = jiffies + 2;

/* wait until command is processed or timeout occures */
do {
if (this->dev_ready(mtd))
return;
} while (time_before(jiffies, timeo));
}

/**
* nand_command - [DEFAULT] Send command to NAND device
* @mtd: MTD device structure
Expand Down Expand Up @@ -604,12 +620,11 @@ static void nand_command (struct mtd_info *mtd, unsigned command, int column, in
return;
}
}

/* Apply this short delay always to ensure that we do wait tWB in
* any case on any machine. */
ndelay (100);
/* wait until command is processed */
while (!this->dev_ready(mtd));

nand_wait_ready(mtd);
}

/**
Expand Down Expand Up @@ -720,12 +735,12 @@ static void nand_command_lp (struct mtd_info *mtd, unsigned command, int column,
return;
}
}

/* Apply this short delay always to ensure that we do wait tWB in
* any case on any machine. */
ndelay (100);
/* wait until command is processed */
while (!this->dev_ready(mtd));

nand_wait_ready(mtd);
}

/**
Expand Down Expand Up @@ -1011,7 +1026,7 @@ static int nand_verify_pages (struct mtd_info *mtd, struct nand_chip *this, int
if (!this->dev_ready)
udelay (this->chip_delay);
else
while (!this->dev_ready(mtd));
nand_wait_ready(mtd);

/* All done, return happy */
if (!numpages)
Expand Down Expand Up @@ -1302,7 +1317,7 @@ int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
if (!this->dev_ready)
udelay (this->chip_delay);
else
while (!this->dev_ready(mtd));
nand_wait_ready(mtd);

if (read == len)
break;
Expand Down Expand Up @@ -1401,7 +1416,7 @@ static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t
if (!this->dev_ready)
udelay (this->chip_delay);
else
while (!this->dev_ready(mtd));
nand_wait_ready(mtd);

/* Read more ? */
if (i < len) {
Expand Down Expand Up @@ -1481,7 +1496,7 @@ int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len,
if (!this->dev_ready)
udelay (this->chip_delay);
else
while (!this->dev_ready(mtd));
nand_wait_ready(mtd);

/* Check, if the chip supports auto page increment */
if (!NAND_CANAUTOINCR(this) || !(page & blockcheck))
Expand Down

0 comments on commit ba28680

Please sign in to comment.