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

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

?? doc2001plus.c

?? linux mtd設(shè)備操作工具軟件
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/* * Linux driver for Disk-On-Chip Millennium Plus * * (c) 2002-2003 Greg Ungerer <gerg@snapgear.com> * (c) 2002-2003 SnapGear Inc * (c) 1999 Machine Vision Holdings, Inc. * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> * * $Id: doc2001plus.c,v 1.13 2005/01/05 18:05:12 dwmw2 Exp $ * * Released under GPL */#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 *docmilpluslist = NULL;/* Perform the required delay cycles by writing to the NOP register */static void DoC_Delay(void __iomem * docptr, int cycles){	int i;	for (i = 0; (i < cycles); i++)		WriteDOC(0, docptr, Mplus_NOP);}#define	CDSN_CTRL_FR_B_MASK	(CDSN_CTRL_FR_B0 | CDSN_CTRL_FR_B1)/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */static int _DoC_WaitReady(void __iomem * docptr){	unsigned int 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, Mplus_FlashControl) & CDSN_CTRL_FR_B_MASK) != CDSN_CTRL_FR_B_MASK) && --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;	/* read form NOP register should be issued prior to the read from CDSNControl	   see Software Requirement 11.4 item 2. */	DoC_Delay(docptr, 4);	if ((ReadDOC(docptr, Mplus_FlashControl) & CDSN_CTRL_FR_B_MASK) != CDSN_CTRL_FR_B_MASK)		/* Call the out-of-line routine to wait */		ret = _DoC_WaitReady(docptr);	return ret;}/* For some reason the Millennium Plus seems to occassionally put itself * into reset mode. For me this happens randomly, with no pattern that I * can detect. M-systems suggest always check this on any block level * operation and setting to normal mode if in reset mode. */static inline void DoC_CheckASIC(void __iomem * docptr){	/* Make sure the DoC is in normal mode */	if ((ReadDOC(docptr, Mplus_DOCControl) & DOC_MODE_NORMAL) == 0) {		WriteDOC((DOC_MODE_NORMAL | DOC_MODE_MDWREN), docptr, Mplus_DOCControl);		WriteDOC(~(DOC_MODE_NORMAL | DOC_MODE_MDWREN), docptr, Mplus_CtrlConfirm);	}}/* DoC_Command: Send a flash command to the flash chip through the Flash * command register. Need 2 Write Pipeline Terminates to complete send. */static inline void DoC_Command(void __iomem * docptr, unsigned char command,			       unsigned char xtraflags){	WriteDOC(command, docptr, Mplus_FlashCmd);	WriteDOC(command, docptr, Mplus_WritePipeTerm);	WriteDOC(command, docptr, Mplus_WritePipeTerm);}/* DoC_Address: Set the current address for the flash chip through the Flash * Address register. Need 2 Write Pipeline Terminates to complete send. */static inline void DoC_Address(struct DiskOnChip *doc, int numbytes,			       unsigned long ofs, unsigned char xtraflags1,			       unsigned char xtraflags2){	void __iomem * docptr = doc->virtadr;	/* Allow for possible Mill Plus internal flash interleaving */	ofs >>= doc->interleave;	switch (numbytes) {	case 1:		/* Send single byte, bits 0-7. */		WriteDOC(ofs & 0xff, docptr, Mplus_FlashAddress);		break;	case 2:		/* Send bits 9-16 followed by 17-23 */		WriteDOC((ofs >> 9)  & 0xff, docptr, Mplus_FlashAddress);		WriteDOC((ofs >> 17) & 0xff, docptr, Mplus_FlashAddress);		break;	case 3:		/* Send 0-7, 9-16, then 17-23 */		WriteDOC(ofs & 0xff, docptr, Mplus_FlashAddress);		WriteDOC((ofs >> 9)  & 0xff, docptr, Mplus_FlashAddress);		WriteDOC((ofs >> 17) & 0xff, docptr, Mplus_FlashAddress);		break;	default:		return;	}	WriteDOC(0x00, docptr, Mplus_WritePipeTerm);	WriteDOC(0x00, docptr, Mplus_WritePipeTerm);}/* DoC_SelectChip: Select a given flash chip within the current floor */static int DoC_SelectChip(void __iomem * docptr, int chip){	/* No choice for flash chip on Millennium Plus */	return 0;}/* DoC_SelectFloor: Select a given floor (bank of flash chips) */static int DoC_SelectFloor(void __iomem * docptr, int floor){	WriteDOC((floor & 0x3), docptr, Mplus_DeviceSelect);	return 0;}/* * Translate the given offset into the appropriate command and offset. * This does the mapping using the 16bit interleave layout defined by * M-Systems, and looks like this for a sector pair: *  +-----------+-------+-------+-------+--------------+---------+-----------+ *  | 0 --- 511 |512-517|518-519|520-521| 522 --- 1033 |1034-1039|1040 - 1055| *  +-----------+-------+-------+-------+--------------+---------+-----------+ *  | Data 0    | ECC 0 |Flags0 |Flags1 | Data 1       |ECC 1    | OOB 1 + 2 | *  +-----------+-------+-------+-------+--------------+---------+-----------+ *//* FIXME: This lives in INFTL not here. Other users of flash devices   may not want it */static unsigned int DoC_GetDataOffset(struct mtd_info *mtd, loff_t *from){	struct DiskOnChip *this = mtd->priv;	if (this->interleave) {		unsigned int ofs = *from & 0x3ff;		unsigned int cmd;		if (ofs < 512) {			cmd = NAND_CMD_READ0;			ofs &= 0x1ff;		} else if (ofs < 1014) {			cmd = NAND_CMD_READ1;			ofs = (ofs & 0x1ff) + 10;		} else {			cmd = NAND_CMD_READOOB;			ofs = ofs - 1014;		}		*from = (*from & ~0x3ff) | ofs;		return cmd;	} else {		/* No interleave */		if ((*from) & 0x100)			return NAND_CMD_READ1;		return NAND_CMD_READ0;	}}static unsigned int DoC_GetECCOffset(struct mtd_info *mtd, loff_t *from){	unsigned int ofs, cmd;	if (*from & 0x200) {		cmd = NAND_CMD_READOOB;		ofs = 10 + (*from & 0xf);	} else {		cmd = NAND_CMD_READ1;		ofs = (*from & 0xf);	}	*from = (*from & ~0x3ff) | ofs;	return cmd;}static unsigned int DoC_GetFlagsOffset(struct mtd_info *mtd, loff_t *from){	unsigned int ofs, cmd;	cmd = NAND_CMD_READ1;	ofs = (*from & 0x200) ? 8 : 6;	*from = (*from & ~0x3ff) | ofs;	return cmd;}static unsigned int DoC_GetHdrOffset(struct mtd_info *mtd, loff_t *from){	unsigned int ofs, cmd;	cmd = NAND_CMD_READOOB;	ofs = (*from & 0x200) ? 24 : 16;	*from = (*from & ~0x3ff) | ofs;	return cmd;}static inline void MemReadDOC(void __iomem * docptr, unsigned char *buf, int len){#ifndef USE_MEMCPY	int i;	for (i = 0; i < len; i++)		buf[i] = ReadDOC(docptr, Mil_CDSN_IO + i);#else	memcpy_fromio(buf, docptr + DoC_Mil_CDSN_IO, len);#endif}static inline void MemWriteDOC(void __iomem * docptr, unsigned char *buf, int len){#ifndef USE_MEMCPY	int i;	for (i = 0; i < len; i++)		WriteDOC(buf[i], docptr, Mil_CDSN_IO + i);#else	memcpy_toio(docptr + DoC_Mil_CDSN_IO, buf, len);#endif}/* 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;	void __iomem * docptr = doc->virtadr;	/* Page in the required floor/chip */	DoC_SelectFloor(docptr, floor);	DoC_SelectChip(docptr, chip);	/* Millennium Plus bus cycle sequence as per figure 2, section 2.4 */	WriteDOC((DOC_FLASH_CE | DOC_FLASH_WP), docptr, Mplus_FlashSelect);	/* Reset the chip, see Software Requirement 11.4 item 1. */	DoC_Command(docptr, NAND_CMD_RESET, 0);	DoC_WaitReady(docptr);	/* Read the NAND chip ID: 1. Send ReadID command */ 	DoC_Command(docptr, NAND_CMD_READID, 0);	/* Read the NAND chip ID: 2. Send address byte zero */ 	DoC_Address(doc, 1, 0x00, 0, 0x00);	WriteDOC(0, docptr, Mplus_FlashControl);	DoC_WaitReady(docptr);	/* Read the manufacturer and device id codes of the flash device through	   CDSN IO register see Software Requirement 11.4 item 5.*/	dummy = ReadDOC(docptr, Mplus_ReadPipeInit);	dummy = ReadDOC(docptr, Mplus_ReadPipeInit);	mfr = ReadDOC(docptr, Mil_CDSN_IO);	if (doc->interleave)		dummy = ReadDOC(docptr, Mil_CDSN_IO); /* 2 way interleave */	id  = ReadDOC(docptr, Mil_CDSN_IO);	if (doc->interleave)		dummy = ReadDOC(docptr, Mil_CDSN_IO); /* 2 way interleave */	dummy = ReadDOC(docptr, Mplus_LastDataRead);	dummy = ReadDOC(docptr, Mplus_LastDataRead);	/* Disable flash internally */	WriteDOC(0, docptr, Mplus_FlashSelect);	/* No response - return failure */	if (mfr == 0xff || mfr == 0)		return 0;	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;			doc->erasesize = nand_flash_ids[i].erasesize << doc->interleave;			break;		}	}	if (nand_flash_ids[i].name == NULL)		return 0;	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_MPLUS];	int ret;	this->numchips = 0;	this->mfr = 0;	this->id = 0;	/* Work out the intended interleave setting */	this->interleave = 0;	if (this->ChipID == DOC_ChipID_DocMilPlus32)		this->interleave = 1;	/* Check the ASIC agrees */	if ( (this->interleave << 2) != 	     (ReadDOC(this->virtadr, Mplus_Configuration) & 4)) {		u_char conf = ReadDOC(this->virtadr, Mplus_Configuration);		printk(KERN_NOTICE "Setting DiskOnChip Millennium Plus interleave to %s\n",		       this->interleave?"on (16-bit)":"off (8-bit)");		conf ^= 4;		WriteDOC(conf, this->virtadr, Mplus_Configuration);	}	/* For each floor, find the number of valid chips it contains */	for (floor = 0,ret = 1; floor < MAX_FLOORS_MPLUS; floor++) {		numchips[floor] = 0;		for (chip = 0; chip < MAX_CHIPS_MPLUS && ret != 0; chip++) {			ret = DoC_IdentChip(this, floor, chip);			if (ret) {				numchips[floor]++;				this->numchips++;			}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区在线观看视频| 成人综合婷婷国产精品久久免费| 欧美极品aⅴ影院| 精品国产人成亚洲区| 欧美一区二区视频观看视频| 制服丝袜亚洲色图| 538prom精品视频线放| 欧美一区二区三区视频免费播放 | 欧美一区二区啪啪| 欧美理论电影在线| 日韩午夜小视频| 久久综合久久鬼色| 久久久久久久网| 国产精品欧美极品| 悠悠色在线精品| 日韩综合小视频| 激情久久五月天| av中文字幕在线不卡| av电影一区二区| 在线免费观看成人短视频| 欧美一区二区三区四区五区| 欧美精品一区二区蜜臀亚洲| 国产精品久久久久久久久搜平片| 亚洲三级理论片| 日本亚洲三级在线| 国产99久久久精品| 欧美日韩中文字幕精品| 日韩精品专区在线| 国产农村妇女精品| 亚洲小说欧美激情另类| 久久精品国产久精国产爱| 不卡高清视频专区| 日韩一区二区三区视频在线| 国产精品网站导航| 日韩不卡一区二区| www.亚洲色图.com| 精品视频在线看| 26uuu久久天堂性欧美| 一区二区在线观看视频在线观看| 视频在线观看国产精品| 国产成人精品免费视频网站| 欧美在线免费观看视频| 精品理论电影在线观看| 亚洲欧洲av在线| 韩国一区二区三区| 91麻豆123| 国产丝袜在线精品| 偷拍自拍另类欧美| 91视频免费播放| 欧美精品一区二区不卡| 亚洲自拍偷拍麻豆| 成人性生交大片免费看视频在线| 91精品国产综合久久精品| 日韩毛片高清在线播放| 国产精一区二区三区| 欧美日韩综合在线免费观看| 国产欧美精品一区二区色综合朱莉| 亚洲一区影音先锋| 91麻豆swag| 国产日韩精品视频一区| 日韩精品视频网| 欧美日韩第一区日日骚| 国产日韩欧美一区二区三区乱码| 婷婷久久综合九色综合伊人色| 99久久婷婷国产综合精品电影| 欧美日韩一区久久| 最新热久久免费视频| 国产98色在线|日韩| 精品乱人伦一区二区三区| 亚洲精选一二三| 成人爽a毛片一区二区免费| 欧美一级一级性生活免费录像| 日韩av高清在线观看| 欧美午夜寂寞影院| 一区二区三区中文字幕在线观看| 粉嫩13p一区二区三区| 久久综合九色综合97_久久久| 日本不卡高清视频| 欧美一区二区三区色| 婷婷夜色潮精品综合在线| 欧美少妇性性性| 午夜视频一区二区三区| 欧美性猛交一区二区三区精品| 亚洲精品美国一| 91久久线看在观草草青青| 亚洲精品菠萝久久久久久久| 色婷婷激情综合| 亚洲一区在线播放| 欧美久久久一区| 美日韩一区二区| 国产亚洲精品精华液| jlzzjlzz亚洲日本少妇| 欧美激情自拍偷拍| 成人h精品动漫一区二区三区| 中文字幕国产一区| 91国偷自产一区二区开放时间 | 欧美成人精品福利| 国产成人鲁色资源国产91色综| 亚洲国产精品黑人久久久| jiyouzz国产精品久久| 亚洲丝袜美腿综合| 欧美性猛交一区二区三区精品| 日韩国产欧美三级| 久久久久青草大香线综合精品| 岛国精品在线观看| 一区二区三区中文字幕| 欧美天天综合网| 韩国三级在线一区| 亚洲视频香蕉人妖| 欧美精品久久99久久在免费线| 日韩国产在线观看| 国产精品理论在线观看| 欧美日韩色综合| 国产成人日日夜夜| 五月天欧美精品| 国产精品美女久久久久久| 欧美日韩一区二区三区免费看| 麻豆91在线播放免费| 亚洲美女精品一区| 精品久久久久久久人人人人传媒| 99re这里都是精品| 一区二区三区四区在线| 69精品人人人人| 91在线视频免费91| 捆绑变态av一区二区三区| 日韩一区在线播放| 精品伦理精品一区| 欧美色男人天堂| 不卡av在线免费观看| 亚洲aⅴ怡春院| 国产精品美女久久久久久2018| 日韩一区二区三区观看| 色综合久久久久网| 国产乱人伦偷精品视频免下载| 天天影视涩香欲综合网| 亚洲另类中文字| 国产精品美日韩| 日本一区二区免费在线| 精品久久久久99| 在线成人小视频| 色综合中文综合网| 国产调教视频一区| 欧美日韩高清一区二区三区| 成人av综合在线| 国产麻豆91精品| 男人操女人的视频在线观看欧美| 亚洲最大成人综合| 亚洲色图制服丝袜| 中文子幕无线码一区tr| 欧美精品乱码久久久久久| 99久久99精品久久久久久| 成人理论电影网| youjizz久久| 波多野结衣欧美| 一本一道综合狠狠老| 91黄色免费版| 欧美中文字幕一区| 欧美三区免费完整视频在线观看| 色偷偷久久一区二区三区| 色综合视频在线观看| 91在线无精精品入口| 99re这里只有精品6| 国产91精品久久久久久久网曝门 | 日韩三级中文字幕| 日韩欧美国产午夜精品| 欧美v日韩v国产v| xnxx国产精品| 69堂成人精品免费视频| 色综合天天综合在线视频| 一本久久综合亚洲鲁鲁五月天| 91九色最新地址| 在线看日韩精品电影| 91精品国产一区二区人妖| 精品成人在线观看| 中文字幕 久热精品 视频在线| 国产精品视频看| 一区二区三区欧美久久| 国产福利精品一区| 成人av电影免费观看| av电影在线观看一区| 色综合色综合色综合色综合色综合 | 中文字幕中文字幕中文字幕亚洲无线| 国产精品情趣视频| 一区二区激情视频| 美女精品一区二区| 国产精品夜夜爽| 91麻豆高清视频| 欧美一区二区高清| 亚洲欧洲三级电影| 亚洲国产中文字幕在线视频综合| 极品美女销魂一区二区三区 | 欧美日韩卡一卡二| 欧美高清精品3d| 国产日韩欧美a| 亚洲国产日韩在线一区模特| 久久av资源网| 91传媒视频在线播放| 久久久综合九色合综国产精品| 亚洲精品福利视频网站| 久久99国产精品久久|