aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/nand_base.c19
-rw-r--r--drivers/mtd/nand/nand_bbt.c26
-rw-r--r--include/linux/mtd/mtd.h4
3 files changed, 30 insertions, 19 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 138674183c1c..51dfea1b3ce6 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1474,18 +1474,13 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1474 1474
1475 if (unlikely(oob)) { 1475 if (unlikely(oob)) {
1476 1476
1477 /* Raw mode does data:oob:data:oob */ 1477 int toread = min(oobreadlen, max_oobsize);
1478 if (ops->mode != MTD_OOB_RAW) { 1478
1479 int toread = min(oobreadlen, 1479 if (toread) {
1480 max_oobsize); 1480 oob = nand_transfer_oob(chip,
1481 if (toread) { 1481 oob, ops, toread);
1482 oob = nand_transfer_oob(chip, 1482 oobreadlen -= toread;
1483 oob, ops, toread); 1483 }
1484 oobreadlen -= toread;
1485 }
1486 } else
1487 buf = nand_transfer_oob(chip,
1488 buf, ops, mtd->oobsize);
1489 } 1484 }
1490 1485
1491 if (!(chip->options & NAND_NO_READRDY)) { 1486 if (!(chip->options & NAND_NO_READRDY)) {
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 55c23e5cd210..387c45c366fe 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -237,15 +237,33 @@ static int scan_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
237 size_t len) 237 size_t len)
238{ 238{
239 struct mtd_oob_ops ops; 239 struct mtd_oob_ops ops;
240 int res;
240 241
241 ops.mode = MTD_OOB_RAW; 242 ops.mode = MTD_OOB_RAW;
242 ops.ooboffs = 0; 243 ops.ooboffs = 0;
243 ops.ooblen = mtd->oobsize; 244 ops.ooblen = mtd->oobsize;
244 ops.oobbuf = buf;
245 ops.datbuf = buf;
246 ops.len = len;
247 245
248 return mtd->read_oob(mtd, offs, &ops); 246
247 while (len > 0) {
248 if (len <= mtd->writesize) {
249 ops.oobbuf = buf + len;
250 ops.datbuf = buf;
251 ops.len = len;
252 return mtd->read_oob(mtd, offs, &ops);
253 } else {
254 ops.oobbuf = buf + mtd->writesize;
255 ops.datbuf = buf;
256 ops.len = mtd->writesize;
257 res = mtd->read_oob(mtd, offs, &ops);
258
259 if (res)
260 return res;
261 }
262
263 buf += mtd->oobsize + mtd->writesize;
264 len -= mtd->writesize;
265 }
266 return 0;
249} 267}
250 268
251/* 269/*
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 11d8e68d17c0..5326435a7571 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -60,9 +60,7 @@ struct mtd_erase_region_info {
60 * MTD_OOB_PLACE: oob data are placed at the given offset 60 * MTD_OOB_PLACE: oob data are placed at the given offset
61 * MTD_OOB_AUTO: oob data are automatically placed at the free areas 61 * MTD_OOB_AUTO: oob data are automatically placed at the free areas
62 * which are defined by the ecclayout 62 * which are defined by the ecclayout
63 * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data 63 * MTD_OOB_RAW: mode to read oob and data without doing ECC checking
64 * is inserted into the data. Thats a raw image of the
65 * flash contents.
66 */ 64 */
67typedef enum { 65typedef enum {
68 MTD_OOB_PLACE, 66 MTD_OOB_PLACE,