aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-02-08 03:28:08 -0500
committerKyungmin Park <kyungmin.park@samsung.com>2007-02-08 19:42:42 -0500
commitcde36b37d6fa5ebc8c95461a972c379185626b2c (patch)
tree44c8ac5875119e42ddc44780b759f610d361495c /drivers/mtd/onenand
parent211ac75f5e867ab7a54811a514814149caca42c3 (diff)
[MTD] OneNAND: Select correct chip's bufferRAM for DDP
OneNAND double-density package (DDP) has two chips, each with their own bufferRAM. The driver will skip loading data from the NAND core if the data can be found in a bufferRAM, however in that case, the correct chip's bufferRAM must be selected before reading from bufferRAM. 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')
-rw-r--r--drivers/mtd/onenand/onenand_base.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f690c1916d1d..779327b845d1 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -577,7 +577,7 @@ static int onenand_write_bufferram(struct mtd_info *mtd, int area,
577static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr) 577static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr)
578{ 578{
579 struct onenand_chip *this = mtd->priv; 579 struct onenand_chip *this = mtd->priv;
580 int blockpage; 580 int blockpage, found = 0;
581 unsigned int i; 581 unsigned int i;
582 582
583 blockpage = (int) (addr >> this->page_shift); 583 blockpage = (int) (addr >> this->page_shift);
@@ -585,16 +585,24 @@ static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr)
585 /* Is there valid data? */ 585 /* Is there valid data? */
586 i = ONENAND_CURRENT_BUFFERRAM(this); 586 i = ONENAND_CURRENT_BUFFERRAM(this);
587 if (this->bufferram[i].blockpage == blockpage) 587 if (this->bufferram[i].blockpage == blockpage)
588 return 1; 588 found = 1;
589 else {
590 /* Check another BufferRAM */
591 i = ONENAND_NEXT_BUFFERRAM(this);
592 if (this->bufferram[i].blockpage == blockpage) {
593 ONENAND_SET_NEXT_BUFFERRAM(this);
594 found = 1;
595 }
596 }
589 597
590 /* Check another BufferRAM */ 598 if (found && ONENAND_IS_DDP(this)) {
591 i = ONENAND_NEXT_BUFFERRAM(this); 599 /* Select DataRAM for DDP */
592 if (this->bufferram[i].blockpage == blockpage) { 600 int block = (int) (addr >> this->erase_shift);
593 ONENAND_SET_NEXT_BUFFERRAM(this); 601 int value = onenand_bufferram_address(this, block);
594 return 1; 602 this->write_word(value, this->base + ONENAND_REG_START_ADDRESS2);
595 } 603 }
596 604
597 return 0; 605 return found;
598} 606}
599 607
600/** 608/**