diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-01-22 05:21:30 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-03-11 12:49:28 -0400 |
commit | 111573ccd89b67fdef64d945cc0e611df85a6ac8 (patch) | |
tree | ec40f8cf07fb775985097824a95a42f4d04d579c /drivers/mtd | |
parent | 393d23c4e22996ad0c694577927bcf13ba31beda (diff) |
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@free-electrons.com>
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 5 | ||||
-rw-r--r-- | 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 13104507da63..feaac9099bb9 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, | |||
1752 | cmd, addr, cycle0); | 1752 | cmd, addr, cycle0); |
1753 | 1753 | ||
1754 | timeout = jiffies + msecs_to_jiffies(NFC_TIME_OUT_MS); | 1754 | timeout = jiffies + msecs_to_jiffies(NFC_TIME_OUT_MS); |
1755 | while (nfc_cmd_readl(NFCADDR_CMD_NFCBUSY, host->nfc->base_cmd_regs) | 1755 | while (nfc_readl(host->nfc->hsmc_regs, SR) & NFC_SR_BUSY) { |
1756 | & NFCADDR_CMD_NFCBUSY) { | ||
1757 | if (time_after(jiffies, timeout)) { | 1756 | if (time_after(jiffies, timeout)) { |
1758 | dev_err(host->dev, | 1757 | dev_err(host->dev, |
1759 | "Time out to wait CMD_NFCBUSY ready!\n"); | 1758 | "Time out to wait for NFC ready!\n"); |
1760 | return -ETIMEDOUT; | 1759 | return -ETIMEDOUT; |
1761 | } | 1760 | } |
1762 | } | 1761 | } |
diff --git a/drivers/mtd/nand/atmel_nand_nfc.h b/drivers/mtd/nand/atmel_nand_nfc.h index 85b8ca6af7d2..4d5d26221a7e 100644 --- a/drivers/mtd/nand/atmel_nand_nfc.h +++ b/drivers/mtd/nand/atmel_nand_nfc.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define NFC_CTRL_DISABLE (1 << 1) | 35 | #define NFC_CTRL_DISABLE (1 << 1) |
36 | 36 | ||
37 | #define ATMEL_HSMC_NFC_SR 0x08 /* NFC Status Register */ | 37 | #define ATMEL_HSMC_NFC_SR 0x08 /* NFC Status Register */ |
38 | #define NFC_SR_BUSY (1 << 8) | ||
38 | #define NFC_SR_XFR_DONE (1 << 16) | 39 | #define NFC_SR_XFR_DONE (1 << 16) |
39 | #define NFC_SR_CMD_DONE (1 << 17) | 40 | #define NFC_SR_CMD_DONE (1 << 17) |
40 | #define NFC_SR_DTOE (1 << 20) | 41 | #define NFC_SR_DTOE (1 << 20) |