Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts"

This reverts commit 5ddc7bd43ccc ("mtd: atmel_nand: Support variable
RB_EDGE interrupts")

Because for current SoCs, the RB_EDGE3(i.e. bit 27) of HSMC_SR
register does not exist, the RB_EDGE0 (i.e. bit 24) is the ready/busy
line edge status bit. It is a datasheet bug.

Cc: <stable@vger.kernel.org>
Fixes: commit 5ddc7bd43ccc ("mtd: atmel_nand: Support variable RB_EDGE interrupts")
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Wenyou Yang and committed by
Brian Norris
53b74ed2 e5366a26

+10 -30
+1 -1
Documentation/devicetree/bindings/mtd/atmel-nand.txt
··· 39 39 40 40 Nand Flash Controller(NFC) is an optional sub-node 41 41 Required properties: 42 - - compatible : "atmel,sama5d3-nfc" or "atmel,sama5d4-nfc". 42 + - compatible : "atmel,sama5d3-nfc". 43 43 - reg : should specify the address and size used for NFC command registers, 44 44 NFC registers and NFC SRAM. NFC SRAM address and size can be absent 45 45 if don't want to use it.
+8 -27
drivers/mtd/nand/atmel_nand.c
··· 67 67 uint8_t pmecc_max_correction; 68 68 }; 69 69 70 - struct atmel_nand_nfc_caps { 71 - uint32_t rb_mask; 72 - }; 73 - 74 70 /* 75 71 * oob layout for large page size 76 72 * bad block info is on bytes 0 and 1 ··· 125 129 /* Point to the sram bank which include readed data via NFC */ 126 130 void *data_in_sram; 127 131 bool will_write_sram; 128 - const struct atmel_nand_nfc_caps *caps; 129 132 }; 130 133 static struct atmel_nfc nand_nfc; 131 134 ··· 1710 1715 nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_XFR_DONE); 1711 1716 ret = IRQ_HANDLED; 1712 1717 } 1713 - if (pending & host->nfc->caps->rb_mask) { 1718 + if (pending & NFC_SR_RB_EDGE) { 1714 1719 complete(&host->nfc->comp_ready); 1715 - nfc_writel(host->nfc->hsmc_regs, IDR, host->nfc->caps->rb_mask); 1720 + nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_RB_EDGE); 1716 1721 ret = IRQ_HANDLED; 1717 1722 } 1718 1723 if (pending & NFC_SR_CMD_DONE) { ··· 1730 1735 if (flag & NFC_SR_XFR_DONE) 1731 1736 init_completion(&host->nfc->comp_xfer_done); 1732 1737 1733 - if (flag & host->nfc->caps->rb_mask) 1738 + if (flag & NFC_SR_RB_EDGE) 1734 1739 init_completion(&host->nfc->comp_ready); 1735 1740 1736 1741 if (flag & NFC_SR_CMD_DONE) ··· 1748 1753 if (flag & NFC_SR_XFR_DONE) 1749 1754 comp[index++] = &host->nfc->comp_xfer_done; 1750 1755 1751 - if (flag & host->nfc->caps->rb_mask) 1756 + if (flag & NFC_SR_RB_EDGE) 1752 1757 comp[index++] = &host->nfc->comp_ready; 1753 1758 1754 1759 if (flag & NFC_SR_CMD_DONE) ··· 1816 1821 dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n", 1817 1822 mask & status); 1818 1823 1819 - return status & host->nfc->caps->rb_mask; 1824 + return status & NFC_SR_RB_EDGE; 1820 1825 } 1821 1826 1822 1827 static void nfc_select_chip(struct mtd_info *mtd, int chip) ··· 1989 1994 } 1990 1995 /* fall through */ 1991 1996 default: 1992 - nfc_prepare_interrupt(host, host->nfc->caps->rb_mask); 1993 - nfc_wait_interrupt(host, host->nfc->caps->rb_mask); 1997 + nfc_prepare_interrupt(host, NFC_SR_RB_EDGE); 1998 + nfc_wait_interrupt(host, NFC_SR_RB_EDGE); 1994 1999 } 1995 2000 } 1996 2001 ··· 2421 2426 } 2422 2427 } 2423 2428 2424 - nfc->caps = (const struct atmel_nand_nfc_caps *) 2425 - of_device_get_match_data(&pdev->dev); 2426 - if (!nfc->caps) 2427 - return -ENODEV; 2428 - 2429 2429 nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff); 2430 2430 nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */ 2431 2431 ··· 2449 2459 return 0; 2450 2460 } 2451 2461 2452 - static const struct atmel_nand_nfc_caps sama5d3_nfc_caps = { 2453 - .rb_mask = NFC_SR_RB_EDGE0, 2454 - }; 2455 - 2456 - static const struct atmel_nand_nfc_caps sama5d4_nfc_caps = { 2457 - .rb_mask = NFC_SR_RB_EDGE3, 2458 - }; 2459 - 2460 2462 static const struct of_device_id atmel_nand_nfc_match[] = { 2461 - { .compatible = "atmel,sama5d3-nfc", .data = &sama5d3_nfc_caps }, 2462 - { .compatible = "atmel,sama5d4-nfc", .data = &sama5d4_nfc_caps }, 2463 + { .compatible = "atmel,sama5d3-nfc" }, 2463 2464 { /* sentinel */ } 2464 2465 }; 2465 2466 MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match);
+1 -2
drivers/mtd/nand/atmel_nand_nfc.h
··· 42 42 #define NFC_SR_UNDEF (1 << 21) 43 43 #define NFC_SR_AWB (1 << 22) 44 44 #define NFC_SR_ASE (1 << 23) 45 - #define NFC_SR_RB_EDGE0 (1 << 24) 46 - #define NFC_SR_RB_EDGE3 (1 << 27) 45 + #define NFC_SR_RB_EDGE (1 << 24) 47 46 48 47 #define ATMEL_HSMC_NFC_IER 0x0c 49 48 #define ATMEL_HSMC_NFC_IDR 0x10