MTD fixes for v4.7-rc1

We've already noticed a few flaws in the MTD work for v4.7-rc1:
 
  * The Atmel folks got ahead of themselves on trying to support their latest
    hardware and were working off incorrect documentation. Fix up the NAND
    driver to get this correct.
 
  * Fix up device tree example documentation to use the latest recommendations
    for describing NAND ECC algorithms.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXSH51AAoJEFySrpd9RFgtSnsQAK+UrSM1gFAiMBEWPJuCK100
 WZRZG8FxftzGbU33DiSgXDU/RmZBupIBHSZNGoWBkumdd9uozfIWp+s2T40k2ot6
 E7ckF3lGaZOWMmzt/MN5lkeTm6Pzs63DemP/a1wSRqfvCTE8kB8EREzUiTQuNnWi
 6YMvXuVnwouh5v91vuwKOKmGWuYidy6sF91w8ucd+W/A7p0Rnj8Nr7cGur3Xn+6L
 MNjvfvD8tfyKk3b7aaNMyR6oIJQ9awR2TewBbB/6mJQR/eDOPnpq3Z+rJSwEoSJH
 Hd/pG0zx9KeZyOF7kbZZmfk9DyPM50qCxiX/Z9kaSMGxyEQgwMjmQslJbDvRGOz5
 2s5NAT8Nm3OcedAJgjGLmUlO/NH4XIQt+c35nftikeNplUqNNbZLjMgpfnLWB8FN
 5cerUeFBwFZztJIWN1eQfZ7lERwk8bJPr0IRfPASj0xjTXi1DZze7WijA/BrsvEc
 rUQ8J1YAXvjVyQZUmJyq8MFVeyEewv1MZ0O5w0t0u7kXtVI3HLQiJCLy1ZD3rDm2
 dW4hMVtLOu6WDGZ27a229QtXOEm5L0YXCQGea75zR+gQObiY8mMIN3Qy68W4zSSJ
 yGMPY9u8E8oPHh7TeNtc4E8MkYbujqknIshcgTBN2k4HufK6GPZOTvwfor1zdHAe
 HGk9MiFRrACPTQIuxfhd
 =kb+w
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-20160527' of git://git.infradead.org/linux-mtd

Pull MTD fixes from Brian Norris:
 "We've already noticed a few flaws in the MTD work for v4.7-rc1:

   - The Atmel folks got ahead of themselves on trying to support their
     latest hardware and were working off incorrect documentation.  Fix
     up the NAND driver to get this correct.

   - Fix up device tree example documentation to use the latest
     recommendations for describing NAND ECC algorithms"

* tag 'for-linus-20160527' of git://git.infradead.org/linux-mtd:
  Documentation: dt: mtd: drop "soft_bch" from example
  Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts"
This commit is contained in:
Linus Torvalds 2016-05-27 14:17:15 -07:00
commit 4cae85bed4
4 changed files with 12 additions and 31 deletions

View file

@ -39,7 +39,7 @@ Optional properties:
Nand Flash Controller(NFC) is an optional sub-node Nand Flash Controller(NFC) is an optional sub-node
Required properties: Required properties:
- compatible : "atmel,sama5d3-nfc" or "atmel,sama5d4-nfc". - compatible : "atmel,sama5d3-nfc".
- reg : should specify the address and size used for NFC command registers, - reg : should specify the address and size used for NFC command registers,
NFC registers and NFC SRAM. NFC SRAM address and size can be absent NFC registers and NFC SRAM. NFC SRAM address and size can be absent
if don't want to use it. if don't want to use it.

View file

@ -53,7 +53,8 @@ Example:
nand@0 { nand@0 {
reg = <0>; reg = <0>;
nand-ecc-mode = "soft_bch"; nand-ecc-mode = "soft";
nand-ecc-algo = "bch";
/* controller specific properties */ /* controller specific properties */
}; };

View file

@ -67,10 +67,6 @@ struct atmel_nand_caps {
uint8_t pmecc_max_correction; uint8_t pmecc_max_correction;
}; };
struct atmel_nand_nfc_caps {
uint32_t rb_mask;
};
/* /*
* oob layout for large page size * oob layout for large page size
* bad block info is on bytes 0 and 1 * bad block info is on bytes 0 and 1
@ -129,7 +125,6 @@ struct atmel_nfc {
/* Point to the sram bank which include readed data via NFC */ /* Point to the sram bank which include readed data via NFC */
void *data_in_sram; void *data_in_sram;
bool will_write_sram; bool will_write_sram;
const struct atmel_nand_nfc_caps *caps;
}; };
static struct atmel_nfc nand_nfc; static struct atmel_nfc nand_nfc;
@ -1715,9 +1710,9 @@ static irqreturn_t hsmc_interrupt(int irq, void *dev_id)
nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_XFR_DONE); nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_XFR_DONE);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
if (pending & host->nfc->caps->rb_mask) { if (pending & NFC_SR_RB_EDGE) {
complete(&host->nfc->comp_ready); complete(&host->nfc->comp_ready);
nfc_writel(host->nfc->hsmc_regs, IDR, host->nfc->caps->rb_mask); nfc_writel(host->nfc->hsmc_regs, IDR, NFC_SR_RB_EDGE);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
if (pending & NFC_SR_CMD_DONE) { if (pending & NFC_SR_CMD_DONE) {
@ -1735,7 +1730,7 @@ static void nfc_prepare_interrupt(struct atmel_nand_host *host, u32 flag)
if (flag & NFC_SR_XFR_DONE) if (flag & NFC_SR_XFR_DONE)
init_completion(&host->nfc->comp_xfer_done); init_completion(&host->nfc->comp_xfer_done);
if (flag & host->nfc->caps->rb_mask) if (flag & NFC_SR_RB_EDGE)
init_completion(&host->nfc->comp_ready); init_completion(&host->nfc->comp_ready);
if (flag & NFC_SR_CMD_DONE) if (flag & NFC_SR_CMD_DONE)
@ -1753,7 +1748,7 @@ static int nfc_wait_interrupt(struct atmel_nand_host *host, u32 flag)
if (flag & NFC_SR_XFR_DONE) if (flag & NFC_SR_XFR_DONE)
comp[index++] = &host->nfc->comp_xfer_done; comp[index++] = &host->nfc->comp_xfer_done;
if (flag & host->nfc->caps->rb_mask) if (flag & NFC_SR_RB_EDGE)
comp[index++] = &host->nfc->comp_ready; comp[index++] = &host->nfc->comp_ready;
if (flag & NFC_SR_CMD_DONE) if (flag & NFC_SR_CMD_DONE)
@ -1821,7 +1816,7 @@ static int nfc_device_ready(struct mtd_info *mtd)
dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n", dev_err(host->dev, "Lost the interrupt flags: 0x%08x\n",
mask & status); mask & status);
return status & host->nfc->caps->rb_mask; return status & NFC_SR_RB_EDGE;
} }
static void nfc_select_chip(struct mtd_info *mtd, int chip) static void nfc_select_chip(struct mtd_info *mtd, int chip)
@ -1994,8 +1989,8 @@ static void nfc_nand_command(struct mtd_info *mtd, unsigned int command,
} }
/* fall through */ /* fall through */
default: default:
nfc_prepare_interrupt(host, host->nfc->caps->rb_mask); nfc_prepare_interrupt(host, NFC_SR_RB_EDGE);
nfc_wait_interrupt(host, host->nfc->caps->rb_mask); nfc_wait_interrupt(host, NFC_SR_RB_EDGE);
} }
} }
@ -2426,11 +2421,6 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
} }
} }
nfc->caps = (const struct atmel_nand_nfc_caps *)
of_device_get_match_data(&pdev->dev);
if (!nfc->caps)
return -ENODEV;
nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff); nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */ nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */
@ -2459,17 +2449,8 @@ static int atmel_nand_nfc_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct atmel_nand_nfc_caps sama5d3_nfc_caps = {
.rb_mask = NFC_SR_RB_EDGE0,
};
static const struct atmel_nand_nfc_caps sama5d4_nfc_caps = {
.rb_mask = NFC_SR_RB_EDGE3,
};
static const struct of_device_id atmel_nand_nfc_match[] = { static const struct of_device_id atmel_nand_nfc_match[] = {
{ .compatible = "atmel,sama5d3-nfc", .data = &sama5d3_nfc_caps }, { .compatible = "atmel,sama5d3-nfc" },
{ .compatible = "atmel,sama5d4-nfc", .data = &sama5d4_nfc_caps },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match); MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match);

View file

@ -42,8 +42,7 @@
#define NFC_SR_UNDEF (1 << 21) #define NFC_SR_UNDEF (1 << 21)
#define NFC_SR_AWB (1 << 22) #define NFC_SR_AWB (1 << 22)
#define NFC_SR_ASE (1 << 23) #define NFC_SR_ASE (1 << 23)
#define NFC_SR_RB_EDGE0 (1 << 24) #define NFC_SR_RB_EDGE (1 << 24)
#define NFC_SR_RB_EDGE3 (1 << 27)
#define ATMEL_HSMC_NFC_IER 0x0c #define ATMEL_HSMC_NFC_IER 0x0c
#define ATMEL_HSMC_NFC_IDR 0x10 #define ATMEL_HSMC_NFC_IDR 0x10