aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand/onenand_base.c
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-01-09 10:55:21 -0500
committerArtem Bityutskiy <dedekind@infradead.org>2007-01-10 08:05:22 -0500
commit0fc2ccea4c8fa779053cb6f8984f6da399a81182 (patch)
tree5db774fb794dce9b527a3bbe7e418b0b65808a73 /drivers/mtd/onenand/onenand_base.c
parentb3c9f8bfe7ab366a5d2495ebe5d2dc6fd7368122 (diff)
[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@nokia.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/mtd/onenand/onenand_base.c')
-rw-r--r--drivers/mtd/onenand/onenand_base.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 2ea07f5723d1..2da6bb26353e 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,
710 struct mtd_ecc_stats stats; 710 struct mtd_ecc_stats stats;
711 int read = 0, column; 711 int read = 0, column;
712 int thislen; 712 int thislen;
713 int ret = 0; 713 int ret = 0, boundary = 0;
714 714
715 DEBUG(MTD_DEBUG_LEVEL3, "onenand_read: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len); 715 DEBUG(MTD_DEBUG_LEVEL3, "onenand_read: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);
716 716
@@ -749,6 +749,17 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
749 from += thislen; 749 from += thislen;
750 if (read + thislen < len) { 750 if (read + thislen < len) {
751 this->command(mtd, ONENAND_CMD_READ, from, mtd->writesize); 751 this->command(mtd, ONENAND_CMD_READ, from, mtd->writesize);
752 /*
753 * Chip boundary handling in DDP
754 * Now we issued chip 1 read and pointed chip 1
755 * bufferam so we have to point chip 0 bufferam.
756 */
757 if (this->device_id & ONENAND_DEVICE_IS_DDP &&
758 unlikely(from == (this->chipsize >> 1))) {
759 this->write_word(0, this->base + ONENAND_REG_START_ADDRESS2);
760 boundary = 1;
761 } else
762 boundary = 0;
752 ONENAND_SET_PREV_BUFFERRAM(this); 763 ONENAND_SET_PREV_BUFFERRAM(this);
753 } 764 }
754 /* While load is going, read from last bufferRAM */ 765 /* 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,
758 if (read == len) 769 if (read == len)
759 break; 770 break;
760 /* Set up for next read from bufferRAM */ 771 /* Set up for next read from bufferRAM */
772 if (unlikely(boundary))
773 this->write_word(0x8000, this->base + ONENAND_REG_START_ADDRESS2);
761 ONENAND_SET_NEXT_BUFFERRAM(this); 774 ONENAND_SET_NEXT_BUFFERRAM(this);
762 buf += thislen; 775 buf += thislen;
763 thislen = min_t(int, mtd->writesize, len - read); 776 thislen = min_t(int, mtd->writesize, len - read);