From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] [MTD] OneNAND: Invalidate bufferRAM after erase
Date: Fri, 09 Feb 2007 11:47:45 +0200 [thread overview]
Message-ID: <45CC4341.8080803@nokia.com> (raw)
In-Reply-To: <002f01c74bdf$98098760$c7a3580a@swcenter.sec.samsung.co.kr>
>From df9f430fa8198c7d60acdcf0c237a34916b5ac5b Mon Sep 17 00:00:00 2001
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
Date: Wed, 7 Feb 2007 13:55:19 +0200
Subject: [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>
---
drivers/mtd/onenand/onenand_base.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f690c19..cf66c93 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -628,6 +628,29 @@ static void onenand_update_bufferram(str
}
/**
+ * 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
@@ -1466,6 +1489,8 @@ static int onenand_erase(struct mtd_info
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) {
--
1.4.3
next prev parent reply other threads:[~2007-02-09 9:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-08 10:03 [PATCH] [MTD] OneNAND: Invalidate bufferRAM after erase Adrian Hunter
2007-02-09 0:16 ` Kyungmin Park
2007-02-09 9:47 ` Adrian Hunter [this message]
2007-02-09 15:17 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45CC4341.8080803@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.