]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nand/denali: change read_status function method
authorChuanxiao Dong <chuanxiao.dong@intel.com>
Wed, 11 Aug 2010 09:14:59 +0000 (17:14 +0800)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 12 Aug 2010 10:10:37 +0000 (11:10 +0100)
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@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/denali.c

index 3ba89525cf07c5394a6460ef2f33ae5d2428c1fa..975a89351f9735a0fd5bfd98543849d106ec2a88 100644 (file)
@@ -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 */