nand/denali: change read_status function method

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Aug 12 06:59:01 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f0bc0c778fe12e43658193fae975fc5762e98773
Commit:     f0bc0c778fe12e43658193fae975fc5762e98773
Parent:     b292c341e2304b1d937843711c63d1e141d7b589
Author:     Chuanxiao Dong <chuanxiao.dong at intel.com>
AuthorDate: Wed Aug 11 17:14:59 2010 +0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Aug 12 11:10:37 2010 +0100

    nand/denali: change read_status function method
    
    In mtd->write, Denali controller will use MODE_11 mode to read
    NAND flash status, then return back to MODE_1O mode to do page
    write.
    Here comes a bug for this kind of using, sometimes controller will
    not write data to NAND and just return a good interrupt to tell
    driver writing work is done. The data in this page is all 0xff and
    this page can not be written again. The reason is unknow.
    
    So read Denali controller register WRITE_PROTECT to get NAND status
    instead.
    
    Signed-off-by: Chuanxiao Dong <chuanxiao.dong at intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/denali.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 3ba8952..975a893 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -169,13 +169,11 @@ static void read_status(struct denali_nand_info *denali)
 	/* initialize the data buffer to store status */
 	reset_buf(denali);
 
-	/* initiate a device status read */
-	cmd = MODE_11 | BANK(denali->flash_bank);
-	index_addr(denali, cmd | COMMAND_CYCLE, 0x70);
-	iowrite32(cmd | STATUS_CYCLE, denali->flash_mem);
-
-	/* update buffer with status value */
-	write_byte_to_buf(denali, ioread32(denali->flash_mem + 0x10));
+	cmd = ioread32(denali->flash_reg + WRITE_PROTECT);
+	if (cmd)
+		write_byte_to_buf(denali, NAND_STATUS_WP);
+	else
+		write_byte_to_buf(denali, 0);
 }
 
 /* resets a specific device connected to the core */



More information about the linux-mtd-cvs mailing list