diff options
author | Barry Song <barry.song@analog.com> | 2010-08-05 11:07:44 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-05 11:14:04 -0400 |
commit | 085d45fb5216c25b69103e5d861fabdc4389e221 (patch) | |
tree | ddddd005d86f5e4e084b3d0f01e4a9a12fc23645 | |
parent | 7ee064c90b3a65aa0c8d8cd87681177645db494e (diff) |
mtd: Blackfin NFC: fix raw page write/read handling
Our write_buf/read_buf funcs always do ECC in HW ECC mode. That is not
needed for raw funcs. In fact, write_buf/read_buf should be a pure func
for data input/output while chip->ecc.hwctl controls ECC. Unfortunately,
we can't separate ECC from normal data input/output in our NFC, so our DMA
write_buf/read_buf entries are coupled with ECC operations closely.
Thus we need to provide dedicated read_page_raw/write_page_raw funcs where
we do non-DMA transactions so as to avoid automatic ECC.
Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/nand/bf5xx_nand.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c index 524cf5f41523..ca39819982bf 100644 --- a/drivers/mtd/nand/bf5xx_nand.c +++ b/drivers/mtd/nand/bf5xx_nand.c | |||
@@ -571,6 +571,22 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd, | |||
571 | bf5xx_nand_write_buf(mtd, buf, len); | 571 | bf5xx_nand_write_buf(mtd, buf, len); |
572 | } | 572 | } |
573 | 573 | ||
574 | static int bf5xx_nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | ||
575 | uint8_t *buf, int page) | ||
576 | { | ||
577 | bf5xx_nand_read_buf(mtd, buf, mtd->writesize); | ||
578 | bf5xx_nand_read_buf(mtd, chip->oob_poi, mtd->oobsize); | ||
579 | |||
580 | return 0; | ||
581 | } | ||
582 | |||
583 | static void bf5xx_nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | ||
584 | const uint8_t *buf) | ||
585 | { | ||
586 | bf5xx_nand_write_buf(mtd, buf, mtd->writesize); | ||
587 | bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize); | ||
588 | } | ||
589 | |||
574 | /* | 590 | /* |
575 | * System initialization functions | 591 | * System initialization functions |
576 | */ | 592 | */ |
@@ -795,6 +811,8 @@ static int __devinit bf5xx_nand_probe(struct platform_device *pdev) | |||
795 | chip->ecc.correct = bf5xx_nand_correct_data; | 811 | chip->ecc.correct = bf5xx_nand_correct_data; |
796 | chip->ecc.mode = NAND_ECC_HW; | 812 | chip->ecc.mode = NAND_ECC_HW; |
797 | chip->ecc.hwctl = bf5xx_nand_enable_hwecc; | 813 | chip->ecc.hwctl = bf5xx_nand_enable_hwecc; |
814 | chip->ecc.read_page_raw = bf5xx_nand_read_page_raw; | ||
815 | chip->ecc.write_page_raw = bf5xx_nand_write_page_raw; | ||
798 | } else { | 816 | } else { |
799 | chip->ecc.mode = NAND_ECC_SOFT; | 817 | chip->ecc.mode = NAND_ECC_SOFT; |
800 | } | 818 | } |