提交 9aca334e 编写于 作者: M Maxim Levitsky 提交者: David Woodhouse

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: NMaxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 49ef3c6e
...@@ -1420,6 +1420,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, ...@@ -1420,6 +1420,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
int ret = 0; int ret = 0;
uint32_t readlen = ops->len; uint32_t readlen = ops->len;
uint32_t oobreadlen = ops->ooblen; uint32_t oobreadlen = ops->ooblen;
uint32_t max_oobsize = ops->mode == MTD_OOB_AUTO ?
mtd->oobavail : mtd->oobsize;
uint8_t *bufpoi, *oob, *buf; uint8_t *bufpoi, *oob, *buf;
stats = mtd->ecc_stats; stats = mtd->ecc_stats;
...@@ -1470,10 +1473,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, ...@@ -1470,10 +1473,11 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
buf += bytes; buf += bytes;
if (unlikely(oob)) { if (unlikely(oob)) {
/* Raw mode does data:oob:data:oob */ /* Raw mode does data:oob:data:oob */
if (ops->mode != MTD_OOB_RAW) { if (ops->mode != MTD_OOB_RAW) {
int toread = min(oobreadlen, int toread = min(oobreadlen,
chip->ecc.layout->oobavail); max_oobsize);
if (toread) { if (toread) {
oob = nand_transfer_oob(chip, oob = nand_transfer_oob(chip,
oob, ops, toread); oob, ops, toread);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册