summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-02-07 13:55:19 +0200
committerDavid Woodhouse <dwmw2@infradead.org>2007-02-09 15:16:55 +0000
commit480b9dfb1fbeb783d4c0061df7868c39af91afec (patch)
tree6f5ccc6694dd1c5af34fab442183ae87aa3f9ebb /drivers/mtd/onenand
parent678c857f3cffb076c36ce55dfa9fb570712cec12 (diff)
downloadop-kernel-dev-480b9dfb1fbeb783d4c0061df7868c39af91afec.zip
op-kernel-dev-480b9dfb1fbeb783d4c0061df7868c39af91afec.tar.gz
[MTD] OneNAND: Invalidate bufferRAM after erase
OneNAND has internal bufferRAMs. The driver keeps track of what is in the bufferRAM to save having to load from the NAND core. After an erase operation, the driver must mark bufferRAM invalid if it refers to the erased block. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r--drivers/mtd/onenand/onenand_base.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 779327b..a764579 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -636,6 +636,29 @@ static void onenand_update_bufferram(struct mtd_info *mtd, loff_t addr,
}
/**
+ * onenand_invalidate_bufferram - [GENERIC] Invalidate BufferRAM information
+ * @param mtd MTD data structure
+ * @param addr start address to invalidate
+ * @param len length to invalidate
+ *
+ * Invalidate BufferRAM information
+ */
+static void onenand_invalidate_bufferram(struct mtd_info *mtd, loff_t addr,
+ unsigned int len)
+{
+ struct onenand_chip *this = mtd->priv;
+ int i;
+ loff_t end_addr = addr + len;
+
+ /* Invalidate BufferRAM */
+ for (i = 0; i < MAX_BUFFERRAM; i++) {
+ loff_t buf_addr = this->bufferram[i].blockpage << this->page_shift;
+ if (buf_addr >= addr && buf_addr < end_addr)
+ this->bufferram[i].blockpage = -1;
+ }
+}
+
+/**
* onenand_get_device - [GENERIC] Get chip for selected access
* @param mtd MTD device structure
* @param new_state the state which is requested
@@ -1476,6 +1499,8 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
this->command(mtd, ONENAND_CMD_ERASE, addr, block_size);
+ onenand_invalidate_bufferram(mtd, addr, block_size);
+
ret = this->wait(mtd, FL_ERASING);
/* Check, if it is write protected */
if (ret) {
OpenPOWER on IntegriCloud