<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:±¼¸²
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><div dir="ltr"><div><div dir="ltr"><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">This patch fix mt7621 nand driver for linux-3.18 kernel.</pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">mt7621 share PIN between NAND,SDXC,SPI.</pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">so you should pinctrl in dts file that only one of them is used at a time.</pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);"><br></pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">SQUASH support</pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">JFFS2 support (no hardware ECC support which is disabled by `<span style="line-height:21.3px;font-family:±¼¸², sans-serif;">CONFIG_TARGET_ROOTFS_JFFS2` </span><span style="line-height:21.3px;font-family:±¼¸², sans-serif;">)</span></pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);"><br></pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);"><br></pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">Signed-off-by: YounJae Rho <luxflow@live.com></pre><pre style="line-height:21.3px;color:rgb(68, 68, 68);font-size:15px;white-space:pre-wrap;background-color:rgb(255, 255, 255);">---</pre><pre style="background-color:rgb(255, 255, 255);"><font color="#444444"><span style="font-size:15px;line-height:21.3px;white-space:pre-wrap;">--- a/drivers/mtd/nand/mtk_nand.c
+++ b/drivers/mtd/nand/mtk_nand.c
@@ -42,6 +42,9 @@
 #include "bmt.h"
 #include "partition.h"
 
+#define NAND_MAX_OOBSIZE       640
+#define NAND_MAX_PAGESIZE      8192
+
 unsigned int CFG_BLOCKSIZE;
 
 static int shift_on_bbt = 0;
@@ -1422,9 +1425,7 @@ mtk_nand_erase_hw(struct mtd_info *mtd,
 {
        struct nand_chip *chip = (struct nand_chip *)mtd->priv;
 
-       chip->erase_cmd(mtd, page);
-
-       return chip->waitfunc(mtd, chip);
+       return chip->erase(mtd, chip);
 }
 
 static int
@@ -2092,7 +2093,11 @@ mtk_nand_probe(struct platform_device *p
 
        // For BMT, we need to revise driver architecture
        nand_chip->write_page = mtk_nand_write_page;
+       #if defined(CONFIG_TARGET_ROOTFS_JFFS2)
+       nand_chip->ecc.write_oob = NULL;
+       #else
        nand_chip->ecc.write_oob = mtk_nand_write_oob;
+       #endif
        nand_chip->block_markbad = mtk_nand_block_markbad;   // need to add nand_get_device()/nand_release_device().
        //      nand_chip->erase = mtk_nand_erase;   
        //    nand_chip->read_page = mtk_nand_read_page;
@@ -2175,7 +2180,7 @@ mtk_nand_probe(struct platform_device *p
        nand_chip->pagemask = (nand_chip->chipsize >> nand_chip->page_shift) - 1;
        nand_chip->phys_erase_shift = ffs(mtd->erasesize) - 1;
        nand_chip->chip_shift = ffs(nand_chip->chipsize) - 1;//0x1C;//ffs(nand_chip->chipsize) - 1;
-       nand_chip->oob_poi = nand_chip->buffers->databuf + mtd->writesize;
+       nand_chip->oob_poi = NULL;
        nand_chip->badblockpos = 0;
 
        if (devinfo.pagesize == 4096)</span></font></pre><pre style="background-color:rgb(255, 255, 255);"><font color="#444444"><span style="font-size:15px;line-height:21.3px;white-space:pre-wrap;"><br></span></font></pre>                                         </div></div><style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:±¼¸²;
}


--></style>                                      </div></div><style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:±¼¸²;
}

--></style>                                      </div></body>
</html>