diff options
author | Huang Shijie <b32955@freescale.com> | 2013-09-25 02:58:15 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-10-27 19:27:06 -0400 |
commit | 7a2b89acf8edbff462fa6e1fc6100c5dc85364ed (patch) | |
tree | 650dd1538d24932cab3b9dd1e386f58521bf9088 /drivers/mtd/nand | |
parent | 3723e93c6499d74041c9768aeb921b36490b9585 (diff) |
mtd: gpmi: rewrite the gpmi_ecc_write_oob() to support the jffs2
When we use the ECC info which is get from the nand chip's datasheet,
we may have some freed oob area now.
This patch rewrites the gpmi_ecc_write_oob() to implement the ecc.write_oob().
We also update the comment for gpmi_hw_ecclayout.
Yes! We can support the JFFS2 for the SLC nand now.
Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 10a092dbaa71..37508eb350d0 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
@@ -45,7 +45,10 @@ static struct nand_bbt_descr gpmi_bbt_descr = { | |||
45 | .pattern = scan_ff_pattern | 45 | .pattern = scan_ff_pattern |
46 | }; | 46 | }; |
47 | 47 | ||
48 | /* We will use all the (page + OOB). */ | 48 | /* |
49 | * We may change the layout if we can get the ECC info from the datasheet, | ||
50 | * else we will use all the (page + OOB). | ||
51 | */ | ||
49 | static struct nand_ecclayout gpmi_hw_ecclayout = { | 52 | static struct nand_ecclayout gpmi_hw_ecclayout = { |
50 | .eccbytes = 0, | 53 | .eccbytes = 0, |
51 | .eccpos = { 0, }, | 54 | .eccpos = { 0, }, |
@@ -1263,14 +1266,22 @@ static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, | |||
1263 | static int | 1266 | static int |
1264 | gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) | 1267 | gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) |
1265 | { | 1268 | { |
1266 | /* | 1269 | struct nand_oobfree *of = mtd->ecclayout->oobfree; |
1267 | * The BCH will use all the (page + oob). | 1270 | int status = 0; |
1268 | * Our gpmi_hw_ecclayout can only prohibit the JFFS2 to write the oob. | 1271 | |
1269 | * But it can not stop some ioctls such MEMWRITEOOB which uses | 1272 | /* Do we have available oob area? */ |
1270 | * MTD_OPS_PLACE_OOB. So We have to implement this function to prohibit | 1273 | if (!of->length) |
1271 | * these ioctls too. | 1274 | return -EPERM; |
1272 | */ | 1275 | |
1273 | return -EPERM; | 1276 | if (!nand_is_slc(chip)) |
1277 | return -EPERM; | ||
1278 | |||
1279 | chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize + of->offset, page); | ||
1280 | chip->write_buf(mtd, chip->oob_poi + of->offset, of->length); | ||
1281 | chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); | ||
1282 | |||
1283 | status = chip->waitfunc(mtd, chip); | ||
1284 | return status & NAND_STATUS_FAIL ? -EIO : 0; | ||
1274 | } | 1285 | } |
1275 | 1286 | ||
1276 | static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) | 1287 | static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) |