summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nand/nand_base.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c
index b039c3cd8..a5792cfb5 100644
--- a/drivers/nand/nand_base.c
+++ b/drivers/nand/nand_base.c
@@ -489,6 +489,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
return nand_write_oob (mtd, ofs , 2, &retlen, buf);
}
+#if READ_STATUS_BUG
/**
* nand_check_wp - [GENERIC] check if the chip is write protected
* @mtd: MTD device structure
@@ -503,7 +504,12 @@ static int nand_check_wp (struct mtd_info *mtd)
this->cmdfunc (mtd, NAND_CMD_STATUS, -1, -1);
return (this->read_byte(mtd) & 0x80) ? 0 : 1;
}
-
+#else
+static int nand_check_wp (struct mtd_info *mtd)
+{
+ return 0;
+}
+#endif
/**
* nand_block_checkbad - [GENERIC] Check if a block is marked bad
* @mtd: MTD device structure
@@ -1721,6 +1727,8 @@ static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
numpages = min (totalpages, ppblock);
page &= this->pagemask;
startpage = page;
+ oob = 0;
+ this->oobdirty = 1;
oobbuf = nand_prepare_oobbuf (mtd, eccbuf, oobsel,
autoplace, numpages);
/* Check, if we cross a chip boundary */
@@ -2145,13 +2153,14 @@ int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbb
instr->state = MTD_ERASING;
while (len) {
+#ifndef NAND_ALLOW_ERASE_ALL
/* Check if we have a bad block, we do not erase bad blocks ! */
if (nand_block_checkbad(mtd, ((loff_t) page) << this->page_shift, 0, allowbbt)) {
printk (KERN_WARNING "nand_erase: attempt to erase a bad block at page 0x%08x\n", page);
instr->state = MTD_ERASE_FAILED;
goto erase_exit;
}
-
+#endif
/* Invalidate the page cache, if we erase the block which contains
the current cached page */
if (page <= this->pagebuf && this->pagebuf < (page + pages_per_block))