亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? doc2000.c

?? mtd-snapshot-20041027
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * Linux driver for Disk-On-Chip 2000 and Millennium * (c) 1999 Machine Vision Holdings, Inc. * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> * * $Id: doc2000.c,v 1.63 2004/09/16 23:51:56 gleixner Exp $ */#include <linux/kernel.h>#include <linux/module.h>#include <asm/errno.h>#include <asm/io.h>#include <asm/uaccess.h>#include <linux/miscdevice.h>#include <linux/pci.h>#include <linux/delay.h>#include <linux/slab.h>#include <linux/sched.h>#include <linux/init.h>#include <linux/types.h>#include <linux/bitops.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/doc2000.h>#define DOC_SUPPORT_2000#define DOC_SUPPORT_2000TSOP#define DOC_SUPPORT_MILLENNIUM#ifdef DOC_SUPPORT_2000#define DoC_is_2000(doc) (doc->ChipID == DOC_ChipID_Doc2k)#else#define DoC_is_2000(doc) (0)#endif#if defined(DOC_SUPPORT_2000TSOP) || defined(DOC_SUPPORT_MILLENNIUM)#define DoC_is_Millennium(doc) (doc->ChipID == DOC_ChipID_DocMil)#else#define DoC_is_Millennium(doc) (0)#endif/* #define ECC_DEBUG *//* I have no idea why some DoC chips can not use memcpy_from|to_io(). * This may be due to the different revisions of the ASIC controller built-in or * simplily a QA/Bug issue. Who knows ?? If you have trouble, please uncomment * this: #undef USE_MEMCPY*/static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,		    size_t *retlen, u_char *buf);static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,		     size_t *retlen, const u_char *buf);static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,			size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,			 size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 			  unsigned long count, loff_t to, size_t *retlen,			  u_char *eccbuf, struct nand_oobinfo *oobsel);static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,			size_t *retlen, u_char *buf);static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,			 size_t *retlen, const u_char *buf);static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,			 size_t *retlen, const u_char *buf);static int doc_erase (struct mtd_info *mtd, struct erase_info *instr);static struct mtd_info *doc2klist = NULL;/* Perform the required delay cycles by reading from the appropriate register */static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles){	volatile char dummy;	int i;		for (i = 0; i < cycles; i++) {		if (DoC_is_Millennium(doc))			dummy = ReadDOC(doc->virtadr, NOP);		else			dummy = ReadDOC(doc->virtadr, DOCStatus);	}	}/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */static int _DoC_WaitReady(struct DiskOnChip *doc){	void __iomem *docptr = doc->virtadr;	unsigned long timeo = jiffies + (HZ * 10);	DEBUG(MTD_DEBUG_LEVEL3,	      "_DoC_WaitReady called for out-of-line wait\n");	/* Out-of-line routine to wait for chip response */	while (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B)) {		/* issue 2 read from NOP register after reading from CDSNControl register	   	see Software Requirement 11.4 item 2. */		DoC_Delay(doc, 2);		if (time_after(jiffies, timeo)) {			DEBUG(MTD_DEBUG_LEVEL2, "_DoC_WaitReady timed out.\n");			return -EIO;		}		udelay(1);		cond_resched();	}	return 0;}static inline int DoC_WaitReady(struct DiskOnChip *doc){	void __iomem *docptr = doc->virtadr;	/* This is inline, to optimise the common case, where it's ready instantly */	int ret = 0;	/* 4 read form NOP register should be issued in prior to the read from CDSNControl	   see Software Requirement 11.4 item 2. */	DoC_Delay(doc, 4);	if (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B))		/* Call the out-of-line routine to wait */		ret = _DoC_WaitReady(doc);	/* issue 2 read from NOP register after reading from CDSNControl register	   see Software Requirement 11.4 item 2. */	DoC_Delay(doc, 2);	return ret;}/* DoC_Command: Send a flash command to the flash chip through the CDSN Slow IO register to   bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is   required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */static inline int DoC_Command(struct DiskOnChip *doc, unsigned char command,			      unsigned char xtraflags){	void __iomem *docptr = doc->virtadr;	if (DoC_is_2000(doc))		xtraflags |= CDSN_CTRL_FLASH_IO;	/* Assert the CLE (Command Latch Enable) line to the flash chip */	WriteDOC(xtraflags | CDSN_CTRL_CLE | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	if (DoC_is_Millennium(doc))		WriteDOC(command, docptr, CDSNSlowIO);	/* Send the command */	WriteDOC_(command, docptr, doc->ioreg);	if (DoC_is_Millennium(doc))		WriteDOC(command, docptr, WritePipeTerm);	/* Lower the CLE line */	WriteDOC(xtraflags | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Wait for the chip to respond - Software requirement 11.4.1 (extended for any command) */	return DoC_WaitReady(doc);}/* DoC_Address: Set the current address for the flash chip through the CDSN Slow IO register to   bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is   required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,		       unsigned char xtraflags1, unsigned char xtraflags2){	int i;	void __iomem *docptr = doc->virtadr;	if (DoC_is_2000(doc))		xtraflags1 |= CDSN_CTRL_FLASH_IO;	/* Assert the ALE (Address Latch Enable) line to the flash chip */	WriteDOC(xtraflags1 | CDSN_CTRL_ALE | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Send the address */	/* Devices with 256-byte page are addressed as:	   Column (bits 0-7), Page (bits 8-15, 16-23, 24-31)	   * there is no device on the market with page256	   and more than 24 bits.	   Devices with 512-byte page are addressed as:	   Column (bits 0-7), Page (bits 9-16, 17-24, 25-31)	   * 25-31 is sent only if the chip support it.	   * bit 8 changes the read command to be sent	   (NAND_CMD_READ0 or NAND_CMD_READ1).	 */	if (numbytes == ADDR_COLUMN || numbytes == ADDR_COLUMN_PAGE) {		if (DoC_is_Millennium(doc))			WriteDOC(ofs & 0xff, docptr, CDSNSlowIO);		WriteDOC_(ofs & 0xff, docptr, doc->ioreg);	}	if (doc->page256) {		ofs = ofs >> 8;	} else {		ofs = ofs >> 9;	}	if (numbytes == ADDR_PAGE || numbytes == ADDR_COLUMN_PAGE) {		for (i = 0; i < doc->pageadrlen; i++, ofs = ofs >> 8) {			if (DoC_is_Millennium(doc))				WriteDOC(ofs & 0xff, docptr, CDSNSlowIO);			WriteDOC_(ofs & 0xff, docptr, doc->ioreg);		}	}	if (DoC_is_Millennium(doc))		WriteDOC(ofs & 0xff, docptr, WritePipeTerm);	DoC_Delay(doc, 2);	/* Needed for some slow flash chips. mf. */		/* FIXME: The SlowIO's for millennium could be replaced by 	   a single WritePipeTerm here. mf. */	/* Lower the ALE line */	WriteDOC(xtraflags1 | xtraflags2 | CDSN_CTRL_CE, docptr,		 CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Wait for the chip to respond - Software requirement 11.4.1 */	return DoC_WaitReady(doc);}/* Read a buffer from DoC, taking care of Millennium odditys */static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len){	volatile int dummy;	int modulus = 0xffff;	void __iomem *docptr = doc->virtadr;	int i;	if (len <= 0)		return;	if (DoC_is_Millennium(doc)) {		/* Read the data via the internal pipeline through CDSN IO register,		   see Pipelined Read Operations 11.3 */		dummy = ReadDOC(docptr, ReadPipeInit);		/* Millennium should use the LastDataRead register - Pipeline Reads */		len--;		/* This is needed for correctly ECC calculation */		modulus = 0xff;	}	for (i = 0; i < len; i++)		buf[i] = ReadDOC_(docptr, doc->ioreg + (i & modulus));	if (DoC_is_Millennium(doc)) {		buf[i] = ReadDOC(docptr, LastDataRead);	}}/* Write a buffer to DoC, taking care of Millennium odditys */static void DoC_WriteBuf(struct DiskOnChip *doc, const u_char * buf, int len){	void __iomem *docptr = doc->virtadr;	int i;	if (len <= 0)		return;	for (i = 0; i < len; i++)		WriteDOC_(buf[i], docptr, doc->ioreg + i);	if (DoC_is_Millennium(doc)) {		WriteDOC(0x00, docptr, WritePipeTerm);	}}/* DoC_SelectChip: Select a given flash chip within the current floor */static inline int DoC_SelectChip(struct DiskOnChip *doc, int chip){	void __iomem *docptr = doc->virtadr;	/* Software requirement 11.4.4 before writing DeviceSelect */	/* Deassert the CE line to eliminate glitches on the FCE# outputs */	WriteDOC(CDSN_CTRL_WP, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Select the individual flash chip requested */	WriteDOC(chip, docptr, CDSNDeviceSelect);	DoC_Delay(doc, 4);	/* Reassert the CE line */	WriteDOC(CDSN_CTRL_CE | CDSN_CTRL_FLASH_IO | CDSN_CTRL_WP, docptr,		 CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Wait for it to be ready */	return DoC_WaitReady(doc);}/* DoC_SelectFloor: Select a given floor (bank of flash chips) */static inline int DoC_SelectFloor(struct DiskOnChip *doc, int floor){	void __iomem *docptr = doc->virtadr;	/* Select the floor (bank) of chips required */	WriteDOC(floor, docptr, FloorSelect);	/* Wait for the chip to be ready */	return DoC_WaitReady(doc);}/* DoC_IdentChip: Identify a given NAND chip given {floor,chip} */static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip){	int mfr, id, i, j;	volatile char dummy;	/* Page in the required floor/chip */	DoC_SelectFloor(doc, floor);	DoC_SelectChip(doc, chip);	/* Reset the chip */	if (DoC_Command(doc, NAND_CMD_RESET, CDSN_CTRL_WP)) {		DEBUG(MTD_DEBUG_LEVEL2,		      "DoC_Command (reset) for %d,%d returned true\n",		      floor, chip);		return 0;	}	/* Read the NAND chip ID: 1. Send ReadID command */	if (DoC_Command(doc, NAND_CMD_READID, CDSN_CTRL_WP)) {		DEBUG(MTD_DEBUG_LEVEL2,		      "DoC_Command (ReadID) for %d,%d returned true\n",		      floor, chip);		return 0;	}	/* Read the NAND chip ID: 2. Send address byte zero */	DoC_Address(doc, ADDR_COLUMN, 0, CDSN_CTRL_WP, 0);	/* Read the manufacturer and device id codes from the device */	if (DoC_is_Millennium(doc)) {		DoC_Delay(doc, 2);		dummy = ReadDOC(doc->virtadr, ReadPipeInit);		mfr = ReadDOC(doc->virtadr, LastDataRead);		DoC_Delay(doc, 2);		dummy = ReadDOC(doc->virtadr, ReadPipeInit);		id = ReadDOC(doc->virtadr, LastDataRead);	} else {		/* CDSN Slow IO register see Software Req 11.4 item 5. */		dummy = ReadDOC(doc->virtadr, CDSNSlowIO);		DoC_Delay(doc, 2);		mfr = ReadDOC_(doc->virtadr, doc->ioreg);		/* CDSN Slow IO register see Software Req 11.4 item 5. */		dummy = ReadDOC(doc->virtadr, CDSNSlowIO);		DoC_Delay(doc, 2);		id = ReadDOC_(doc->virtadr, doc->ioreg);	}	/* No response - return failure */	if (mfr == 0xff || mfr == 0)		return 0;	/* Check it's the same as the first chip we identified. 	 * M-Systems say that any given DiskOnChip device should only	 * contain _one_ type of flash part, although that's not a 	 * hardware restriction. */	if (doc->mfr) {		if (doc->mfr == mfr && doc->id == id)			return 1;	/* This is another the same the first */		else			printk(KERN_WARNING			       "Flash chip at floor %d, chip %d is different:\n",			       floor, chip);	}	/* Print and store the manufacturer and ID codes. */	for (i = 0; nand_flash_ids[i].name != NULL; i++) {		if (id == nand_flash_ids[i].id) {			/* Try to identify manufacturer */			for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {				if (nand_manuf_ids[j].id == mfr)					break;			}				printk(KERN_INFO			       "Flash chip found: Manufacturer ID: %2.2X, "			       "Chip ID: %2.2X (%s:%s)\n", mfr, id,			       nand_manuf_ids[j].name, nand_flash_ids[i].name);			if (!doc->mfr) {				doc->mfr = mfr;				doc->id = id;				doc->chipshift = 					ffs((nand_flash_ids[i].chipsize << 20)) - 1;				doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0;				doc->pageadrlen = doc->chipshift > 25 ? 3 : 2;				doc->erasesize =				    nand_flash_ids[i].erasesize;				return 1;			}			return 0;		}	}	/* We haven't fully identified the chip. Print as much as we know. */	printk(KERN_WARNING "Unknown flash chip found: %2.2X %2.2X\n",	       id, mfr);	printk(KERN_WARNING "Please report to dwmw2@infradead.org\n");	return 0;}/* DoC_ScanChips: Find all NAND chips present in a DiskOnChip, and identify them */static void DoC_ScanChips(struct DiskOnChip *this, int maxchips){	int floor, chip;	int numchips[MAX_FLOORS];	int ret = 1;	this->numchips = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合色狠狠综合色| 菠萝蜜视频在线观看一区| 欧美日韩一区二区三区不卡| 亚洲国产毛片aaaaa无费看 | 色美美综合视频| 日本不卡的三区四区五区| 国产精品素人一区二区| 欧美高清精品3d| 成人三级伦理片| 麻豆精品一区二区av白丝在线| 国产偷国产偷亚洲高清人白洁 | 亚洲日本va午夜在线电影| 日韩精品最新网址| 色狠狠综合天天综合综合| 国产高清精品在线| 国产米奇在线777精品观看| 日韩电影一区二区三区| 亚洲成在人线免费| 一区视频在线播放| 精品久久久久久综合日本欧美| 51精品秘密在线观看| 欧美日韩一区不卡| 欧美日韩日日骚| 欧美性猛交xxxx黑人交| 日本乱码高清不卡字幕| 99精品久久只有精品| 国产精品伊人色| 国产制服丝袜一区| 国产精品一区二区x88av| 国产很黄免费观看久久| 懂色av中文一区二区三区| 国产精品亚洲一区二区三区妖精| 精品无人区卡一卡二卡三乱码免费卡| 免费在线一区观看| 国产高清久久久| 91美女在线看| 精品欧美久久久| 久久久www成人免费毛片麻豆| 亚洲国产精品成人久久综合一区| 国产嫩草影院久久久久| 亚洲国产精品精华液2区45| 一区二区三区日韩在线观看| 一区二区三区成人在线视频| 蜜臀av性久久久久蜜臀aⅴ四虎| 捆绑调教美女网站视频一区| 91在线丨porny丨国产| 日韩欧美视频在线| 亚洲精品中文在线观看| 老色鬼精品视频在线观看播放| www.爱久久.com| 欧美精品一区二区蜜臀亚洲| 亚洲电影视频在线| 99免费精品在线观看| 久久免费看少妇高潮| 午夜a成v人精品| 在线观看亚洲一区| 亚洲国产视频在线| 91福利小视频| 伊人开心综合网| 99精品视频在线免费观看| 精品日韩成人av| 美女国产一区二区| 日韩一级片在线观看| 青青草成人在线观看| 日韩欧美一二三四区| 老色鬼精品视频在线观看播放| 7777精品伊人久久久大香线蕉 | 久久综合九色综合欧美亚洲| 日韩在线一区二区| 91精品国产色综合久久| 免费观看一级欧美片| 精品欧美一区二区三区精品久久| 久久精品免费看| 久久久久久久电影| 国产美女精品在线| 国产精品网站导航| 一本大道久久a久久综合婷婷 | 国产精品国产a级| 91在线观看污| 日韩精品久久理论片| 日韩午夜av电影| 成人精品视频一区| 视频精品一区二区| 久久久99久久| 欧美日韩中文字幕一区二区| 秋霞国产午夜精品免费视频| 国产片一区二区三区| 91精品一区二区三区久久久久久| 韩国午夜理伦三级不卡影院| 欧美v日韩v国产v| 97aⅴ精品视频一二三区| 韩日av一区二区| 亚洲国产乱码最新视频| 国产精品日产欧美久久久久| 日韩欧美中文一区| 欧美在线短视频| 91丝袜高跟美女视频| 国产精品538一区二区在线| 亚洲成人动漫在线观看| 亚洲色图制服诱惑| 国产精品久久久久久久久晋中| 日韩一区二区在线免费观看| 成人性视频网站| 国内精品第一页| 国产一区二区三区四区五区美女| 亚洲国产美国国产综合一区二区| 亚洲天堂av一区| 亚洲欧美乱综合| 亚洲国产精品久久不卡毛片| 一区二区欧美国产| 亚洲精选免费视频| 一区二区三区小说| 亚洲一区二区精品视频| 亚洲超碰精品一区二区| 香蕉成人啪国产精品视频综合网 | 欧美日韩在线播放三区四区| 欧美日韩国产精品成人| 欧美一级生活片| 久久综合九色综合97_久久久| 久久精品亚洲精品国产欧美| 国产欧美一区二区三区沐欲| 1024成人网色www| 日韩精品国产精品| 国产不卡在线播放| 在线观看亚洲一区| 久久先锋资源网| 一区二区三区av电影 | 久久99精品久久久久久久久久久久| 韩国欧美国产一区| 在线观看视频一区二区| 欧美成人三级在线| 亚洲综合免费观看高清完整版在线 | 日韩电影在线免费| 成人性视频免费网站| 欧美一区二区三区视频免费播放| 精品久久国产老人久久综合| 亚洲欧洲日韩女同| 国产中文字幕一区| 精品国产乱码久久久久久1区2区| 亚洲自拍偷拍麻豆| 在线观看亚洲成人| 一区二区三区在线观看欧美| 国产凹凸在线观看一区二区| 精品少妇一区二区三区 | 亚洲三级免费观看| 成人性视频网站| 国产精品无码永久免费888| 国产福利91精品一区二区三区| 91.xcao| 奇米四色…亚洲| 欧美电影免费观看高清完整版在| 亚洲成人av电影在线| 欧美男人的天堂一二区| 亚洲国产裸拍裸体视频在线观看乱了| 成人深夜在线观看| 国产精品超碰97尤物18| 99久久777色| 亚洲成在人线免费| 欧美精品少妇一区二区三区| 日韩影院免费视频| 久久嫩草精品久久久精品一| 成人午夜又粗又硬又大| 亚洲欧美日韩电影| 在线成人高清不卡| 国产成人鲁色资源国产91色综 | 国产精品国产三级国产aⅴ无密码| 成人91在线观看| 丝袜a∨在线一区二区三区不卡| 欧美一区二区三区视频| 国产成人午夜高潮毛片| 亚洲黄色尤物视频| 精品国产一区二区在线观看| av在线不卡电影| 日韩不卡一二三区| 国产蜜臀97一区二区三区| 欧美丝袜第三区| 国产一区二区美女| 五月天视频一区| 成人欧美一区二区三区小说| 91精品国产欧美一区二区成人 | 色综合一个色综合亚洲| 狠狠色丁香婷综合久久| 亚洲一区二区三区四区的| 欧美激情一区在线| 精品国内片67194| 日韩一二三四区| 午夜欧美视频在线观看 | 欧美乱妇23p| 欧美日韩国产综合草草| 成人中文字幕合集| 成人午夜电影小说| 国产精品99久久久久久久vr| 日本不卡的三区四区五区| 婷婷久久综合九色综合绿巨人| 综合久久给合久久狠狠狠97色 | 欧美三级视频在线播放| 欧美性色欧美a在线播放| 91免费观看视频在线| 在线观看国产91| 欧美一级免费观看|