diff options
author | Wu, Josh <Josh.wu@atmel.com> | 2014-06-10 05:50:10 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-07-21 23:02:09 -0400 |
commit | 72a78e3cd2c02c46ce5a3b89a2a854199e5a4820 (patch) | |
tree | 8ce6da298b10841ae5827ac428cb6cf2caf8e307 | |
parent | 50e04e2f0cf25917d8bec05326d0003cc2ab25eb (diff) |
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@atmel.com>
Tested-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 22e9137412b4..459acf01fefe 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, | |||
1661 | 1661 | ||
1662 | static int nfc_device_ready(struct mtd_info *mtd) | 1662 | static int nfc_device_ready(struct mtd_info *mtd) |
1663 | { | 1663 | { |
1664 | u32 status, mask; | ||
1664 | struct nand_chip *nand_chip = mtd->priv; | 1665 | struct nand_chip *nand_chip = mtd->priv; |
1665 | struct atmel_nand_host *host = nand_chip->priv; | 1666 | struct atmel_nand_host *host = nand_chip->priv; |
1666 | if (!nfc_wait_interrupt(host, NFC_SR_RB_EDGE)) | 1667 | |
1667 | return 1; | 1668 | status = nfc_read_status(host); |
1668 | return 0; | 1669 | mask = nfc_readl(host->nfc->hsmc_regs, IMR); |
1670 | |||
1671 | /* The mask should be 0. If not we may lost interrupts */ | ||
1672 | if (unlikely(mask & status)) | ||
1673 | dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n", | ||
1674 | mask & status); | ||
1675 | |||
1676 | return status & NFC_SR_RB_EDGE; | ||
1669 | } | 1677 | } |
1670 | 1678 | ||
1671 | static void nfc_select_chip(struct mtd_info *mtd, int chip) | 1679 | static void nfc_select_chip(struct mtd_info *mtd, int chip) |