mtd: nand: gpmi: add raw oob access functions

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Dec 15 19:59:10 PST 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7ca94e07fe8ccbaca9ecb59f388ab8dd93c73e88
Commit:     7ca94e07fe8ccbaca9ecb59f388ab8dd93c73e88
Parent:     da3bc42c1becfde026656df50ad155239d4e1a6b
Author:     Boris BREZILLON <boris.brezillon at free-electrons.com>
AuthorDate: Sun Nov 30 19:10:30 2014 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Dec 1 00:41:50 2014 -0800

    mtd: nand: gpmi: add raw oob access functions
    
    Implement raw OOB access functions to retrieve OOB bytes when accessing the
    NAND in raw mode.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Tested-by: Huang Shijie <shijie8 at gmail.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 987de1e..4f3851a 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1528,6 +1528,22 @@ static int gpmi_ecc_write_page_raw(struct mtd_info *mtd,
 	return 0;
 }
 
+static int gpmi_ecc_read_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
+				 int page)
+{
+	chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
+
+	return gpmi_ecc_read_page_raw(mtd, chip, NULL, 1, page);
+}
+
+static int gpmi_ecc_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
+				 int page)
+{
+	chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0, page);
+
+	return gpmi_ecc_write_page_raw(mtd, chip, NULL, 1);
+}
+
 static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
 	struct nand_chip *chip = mtd->priv;
@@ -1847,6 +1863,8 @@ static int gpmi_init_last(struct gpmi_nand_data *this)
 	ecc->write_oob	= gpmi_ecc_write_oob;
 	ecc->read_page_raw = gpmi_ecc_read_page_raw;
 	ecc->write_page_raw = gpmi_ecc_write_page_raw;
+	ecc->read_oob_raw = gpmi_ecc_read_oob_raw;
+	ecc->write_oob_raw = gpmi_ecc_write_oob_raw;
 	ecc->mode	= NAND_ECC_HW;
 	ecc->size	= bch_geo->ecc_chunk_size;
 	ecc->strength	= bch_geo->ecc_strength;



More information about the linux-mtd-cvs mailing list