Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274950
b: refs/heads/master
c: b61bf5b
h: refs/heads/master
v: v3
  • Loading branch information
Brian Norris authored and Artem Bityutskiy committed Sep 11, 2011
1 parent fdca76b commit 770576a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 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: c5e8ef9c21a492f1e0436b350bbc3e916f93e506
refs/heads/master: b61bf5bbf619fc66ca866a27038da0b91cafb92d
35 changes: 19 additions & 16 deletions trunk/drivers/mtd/nand/nand_bbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ static inline int nand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *b
*/
static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd)
{
int i, chips, writeops, chipsel, res;
int i, chips, writeops, create, chipsel, res;
struct nand_chip *this = mtd->priv;
struct nand_bbt_descr *td = this->bbt_td;
struct nand_bbt_descr *md = this->bbt_md;
Expand All @@ -889,15 +889,16 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc

for (i = 0; i < chips; i++) {
writeops = 0;
create = 0;
rd = NULL;
rd2 = NULL;
/* Per chip or per device? */
chipsel = (td->options & NAND_BBT_PERCHIP) ? i : -1;
/* Mirrored table available? */
if (md) {
if (td->pages[i] == -1 && md->pages[i] == -1) {
create = 1;
writeops = 0x03;
goto create;
} else if (td->pages[i] == -1) {
rd = md;
td->version[i] = md->version[i];
Expand All @@ -921,25 +922,27 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
}
} else {
if (td->pages[i] == -1) {
create = 1;
writeops = 0x01;
goto create;
} else {
rd = td;
}
rd = td;
}
goto writecheck;
create:
/* Create the bad block table by scanning the device? */
if (!(td->options & NAND_BBT_CREATE))
continue;

/* Create the table in memory by scanning the chip(s) */
if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
create_bbt(mtd, buf, bd, chipsel);
if (create) {
/* Create the bad block table by scanning the device? */
if (!(td->options & NAND_BBT_CREATE))
continue;

/* Create the table in memory by scanning the chip(s) */
if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
create_bbt(mtd, buf, bd, chipsel);

td->version[i] = 1;
if (md)
md->version[i] = 1;
}

td->version[i] = 1;
if (md)
md->version[i] = 1;
writecheck:
/* Read back first? */
if (rd)
read_abs_bbt(mtd, buf, rd, chipsel);
Expand Down

0 comments on commit 770576a

Please sign in to comment.