summaryrefslogtreecommitdiff
path: root/drivers/mtd/onenand/onenand_bbt.c
diff options
context:
space:
mode:
authorKyungmin Park <kmpark@infradead.org>2008-08-19 08:42:53 +0900
committerScott Wood <scottwood@freescale.com>2008-08-21 13:50:20 -0500
commitbfd7f38614e21f745b6d6845fcc616ebc5e4d36f (patch)
treef72c120c39a8a6b51e57d22d600571e29aaa976e /drivers/mtd/onenand/onenand_bbt.c
parent8d765456c1d33f2010d2717ee58de7647fdc6346 (diff)
downloadu-boot-imx-bfd7f38614e21f745b6d6845fcc616ebc5e4d36f.zip
u-boot-imx-bfd7f38614e21f745b6d6845fcc616ebc5e4d36f.tar.gz
u-boot-imx-bfd7f38614e21f745b6d6845fcc616ebc5e4d36f.tar.bz2
Fix OneNAND read_oob/write_oob functions compatability
Also sync with kernel OneNAND codes Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'drivers/mtd/onenand/onenand_bbt.c')
-rw-r--r--drivers/mtd/onenand/onenand_bbt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index d13d277..dde11ae 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -68,6 +68,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t * buf,
int startblock;
loff_t from;
size_t readlen, ooblen;
+ struct mtd_oob_ops ops;
printk(KERN_INFO "Scanning device for bad blocks\n");
@@ -85,25 +86,26 @@ static int create_bbt(struct mtd_info *mtd, uint8_t * buf,
startblock = 0;
from = 0;
+ ops.mode = MTD_OOB_PLACE;
+ ops.ooblen = readlen;
+ ops.oobbuf = buf;
+ ops.len = ops.ooboffs = ops.retlen = ops.oobretlen = 0;
+
for (i = startblock; i < numblocks;) {
int ret;
for (j = 0; j < len; j++) {
- size_t retlen;
-
/* No need to read pages fully,
* just read required OOB bytes */
- ret = onenand_read_oob(mtd,
+ ret = onenand_bbt_read_oob(mtd,
from + j * mtd->writesize +
- bd->offs, readlen, &retlen,
- &buf[0]);
+ bd->offs, &ops);
- if (ret && ret != -EAGAIN) {
- printk("ret = %d\n", ret);
- return ret;
- }
+ /* If it is a initial bad block, just ignore it */
+ if (ret == ONENAND_BBT_READ_FATAL_ERROR)
+ return -EIO;
- if (check_short_pattern
+ if (ret || check_short_pattern
(&buf[j * scanlen], scanlen, mtd->writesize, bd)) {
bbm->bbt[i >> 3] |= 0x03 << (i & 0x6);
printk(KERN_WARNING