[MTD] OneNAND: Handle DDP chip boundary during read-while-load

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jan 11 09:59:04 EST 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=0fc2ccea4c8fa779053cb6f8984f6da399a81182
Commit:     0fc2ccea4c8fa779053cb6f8984f6da399a81182
Parent:     b3c9f8bfe7ab366a5d2495ebe5d2dc6fd7368122
Author:     Adrian Hunter <ext-adrian.hunter at nokia.com>
AuthorDate: Tue Jan 9 17:55:21 2007 +0200
Committer:  Artem Bityutskiy <dedekind at infradead.org>
CommitDate: Wed Jan 10 15:05:22 2007 +0200

    [MTD] OneNAND: Handle DDP chip boundary during read-while-load
    
    The read-while-load method of reading from OneNAND needs to allow
    for the change of bufferRAM address at the boundary between the
    two chips in a double density (DDP) device.
    
    Signed-off-by: Adrian Hunter <ext-adrian.hunter at nokia.com>
    Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
 drivers/mtd/onenand/onenand_base.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 2ea07f5..2da6bb2 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -710,7 +710,7 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
 	struct mtd_ecc_stats stats;
 	int read = 0, column;
 	int thislen;
-	int ret = 0;
+	int ret = 0, boundary = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL3, "onenand_read: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);
 
@@ -749,6 +749,17 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
  		from += thislen;
  		if (read + thislen < len) {
  			this->command(mtd, ONENAND_CMD_READ, from, mtd->writesize);
+ 			/*
+ 			 * Chip boundary handling in DDP
+ 			 * Now we issued chip 1 read and pointed chip 1
+ 			 * bufferam so we have to point chip 0 bufferam.
+ 			 */
+ 			if (this->device_id & ONENAND_DEVICE_IS_DDP &&
+ 					unlikely(from == (this->chipsize >> 1))) {
+ 				this->write_word(0, this->base + ONENAND_REG_START_ADDRESS2);
+ 				boundary = 1;
+ 			} else
+ 				boundary = 0;
  			ONENAND_SET_PREV_BUFFERRAM(this);
  		}
  		/* While load is going, read from last bufferRAM */
@@ -758,6 +769,8 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
  		if (read == len)
  			break;
  		/* Set up for next read from bufferRAM */
+ 		if (unlikely(boundary))
+ 			this->write_word(0x8000, this->base + ONENAND_REG_START_ADDRESS2);
  		ONENAND_SET_NEXT_BUFFERRAM(this);
  		buf += thislen;
  		thislen = min_t(int, mtd->writesize, len - read);



More information about the linux-mtd-cvs mailing list