Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cde36b37d6fa5ebc8c95461a972c379185626b2c
Commit:     cde36b37d6fa5ebc8c95461a972c379185626b2c
Parent:     211ac75f5e867ab7a54811a514814149caca42c3
Author:     Adrian Hunter <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 8 10:28:08 2007 +0200
Committer:  Kyungmin Park <[EMAIL PROTECTED]>
CommitDate: Fri Feb 9 09:42:42 2007 +0900

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
---
 drivers/mtd/onenand/onenand_base.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c 
b/drivers/mtd/onenand/onenand_base.c
index f690c19..779327b 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,
 static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr)
 {
        struct onenand_chip *this = mtd->priv;
-       int blockpage;
+       int blockpage, found = 0;
        unsigned int i;
 
        blockpage = (int) (addr >> this->page_shift);
@@ -585,16 +585,24 @@ static int onenand_check_bufferram(struct mtd_info *mtd, 
loff_t addr)
        /* Is there valid data? */
        i = ONENAND_CURRENT_BUFFERRAM(this);
        if (this->bufferram[i].blockpage == blockpage)
-               return 1;
+               found = 1;
+       else {
+               /* Check another BufferRAM */
+               i = ONENAND_NEXT_BUFFERRAM(this);
+               if (this->bufferram[i].blockpage == blockpage) {
+                       ONENAND_SET_NEXT_BUFFERRAM(this);
+                       found = 1;
+               }
+       }
 
-       /* Check another BufferRAM */
-       i = ONENAND_NEXT_BUFFERRAM(this);
-       if (this->bufferram[i].blockpage == blockpage) {
-               ONENAND_SET_NEXT_BUFFERRAM(this);
-               return 1;
+       if (found && ONENAND_IS_DDP(this)) {
+               /* Select DataRAM for DDP */
+               int block = (int) (addr >> this->erase_shift);
+               int value = onenand_bufferram_address(this, block);
+               this->write_word(value, this->base + 
ONENAND_REG_START_ADDRESS2);
        }
 
-       return 0;
+       return found;
 }
 
 /**
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to