Commit 111573cc authored by Boris Brezillon's avatar Boris Brezillon Committed by Brian Norris

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: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 393d23c4
...@@ -1752,11 +1752,10 @@ static int nfc_send_command(struct atmel_nand_host *host, ...@@ -1752,11 +1752,10 @@ static int nfc_send_command(struct atmel_nand_host *host,
cmd, addr, cycle0); cmd, addr, cycle0);
timeout = jiffies + msecs_to_jiffies(NFC_TIME_OUT_MS); timeout = jiffies + msecs_to_jiffies(NFC_TIME_OUT_MS);
while (nfc_cmd_readl(NFCADDR_CMD_NFCBUSY, host->nfc->base_cmd_regs) while (nfc_readl(host->nfc->hsmc_regs, SR) & NFC_SR_BUSY) {
& NFCADDR_CMD_NFCBUSY) {
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
dev_err(host->dev, dev_err(host->dev,
"Time out to wait CMD_NFCBUSY ready!\n"); "Time out to wait for NFC ready!\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define NFC_CTRL_DISABLE (1 << 1) #define NFC_CTRL_DISABLE (1 << 1)
#define ATMEL_HSMC_NFC_SR 0x08 /* NFC Status Register */ #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_XFR_DONE (1 << 16)
#define NFC_SR_CMD_DONE (1 << 17) #define NFC_SR_CMD_DONE (1 << 17)
#define NFC_SR_DTOE (1 << 20) #define NFC_SR_DTOE (1 << 20)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment