lkml.org 
[lkml]   [2010]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 07/14] MTD: nand: make MTD_OOB_PLACE work correctly.
Date
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>
---
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 279b960..53c1e04 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1229,6 +1229,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
int ret = 0;
uint32_t readlen = ops->len;
uint32_t oobreadlen = ops->ooblen;
+ uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ?
+ mtd->oobavail : mtd->oobsize;
+
uint8_t *bufpoi, *oob, *buf;

stats = mtd->ecc_stats;
@@ -1279,10 +1282,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
buf += bytes;

if (unlikely(oob)) {
+
/* Raw mode does data:oob:data:oob */
if (ops->mode != MTD_OOB_RAW) {
int toread = min(oobreadlen,
- chip->ecc.layout->oobavail);
+ max_oobsize);
if (toread) {
oob = nand_transfer_oob(chip,
oob, ops, toread);
--
1.6.3.3


\
 
 \ /
  Last update: 2010-02-17 22:55    [W:0.094 / U:24.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site