Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274955
b: refs/heads/master
c: dadc17a
h: refs/heads/master
i:
  274953: 5e994c9
  274951: cf5f56c
v: v3
  • Loading branch information
Brian Norris authored and Artem Bityutskiy committed Sep 21, 2011
1 parent dca067a commit 6349454
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 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: 623978de362a5faeb18d8395fa86089650642626
refs/heads/master: dadc17a3e34810ed411a62e6b4cafdf3e5e1d5c8
12 changes: 8 additions & 4 deletions trunk/drivers/mtd/nand/nand_bbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,23 +909,19 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
writeops = 0x03;
} else if (td->pages[i] == -1) {
rd = md;
td->version[i] = md->version[i];
writeops = 0x01;
} else if (md->pages[i] == -1) {
rd = td;
md->version[i] = td->version[i];
writeops = 0x02;
} else if (td->version[i] == md->version[i]) {
rd = td;
if (!(td->options & NAND_BBT_VERSION))
rd2 = md;
} else if (((int8_t)(td->version[i] - md->version[i])) > 0) {
rd = td;
md->version[i] = td->version[i];
writeops = 0x02;
} else {
rd = md;
td->version[i] = md->version[i];
writeops = 0x01;
}
} else {
Expand Down Expand Up @@ -957,6 +953,7 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
if (mtd_is_eccerr(res)) {
/* Mark table as invalid */
rd->pages[i] = -1;
rd->version[i] = 0;
i--;
continue;
}
Expand All @@ -967,6 +964,7 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
if (mtd_is_eccerr(res2)) {
/* Mark table as invalid */
rd2->pages[i] = -1;
rd2->version[i] = 0;
i--;
continue;
}
Expand All @@ -976,6 +974,12 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
if (mtd_is_bitflip(res) || mtd_is_bitflip(res2))
writeops = 0x03;

/* Update version numbers before writing */
if (md) {
td->version[i] = max(td->version[i], md->version[i]);
md->version[i] = td->version[i];
}

/* Write the bad block table to the device? */
if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE)) {
res = write_bbt(mtd, buf, td, md, chipsel);
Expand Down

0 comments on commit 6349454

Please sign in to comment.