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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? doc2001.c

?? 老版本的mtd-snap
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/* * Linux driver for Disk-On-Chip Millennium * (c) 1999 Machine Vision Holdings, Inc. * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> * * $Id: doc2001.c,v 1.48 2005/01/05 18:05:12 dwmw2 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 ECC_DEBUG *//* I have no idea why some DoC chips can not use memcop_form|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_MEMCPYstatic 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_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_erase (struct mtd_info *mtd, struct erase_info *instr);static struct mtd_info *docmillist = NULL;/* Perform the required delay cycles by reading from the NOP register */static void DoC_Delay(void __iomem * docptr, unsigned short cycles){	volatile char dummy;	int i;	for (i = 0; i < cycles; i++)		dummy = ReadDOC(docptr, NOP);}/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */static int _DoC_WaitReady(void __iomem * docptr){	unsigned short c = 0xffff;	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) && --c)		;	if (c == 0)		DEBUG(MTD_DEBUG_LEVEL2, "_DoC_WaitReady timed out.\n");	return (c == 0);}static inline int DoC_WaitReady(void __iomem * docptr){	/* 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(docptr, 4);	if (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B))		/* Call the out-of-line routine to wait */		ret = _DoC_WaitReady(docptr);	/* issue 2 read from NOP register after reading from CDSNControl register	   see Software Requirement 11.4 item 2. */	DoC_Delay(docptr, 2);	return ret;}/* DoC_Command: Send a flash command to the flash chip through the CDSN IO register   with 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 void DoC_Command(void __iomem * docptr, unsigned char command,			       unsigned char xtraflags){	/* Assert the CLE (Command Latch Enable) line to the flash chip */	WriteDOC(xtraflags | CDSN_CTRL_CLE | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(docptr, 4);	/* Send the command */	WriteDOC(command, docptr, Mil_CDSN_IO);	WriteDOC(0x00, docptr, WritePipeTerm);	/* Lower the CLE line */	WriteDOC(xtraflags | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(docptr, 4);}/* DoC_Address: Set the current address for the flash chip through the CDSN IO register   with 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 void DoC_Address(void __iomem * docptr, int numbytes, unsigned long ofs,			       unsigned char xtraflags1, unsigned char xtraflags2){	/* Assert the ALE (Address Latch Enable) line to the flash chip */	WriteDOC(xtraflags1 | CDSN_CTRL_ALE | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(docptr, 4);	/* Send the address */	switch (numbytes)	    {	    case 1:		    /* Send single byte, bits 0-7. */		    WriteDOC(ofs & 0xff, docptr, Mil_CDSN_IO);		    WriteDOC(0x00, docptr, WritePipeTerm);		    break;	    case 2:		    /* Send bits 9-16 followed by 17-23 */		    WriteDOC((ofs >> 9)  & 0xff, docptr, Mil_CDSN_IO);		    WriteDOC((ofs >> 17) & 0xff, docptr, Mil_CDSN_IO);		    WriteDOC(0x00, docptr, WritePipeTerm);		break;	    case 3:		    /* Send 0-7, 9-16, then 17-23 */		    WriteDOC(ofs & 0xff, docptr, Mil_CDSN_IO);		    WriteDOC((ofs >> 9)  & 0xff, docptr, Mil_CDSN_IO);		    WriteDOC((ofs >> 17) & 0xff, docptr, Mil_CDSN_IO);		    WriteDOC(0x00, docptr, WritePipeTerm);		break;	    default:		return;	    }	/* Lower the ALE line */	WriteDOC(xtraflags1 | xtraflags2 | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(docptr, 4);}/* DoC_SelectChip: Select a given flash chip within the current floor */static int DoC_SelectChip(void __iomem * docptr, int chip){	/* Select the individual flash chip requested */	WriteDOC(chip, docptr, CDSNDeviceSelect);	DoC_Delay(docptr, 4);	/* Wait for it to be ready */	return DoC_WaitReady(docptr);}/* DoC_SelectFloor: Select a given floor (bank of flash chips) */static int DoC_SelectFloor(void __iomem * docptr, int floor){	/* Select the floor (bank) of chips required */	WriteDOC(floor, docptr, FloorSelect);	/* Wait for the chip to be ready */	return DoC_WaitReady(docptr);}/* 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	   FIXME: is this supported by Millennium ?? */	DoC_SelectFloor(doc->virtadr, floor);	DoC_SelectChip(doc->virtadr, chip);	/* Reset the chip, see Software Requirement 11.4 item 1. */	DoC_Command(doc->virtadr, NAND_CMD_RESET, CDSN_CTRL_WP);	DoC_WaitReady(doc->virtadr);	/* Read the NAND chip ID: 1. Send ReadID command */ 	DoC_Command(doc->virtadr, NAND_CMD_READID, CDSN_CTRL_WP);	/* Read the NAND chip ID: 2. Send address byte zero */ 	DoC_Address(doc->virtadr, 1, 0x00, CDSN_CTRL_WP, 0x00);	/* Read the manufacturer and device id codes of the flash device through	   CDSN IO register see Software Requirement 11.4 item 5.*/	dummy = ReadDOC(doc->virtadr, ReadPipeInit);	DoC_Delay(doc->virtadr, 2);	mfr = ReadDOC(doc->virtadr, Mil_CDSN_IO);	DoC_Delay(doc->virtadr, 2);	id  = ReadDOC(doc->virtadr, Mil_CDSN_IO);	dummy = ReadDOC(doc->virtadr, LastDataRead);	/* No response - return failure */	if (mfr == 0xff || mfr == 0)		return 0;	/* FIXME: to deal with multi-flash on multi-Millennium case more carefully */	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);			doc->mfr = mfr;			doc->id = id;			doc->chipshift = ffs((nand_flash_ids[i].chipsize << 20)) - 1;			break;		}	}	if (nand_flash_ids[i].name == NULL)		return 0;	else		return 1;}/* DoC_ScanChips: Find all NAND chips present in a DiskOnChip, and identify them */static void DoC_ScanChips(struct DiskOnChip *this){	int floor, chip;	int numchips[MAX_FLOORS_MIL];	int ret;	this->numchips = 0;	this->mfr = 0;	this->id = 0;	/* For each floor, find the number of valid chips it contains */	for (floor = 0,ret = 1; floor < MAX_FLOORS_MIL; floor++) {		numchips[floor] = 0;		for (chip = 0; chip < MAX_CHIPS_MIL && ret != 0; chip++) {			ret = DoC_IdentChip(this, floor, chip);			if (ret) {				numchips[floor]++;				this->numchips++;			}		}	}	/* If there are none at all that we recognise, bail */	if (!this->numchips) {		printk("No flash chips recognised.\n");		return;	}	/* Allocate an array to hold the information for each chip */	this->chips = kmalloc(sizeof(struct Nand) * this->numchips, GFP_KERNEL);	if (!this->chips){		printk("No memory for allocating chip info structures\n");		return;	}	/* Fill out the chip array with {floor, chipno} for each 	 * detected chip in the device. */	for (floor = 0, ret = 0; floor < MAX_FLOORS_MIL; floor++) {		for (chip = 0 ; chip < numchips[floor] ; chip++) {			this->chips[ret].floor = floor;			this->chips[ret].chip = chip;			this->chips[ret].curadr = 0;			this->chips[ret].curmode = 0x50;			ret++;		}	}	/* Calculate and print the total size of the device */	this->totlen = this->numchips * (1 << this->chipshift);	printk(KERN_INFO "%d flash chips found. Total DiskOnChip size: %ld MiB\n",	       this->numchips ,this->totlen >> 20);}static int DoCMil_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2){	int tmp1, tmp2, retval;	if (doc1->physadr == doc2->physadr)		return 1;	/* Use the alias resolution register which was set aside for this	 * purpose. If it's value is the same on both chips, they might	 * be the same chip, and we write to one and check for a change in	 * the other. It's unclear if this register is usuable in the	 * DoC 2000 (it's in the Millenium docs), but it seems to work. */	tmp1 = ReadDOC(doc1->virtadr, AliasResolution);	tmp2 = ReadDOC(doc2->virtadr, AliasResolution);	if (tmp1 != tmp2)		return 0;		WriteDOC((tmp1+1) % 0xff, doc1->virtadr, AliasResolution);	tmp2 = ReadDOC(doc2->virtadr, AliasResolution);	if (tmp2 == (tmp1+1) % 0xff)		retval = 1;	else		retval = 0;	/* Restore register contents.  May not be necessary, but do it just to	 * be safe. */	WriteDOC(tmp1, doc1->virtadr, AliasResolution);	return retval;}static const char im_name[] = "DoCMil_init";/* This routine is made available to other mtd code via * inter_module_register.  It must only be accessed through * inter_module_get which will bump the use count of this module.  The * addresses passed back in mtd are valid as long as the use count of * this module is non-zero, i.e. between inter_module_get and * inter_module_put.  Keith Owens <kaos@ocs.com.au> 29 Oct 2000. */static void DoCMil_init(struct mtd_info *mtd){	struct DiskOnChip *this = mtd->priv;	struct DiskOnChip *old = NULL;	/* We must avoid being called twice for the same device. */	if (docmillist)		old = docmillist->priv;	while (old) {		if (DoCMil_is_alias(this, old)) {			printk(KERN_NOTICE "Ignoring DiskOnChip Millennium at "			       "0x%lX - already configured\n", this->physadr);			iounmap(this->virtadr);			kfree(mtd);			return;		}		if (old->nextdoc)			old = old->nextdoc->priv;		else			old = NULL;	}	mtd->name = "DiskOnChip Millennium";	printk(KERN_NOTICE "DiskOnChip Millennium found at address 0x%lX\n",	       this->physadr);	mtd->type = MTD_NANDFLASH;	mtd->flags = MTD_CAP_NANDFLASH;	mtd->ecctype = MTD_ECC_RS_DiskOnChip;	mtd->size = 0;	/* FIXME: erase size is not always 8KiB */	mtd->erasesize = 0x2000;	mtd->oobblock = 512;	mtd->oobsize = 16;	mtd->owner = THIS_MODULE;	mtd->erase = doc_erase;	mtd->point = NULL;	mtd->unpoint = NULL;	mtd->read = doc_read;	mtd->write = doc_write;	mtd->read_ecc = doc_read_ecc;	mtd->write_ecc = doc_write_ecc;	mtd->read_oob = doc_read_oob;	mtd->write_oob = doc_write_oob;	mtd->sync = NULL;	this->totlen = 0;	this->numchips = 0;	this->curfloor = -1;	this->curchip = -1;	/* Ident all the chips present. */	DoC_ScanChips(this);	if (!this->totlen) {		kfree(mtd);		iounmap(this->virtadr);	} else {		this->nextdoc = docmillist;		docmillist = mtd;		mtd->size  = this->totlen;		add_mtd_device(mtd);		return;	}}static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,		     size_t *retlen, u_char *buf){	/* Just a special case of doc_read_ecc */	return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL);}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){	int i, ret;	volatile char dummy;	unsigned char syndrome[6];	struct DiskOnChip *this = mtd->priv;	void __iomem *docptr = this->virtadr;	struct Nand *mychip = &this->chips[from >> (this->chipshift)];	/* Don't allow read past end of device */	if (from >= this->totlen)		return -EINVAL;	/* Don't allow a single read to cross a 512-byte block boundary */	if (from + len > ((from | 0x1ff) + 1)) 		len = ((from | 0x1ff) + 1) - from;	/* Find the chip which is to be used and select it */	if (this->curfloor != mychip->floor) {		DoC_SelectFloor(docptr, mychip->floor);		DoC_SelectChip(docptr, mychip->chip);	} else if (this->curchip != mychip->chip) {		DoC_SelectChip(docptr, mychip->chip);	}	this->curfloor = mychip->floor;	this->curchip = mychip->chip;	/* issue the Read0 or Read1 command depend on which half of the page	   we are accessing. Polling the Flash Ready bit after issue 3 bytes	   address in Sequence Read Mode, see Software Requirement 11.4 item 1.*/	DoC_Command(docptr, (from >> 8) & 1, CDSN_CTRL_WP);	DoC_Address(docptr, 3, from, CDSN_CTRL_WP, 0x00);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久草中文综合在线| 亚洲精品国产一区二区精华液 | 国产精品中文欧美| 精品国产91洋老外米糕| 欧美日韩亚洲高清一区二区| 亚洲成人激情综合网| 51精品视频一区二区三区| 美国十次综合导航| 久久精品人人爽人人爽| 99国产精品一区| 亚洲一区二区av电影| 欧美一区二区三区的| 激情小说欧美图片| 国产精品福利一区二区三区| 91美女片黄在线| 天天射综合影视| 精品国产污网站| av亚洲精华国产精华| 一区二区三区 在线观看视频| 欧美三级在线视频| 精品午夜久久福利影院| 亚洲国产电影在线观看| 91久久一区二区| 久久福利视频一区二区| 中文字幕中文字幕中文字幕亚洲无线| 91蜜桃视频在线| 久久精品噜噜噜成人88aⅴ| 国产欧美日韩另类视频免费观看| 国产精品一区专区| 精品少妇一区二区三区视频免付费| 亚洲综合自拍偷拍| 91免费看片在线观看| 一区二区三区.www| 久久久夜色精品亚洲| 国产丝袜美腿一区二区三区| 97精品久久久午夜一区二区三区 | 成人a免费在线看| 亚洲成人精品在线观看| 欧美国产激情一区二区三区蜜月| 91亚洲国产成人精品一区二三| 天天色综合天天| 亚洲天天做日日做天天谢日日欢 | 国产激情视频一区二区在线观看| 亚洲午夜免费电影| 国产日韩欧美不卡| 日韩一区二区三区三四区视频在线观看| 国产成+人+日韩+欧美+亚洲| 日韩成人精品视频| 亚洲欧美日韩精品久久久久| 久久久噜噜噜久久中文字幕色伊伊| 久久美女艺术照精彩视频福利播放| 亚洲高清不卡在线| 精品日韩一区二区三区| 亚洲一区二区三区在线播放| 久久久三级国产网站| 7777精品伊人久久久大香线蕉超级流畅| 久久99国产精品麻豆| 丰满亚洲少妇av| 国产综合色在线视频区| 日本大胆欧美人术艺术动态| 尤物视频一区二区| 亚洲欧美另类综合偷拍| 中文字幕二三区不卡| 欧美精品一区在线观看| 91精品国产手机| 51久久夜色精品国产麻豆| 欧美日韩一区国产| 欧美在线观看一区二区| 在线视频你懂得一区二区三区| 狠狠色丁香久久婷婷综| 1区2区3区欧美| 日韩美女视频一区二区| 国产成人免费9x9x人网站视频| 日韩精品在线一区| 激情欧美日韩一区二区| 国产欧美日韩不卡免费| 一本色道a无线码一区v| 婷婷国产v国产偷v亚洲高清| 日韩一区二区三| 岛国一区二区三区| 亚洲精品综合在线| 精品动漫一区二区三区在线观看| 大胆亚洲人体视频| 亚洲成人av电影| 国产精品久久久久久福利一牛影视| 欧美日韩综合在线免费观看| 国模一区二区三区白浆| 国产一区二三区| 亚洲电影在线免费观看| 日韩一区二区三| 精品国产亚洲一区二区三区在线观看 | 国产一区二区三区精品欧美日韩一区二区三区 | 国产91丝袜在线18| 国产成人综合视频| av不卡免费电影| 日本精品视频一区二区| 欧美福利视频一区| 日韩欧美国产三级电影视频| 精品乱码亚洲一区二区不卡| 久久精品人人做人人爽97| 国产精品国模大尺度视频| 亚洲欧洲另类国产综合| 亚洲一区二区三区精品在线| 日韩综合在线视频| 国产精品一品二品| 91免费版在线| 在线电影国产精品| 久久精品水蜜桃av综合天堂| 综合自拍亚洲综合图不卡区| 污片在线观看一区二区| 精品一区二区在线视频| 91丝袜美腿高跟国产极品老师| 欧美性猛片aaaaaaa做受| 日韩女优制服丝袜电影| 国产精品三级久久久久三级| 一区二区三区四区不卡视频 | 亚洲一区视频在线观看视频| 日本成人在线不卡视频| 国产成人综合精品三级| 欧美日韩你懂得| 国产人久久人人人人爽| 亚洲人吸女人奶水| 久久国产精品免费| 欧美专区在线观看一区| 欧美草草影院在线视频| ㊣最新国产の精品bt伙计久久| 日韩成人精品视频| aaa欧美大片| 精品国偷自产国产一区| 一区二区在线观看视频| 国内外成人在线| 欧美色精品在线视频| 国产精品情趣视频| 久久66热re国产| 欧美男男青年gay1069videost| 欧美激情综合在线| 蜜桃视频一区二区| 欧美亚洲国产一区在线观看网站 | 欧美国产激情一区二区三区蜜月| 午夜欧美电影在线观看| 91美女视频网站| 国产三级精品视频| 日本伊人午夜精品| 欧美自拍偷拍午夜视频| 中文字幕日韩精品一区| 精品在线播放免费| 欧美一级xxx| 亚洲bdsm女犯bdsm网站| 99精品国产99久久久久久白柏| 久久蜜臀精品av| 狠狠网亚洲精品| 91精品国产欧美一区二区18| 亚洲综合一区二区三区| 成人免费视频视频| 国产午夜三级一区二区三| 久久国产乱子精品免费女| 制服丝袜av成人在线看| 亚洲国产综合人成综合网站| 日本大香伊一区二区三区| 国产精品久久久爽爽爽麻豆色哟哟| 激情亚洲综合在线| 精品国产免费久久| 久久国产精品99久久久久久老狼 | 色婷婷香蕉在线一区二区| 亚洲欧洲无码一区二区三区| 国产成人一区在线| 国产亚洲一本大道中文在线| 国内成人免费视频| 国产亚洲福利社区一区| 韩国精品主播一区二区在线观看| 日韩欧美专区在线| 美脚の诱脚舐め脚责91 | 亚洲国产美国国产综合一区二区| 99免费精品视频| 亚洲精品国产一区二区三区四区在线 | 91丨porny丨首页| 亚洲天堂成人网| 91小视频免费看| 夜色激情一区二区| 欧美精品免费视频| 久久福利视频一区二区| 国产亚洲一二三区| aaa亚洲精品一二三区| 一区二区三区色| 欧美日韩在线免费视频| 丝袜亚洲精品中文字幕一区| 91精品国产入口| 韩国毛片一区二区三区| 欧美激情一区二区三区| 91美女蜜桃在线| 日韩黄色一级片| 久久老女人爱爱| 91高清在线观看| 三级久久三级久久久| 欧美精品一区二| 99精品视频在线播放观看| 亚洲成人免费观看| 久久夜色精品国产欧美乱极品| www.久久精品| 日韩二区在线观看|