diff options
Diffstat (limited to 'drivers/mtd/nand/atmel_nand.c')
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 4f5348fd409c..22e9137412b4 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -1572,6 +1572,25 @@ static int atmel_hw_nand_init_params(struct platform_device *pdev, | |||
1572 | return 0; | 1572 | return 0; |
1573 | } | 1573 | } |
1574 | 1574 | ||
1575 | static inline u32 nfc_read_status(struct atmel_nand_host *host) | ||
1576 | { | ||
1577 | u32 err_flags = NFC_SR_DTOE | NFC_SR_UNDEF | NFC_SR_AWB | NFC_SR_ASE; | ||
1578 | u32 nfc_status = nfc_readl(host->nfc->hsmc_regs, SR); | ||
1579 | |||
1580 | if (unlikely(nfc_status & err_flags)) { | ||
1581 | if (nfc_status & NFC_SR_DTOE) | ||
1582 | dev_err(host->dev, "NFC: Waiting Nand R/B Timeout Error\n"); | ||
1583 | else if (nfc_status & NFC_SR_UNDEF) | ||
1584 | dev_err(host->dev, "NFC: Access Undefined Area Error\n"); | ||
1585 | else if (nfc_status & NFC_SR_AWB) | ||
1586 | dev_err(host->dev, "NFC: Access memory While NFC is busy\n"); | ||
1587 | else if (nfc_status & NFC_SR_ASE) | ||
1588 | dev_err(host->dev, "NFC: Access memory Size Error\n"); | ||
1589 | } | ||
1590 | |||
1591 | return nfc_status; | ||
1592 | } | ||
1593 | |||
1575 | /* SMC interrupt service routine */ | 1594 | /* SMC interrupt service routine */ |
1576 | static irqreturn_t hsmc_interrupt(int irq, void *dev_id) | 1595 | static irqreturn_t hsmc_interrupt(int irq, void *dev_id) |
1577 | { | 1596 | { |
@@ -1579,7 +1598,7 @@ static irqreturn_t hsmc_interrupt(int irq, void *dev_id) | |||
1579 | u32 status, mask, pending; | 1598 | u32 status, mask, pending; |
1580 | irqreturn_t ret = IRQ_HANDLED; | 1599 | irqreturn_t ret = IRQ_HANDLED; |
1581 | 1600 | ||
1582 | status = nfc_readl(host->nfc->hsmc_regs, SR); | 1601 | status = nfc_read_status(host); |
1583 | mask = nfc_readl(host->nfc->hsmc_regs, IMR); | 1602 | mask = nfc_readl(host->nfc->hsmc_regs, IMR); |
1584 | pending = status & mask; | 1603 | pending = status & mask; |
1585 | 1604 | ||
@@ -2209,6 +2228,9 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) | |||
2209 | } | 2228 | } |
2210 | } | 2229 | } |
2211 | 2230 | ||
2231 | nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff); | ||
2232 | nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */ | ||
2233 | |||
2212 | nfc->is_initialized = true; | 2234 | nfc->is_initialized = true; |
2213 | dev_info(&pdev->dev, "NFC is probed.\n"); | 2235 | dev_info(&pdev->dev, "NFC is probed.\n"); |
2214 | return 0; | 2236 | return 0; |