Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332681
b: refs/heads/master
c: a7e6883
h: refs/heads/master
i:
  332679: 3beef21
v: v3
  • Loading branch information
Brian Norris authored and David Woodhouse committed Sep 29, 2012
1 parent b753552 commit 2348f47
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 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: 491ed06f334955578f0c43d298c46ea1a7ea9e1b
refs/heads/master: a7e68834fc273930c17e3decaddc13acb87a7dce
27 changes: 20 additions & 7 deletions trunk/drivers/mtd/nand/nand_bbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,24 @@ static int scan_read_raw_data(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
return mtd_read(mtd, offs, len, &retlen, buf);
}

/* Scan read raw data from flash */
/**
* scan_read_raw_oob - [GENERIC] Scan data+OOB region to buffer
* @mtd: MTD device structure
* @buf: temporary buffer
* @offs: offset at which to scan
* @len: length of data region to read
*
* Scan read data from data+OOB. May traverse multiple pages, interleaving
* page,OOB,page,OOB,... in buf. Completes transfer and returns the "strongest"
* ECC condition (error or bitflip). May quit on the first (non-ECC) error.
*/
static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
size_t len)
{
struct mtd_oob_ops ops;
int res;
int res, ret = 0;

ops.mode = MTD_OPS_RAW;
ops.mode = MTD_OPS_PLACE_OOB;
ops.ooboffs = 0;
ops.ooblen = mtd->oobsize;

Expand All @@ -306,15 +316,18 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
ops.oobbuf = buf + ops.len;

res = mtd_read_oob(mtd, offs, &ops);

if (res)
return res;
if (res) {
if (!mtd_is_bitflip_or_eccerr(res))
return res;
else if (mtd_is_eccerr(res) || !ret)
ret = res;
}

buf += mtd->oobsize + mtd->writesize;
len -= mtd->writesize;
offs += mtd->writesize;
}
return 0;
return ret;
}

static int scan_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
Expand Down

0 comments on commit 2348f47

Please sign in to comment.