[OpenWrt-Devel] [PATCH] [ramips] mt7621: fix nand driver
YounJaeRho
luxflow at live.com
Sat Nov 14 02:39:51 EST 2015
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.
SQUASH supportJFFS2 support (no hardware ECC support which is disabled by `CONFIG_TARGET_ROOTFS_JFFS2` )
Signed-off-by: YounJae Rho <luxflow at live.com>------ 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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20151114/25bd3d23/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list