[OpenWrt-Devel] [PATCH] [ramips] mt7621: fix nand driver

Daniel Golle daniel at makrotopia.org
Tue Nov 17 07:24:45 EST 2015


On Sat, Nov 14, 2015 at 04:39:51PM +0900, YounJaeRho wrote:
> 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` )

Using JFFS2 on NAND is a bit whacky, you should probably use UBI.
If the bootloader doesn't support UBI, you should have a seperate
kernel partition and store both, rootfs and overlayfs in UBI.
See
https://dev.openwrt.org/browser/trunk/target/linux/lantiq/image/Makefile
for a bunch of good examples.

> 
> 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)
>  		 	   		   		 	   		   		 	   		  

> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
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