Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298088
b: refs/heads/master
c: df69862
h: refs/heads/master
v: v3
  • Loading branch information
Brian Norris authored and David Woodhouse committed Mar 26, 2012
1 parent 8bbdec8 commit edd8693
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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: f0e0c09b88b23ec418c065739096e198e8d6be22
refs/heads/master: df698621a5b39ced5ce527444cafd50c6fdc186d
13 changes: 7 additions & 6 deletions trunk/drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
nand_erase_nand(mtd, &einfo, 0);
}

if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
ofs += mtd->erasesize - mtd->writesize;

/* Get block number */
block = (int)(ofs >> chip->bbt_erase_shift);
if (chip->bbt)
Expand All @@ -424,11 +421,12 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
ret = nand_update_bbt(mtd, ofs);
else {
struct mtd_oob_ops ops;
loff_t wr_ofs = ofs;

nand_get_device(chip, mtd, FL_WRITING);

/*
* Write to first two pages if necessary. If we write to more
* Write to first/last page(s) if necessary. If we write to more
* than one location, the first error encountered quits the
* procedure.
*/
Expand All @@ -442,11 +440,14 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
ops.len = ops.ooblen = 1;
}
ops.mode = MTD_OPS_PLACE_OOB;

if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
wr_ofs += mtd->erasesize - mtd->writesize;
do {
ret = nand_do_write_oob(mtd, ofs, &ops);
ret = nand_do_write_oob(mtd, wr_ofs, &ops);

i++;
ofs += mtd->writesize;
wr_ofs += mtd->writesize;
} while (!ret && (chip->bbt_options & NAND_BBT_SCAN2NDPAGE) &&
i < 2);

Expand Down

0 comments on commit edd8693

Please sign in to comment.