mtd: atmel_nand: check NFC busy flag by HSMC_SR instead of NFC cmd regs

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Apr 22 10:59:02 PDT 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=111573ccd89b67fdef64d945cc0e611df85a6ac8
Commit:     111573ccd89b67fdef64d945cc0e611df85a6ac8
Parent:     393d23c4e22996ad0c694577927bcf13ba31beda
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Thu Jan 22 18:21:30 2015 +0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Mar 11 09:49:28 2015 -0700

    mtd: atmel_nand: check NFC busy flag by HSMC_SR instead of NFC cmd regs
    
    Currently the driver read NFC command registers to get NFC busy flag.
    Actually this flag also can be get by reading HSMC_SR register.
    
    Use the read NFC command registers need mapping a huge memory region.
    To save the mapped memory region, we change to check NFC busy flag by
    reading HSMC_SR register.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Josh Wu <josh.wu at atmel.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/atmel_nand.c     | 5 ++---
 drivers/mtd/nand/atmel_nand_nfc.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 1310450..feaac90 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1752,11 +1752,10 @@ static int nfc_send_command(struct atmel_nand_host *host,
 		cmd, addr, cycle0);
 
 	timeout = jiffies + msecs_to_jiffies(NFC_TIME_OUT_MS);
-	while (nfc_cmd_readl(NFCADDR_CMD_NFCBUSY, host->nfc->base_cmd_regs)
-			& NFCADDR_CMD_NFCBUSY) {
+	while (nfc_readl(host->nfc->hsmc_regs, SR) & NFC_SR_BUSY) {
 		if (time_after(jiffies, timeout)) {
 			dev_err(host->dev,
-				"Time out to wait CMD_NFCBUSY ready!\n");
+				"Time out to wait for NFC ready!\n");
 			return -ETIMEDOUT;
 		}
 	}
diff --git a/drivers/mtd/nand/atmel_nand_nfc.h b/drivers/mtd/nand/atmel_nand_nfc.h
index 85b8ca6..4d5d262 100644
--- a/drivers/mtd/nand/atmel_nand_nfc.h
+++ b/drivers/mtd/nand/atmel_nand_nfc.h
@@ -35,6 +35,7 @@
 #define		NFC_CTRL_DISABLE	(1 << 1)
 
 #define ATMEL_HSMC_NFC_SR	0x08		/* NFC Status Register */
+#define		NFC_SR_BUSY		(1 << 8)
 #define		NFC_SR_XFR_DONE		(1 << 16)
 #define		NFC_SR_CMD_DONE		(1 << 17)
 #define		NFC_SR_DTOE		(1 << 20)



More information about the linux-mtd-cvs mailing list