Skip to content

Commit

Permalink
mtd: atmel_nand: check NFC busy flag by HSMC_SR instead of NFC cmd regs
Browse files Browse the repository at this point in the history
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@free-electrons.com>
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  • Loading branch information
Boris Brezillon authored and Brian Norris committed Mar 11, 2015
1 parent 393d23c commit 111573c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/mtd/nand/atmel_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/nand/atmel_nand_nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 111573c

Please sign in to comment.