aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/atmel_nand.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 0abc965caedf..9c5f717bda54 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1907,15 +1907,7 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip,
1907 if (offset || (data_len < mtd->writesize)) 1907 if (offset || (data_len < mtd->writesize))
1908 return -EINVAL; 1908 return -EINVAL;
1909 1909
1910 cfg = nfc_readl(host->nfc->hsmc_regs, CFG);
1911 len = mtd->writesize; 1910 len = mtd->writesize;
1912
1913 if (unlikely(raw)) {
1914 len += mtd->oobsize;
1915 nfc_writel(host->nfc->hsmc_regs, CFG, cfg | NFC_CFG_WSPARE);
1916 } else
1917 nfc_writel(host->nfc->hsmc_regs, CFG, cfg & ~NFC_CFG_WSPARE);
1918
1919 /* Copy page data to sram that will write to nand via NFC */ 1911 /* Copy page data to sram that will write to nand via NFC */
1920 if (use_dma) { 1912 if (use_dma) {
1921 if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) != 0) 1913 if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) != 0)
@@ -1925,6 +1917,15 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip,
1925 memcpy32_toio(sram, buf, len); 1917 memcpy32_toio(sram, buf, len);
1926 } 1918 }
1927 1919
1920 cfg = nfc_readl(host->nfc->hsmc_regs, CFG);
1921 if (unlikely(raw) && oob_required) {
1922 memcpy32_toio(sram + len, chip->oob_poi, mtd->oobsize);
1923 len += mtd->oobsize;
1924 nfc_writel(host->nfc->hsmc_regs, CFG, cfg | NFC_CFG_WSPARE);
1925 } else {
1926 nfc_writel(host->nfc->hsmc_regs, CFG, cfg & ~NFC_CFG_WSPARE);
1927 }
1928
1928 if (chip->ecc.mode == NAND_ECC_HW && host->has_pmecc) 1929 if (chip->ecc.mode == NAND_ECC_HW && host->has_pmecc)
1929 /* 1930 /*
1930 * When use NFC sram, need set up PMECC before send 1931 * When use NFC sram, need set up PMECC before send