Skip to content

Commit

Permalink
mtd: atmel_nand: implement the nfc_device_ready() by checking the R/B…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
JoshWu authored and computersforpeace committed Jul 22, 2014
1 parent 50e04e2 commit 72a78e3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions drivers/mtd/nand/atmel_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 72a78e3

Please sign in to comment.