mtd: atmel_nand: implement the nfc_device_ready() by checking the R/B bit
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Aug 8 09:59:03 PDT 2014
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=72a78e3cd2c02c46ce5a3b89a2a854199e5a4820
Commit: 72a78e3cd2c02c46ce5a3b89a2a854199e5a4820
Parent: 50e04e2f0cf25917d8bec05326d0003cc2ab25eb
Author: Wu, Josh <Josh.wu at atmel.com>
AuthorDate: Tue Jun 10 17:50:10 2014 +0800
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Jul 21 20:02:09 2014 -0700
mtd: atmel_nand: implement the nfc_device_ready() by checking the R/B bit
In nfc_device_ready(), it's more reasonable to check R/B bit in NFC_SR
than waiting for the R/B interrupt. It cost less time.
Signed-off-by: Josh Wu <josh.wu at atmel.com>
Tested-by: Matthieu Crapet <Matthieu.Crapet at ingenico.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/atmel_nand.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 22e9137..459acf0 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1661,11 +1661,19 @@ static int nfc_send_command(struct atmel_nand_host *host,
static int nfc_device_ready(struct mtd_info *mtd)
{
+ u32 status, mask;
struct nand_chip *nand_chip = mtd->priv;
struct atmel_nand_host *host = nand_chip->priv;
- if (!nfc_wait_interrupt(host, NFC_SR_RB_EDGE))
- return 1;
- return 0;
+
+ status = nfc_read_status(host);
+ mask = nfc_readl(host->nfc->hsmc_regs, IMR);
+
+ /* The mask should be 0. If not we may lost interrupts */
+ if (unlikely(mask & status))
+ dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n",
+ mask & status);
+
+ return status & NFC_SR_RB_EDGE;
}
static void nfc_select_chip(struct mtd_info *mtd, int chip)
More information about the linux-mtd-cvs
mailing list