This patch fix mt7621 nand driver for linux-3.18 kernel. mt7621 share PIN between NAND,SDXC,SPI. so you should pinctrl in dts file that only one of them is used at a time.
Tested and working: * Initramfs * Squashfs * jffs2fs (no hardware ECC support when `CONFIG_JFFS2_FS` is toggled ) Signed-off-by: YounJae Rho <luxf...@live.com> --- fix `CONFIG_TARGET_ROOTFS_JFFS2` to `CONFIG_JFFS2_FS` --- 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_JFFS2_FS) + 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) _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel