aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-02-07 06:55:19 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2007-02-09 10:16:55 -0500
commit480b9dfb1fbeb783d4c0061df7868c39af91afec (patch)
tree6f5ccc6694dd1c5af34fab442183ae87aa3f9ebb /drivers/mtd/onenand
parent678c857f3cffb076c36ce55dfa9fb570712cec12 (diff)
[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 779327b845d1..a7645794364c 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,
636} 636}
637 637
638/** 638/**
639 * onenand_invalidate_bufferram - [GENERIC] Invalidate BufferRAM information
640 * @param mtd MTD data structure
641 * @param addr start address to invalidate
642 * @param len length to invalidate
643 *
644 * Invalidate BufferRAM information
645 */
646static void onenand_invalidate_bufferram(struct mtd_info *mtd, loff_t addr,
647 unsigned int len)
648{
649 struct onenand_chip *this = mtd->priv;
650 int i;
651 loff_t end_addr = addr + len;
652
653 /* Invalidate BufferRAM */
654 for (i = 0; i < MAX_BUFFERRAM; i++) {
655 loff_t buf_addr = this->bufferram[i].blockpage << this->page_shift;
656 if (buf_addr >= addr && buf_addr < end_addr)
657 this->bufferram[i].blockpage = -1;
658 }
659}
660
661/**
639 * onenand_get_device - [GENERIC] Get chip for selected access 662 * onenand_get_device - [GENERIC] Get chip for selected access
640 * @param mtd MTD device structure 663 * @param mtd MTD device structure
641 * @param new_state the state which is requested 664 * @param new_state the state which is requested
@@ -1476,6 +1499,8 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
1476 1499
1477 this->command(mtd, ONENAND_CMD_ERASE, addr, block_size); 1500 this->command(mtd, ONENAND_CMD_ERASE, addr, block_size);
1478 1501
1502 onenand_invalidate_bufferram(mtd, addr, block_size);
1503
1479 ret = this->wait(mtd, FL_ERASING); 1504 ret = this->wait(mtd, FL_ERASING);
1480 /* Check, if it is write protected */ 1505 /* Check, if it is write protected */
1481 if (ret) { 1506 if (ret) {