diff options
author | Maxim Levitsky <maximlevitsky@gmail.com> | 2010-02-22 13:39:35 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-26 12:44:51 -0500 |
commit | 9aca334e854c319ccafea871006fda3814196e7b (patch) | |
tree | ae9fdbc2769d572997846e4f9d6db7b8d789e591 /drivers/mtd/nand | |
parent | 49ef3c6ee11e221b26caf4ac55c2702a37cca103 (diff) |
mtd: nand: make MTD_OOB_PLACE work correctly.
MTD_OOB_PLACE is supposed to read/write the raw oob data similiar to the
MTD_OOB_RAW however due to a bug, currently it is not possible to read
more data that is specified by the oob 'free' regions.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 7442b3a29b25..cada4cffacf8 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1420,6 +1420,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, | |||
1420 | int ret = 0; | 1420 | int ret = 0; |
1421 | uint32_t readlen = ops->len; | 1421 | uint32_t readlen = ops->len; |
1422 | uint32_t oobreadlen = ops->ooblen; | 1422 | uint32_t oobreadlen = ops->ooblen; |
1423 | uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ? | ||
1424 | mtd->oobavail : mtd->oobsize; | ||
1425 | |||
1423 | uint8_t *bufpoi, *oob, *buf; | 1426 | uint8_t *bufpoi, *oob, *buf; |
1424 | 1427 | ||
1425 | stats = mtd->ecc_stats; | 1428 | stats = mtd->ecc_stats; |
@@ -1470,10 +1473,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, | |||
1470 | buf += bytes; | 1473 | buf += bytes; |
1471 | 1474 | ||
1472 | if (unlikely(oob)) { | 1475 | if (unlikely(oob)) { |
1476 | |||
1473 | /* Raw mode does data:oob:data:oob */ | 1477 | /* Raw mode does data:oob:data:oob */ |
1474 | if (ops->mode != MTD_OOB_RAW) { | 1478 | if (ops->mode != MTD_OOB_RAW) { |
1475 | int toread = min(oobreadlen, | 1479 | int toread = min(oobreadlen, |
1476 | chip->ecc.layout->oobavail); | 1480 | max_oobsize); |
1477 | if (toread) { | 1481 | if (toread) { |
1478 | oob = nand_transfer_oob(chip, | 1482 | oob = nand_transfer_oob(chip, |
1479 | oob, ops, toread); | 1483 | oob, ops, toread); |