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

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

?? doc2001plus.c

?? linux2.6.16版本
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * 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.14 2005/11/07 11:14:24 gleixner 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 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++;			}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二区久久久| 成人免费高清视频| 91一区二区三区在线观看| 中文字幕精品综合| 在线观看视频一区| 午夜精品福利在线| 国产欧美综合在线| 欧美一区二区三区精品| 99综合电影在线视频| 久久成人免费电影| 国产精品妹子av| 精品女同一区二区| 欧美日韩你懂的| zzijzzij亚洲日本少妇熟睡| 麻豆成人免费电影| 午夜精品福利视频网站| 亚洲免费伊人电影| 欧美一区2区视频在线观看| 91丨国产丨九色丨pron| 国产成人亚洲综合a∨猫咪| 美日韩黄色大片| 婷婷激情综合网| 久久女同精品一区二区| gogogo免费视频观看亚洲一| 国模少妇一区二区三区| 另类中文字幕网| 日韩一区欧美小说| 国产精品污污网站在线观看| 一区二区三区四区乱视频| 9人人澡人人爽人人精品| 欧美三级资源在线| 五月天国产精品| 久久精品夜色噜噜亚洲aⅴ| 99在线视频精品| 国产亚洲欧洲一区高清在线观看| 欧美精品一区二区高清在线观看| 成人三级伦理片| 884aa四虎影成人精品一区| 91日韩在线专区| 欧美日韩三级一区| 粉嫩嫩av羞羞动漫久久久| 精品一区二区三区香蕉蜜桃 | 欧美日韩国产综合一区二区三区| 97精品久久久午夜一区二区三区 | 亚洲国产一区在线观看| 久久日一线二线三线suv| 91女人视频在线观看| 精品一区二区在线观看| 亚洲欧美另类小说| 亚洲精品欧美二区三区中文字幕| 精品精品国产高清a毛片牛牛| 日韩久久精品一区| 欧美性色欧美a在线播放| 成人一区二区三区视频| 免费成人小视频| 精品一区二区三区的国产在线播放| 一区二区三区四区高清精品免费观看 | 欧美亚男人的天堂| 欧美高清视频www夜色资源网| 91精品久久久久久久99蜜桃| 日韩午夜在线播放| 精品视频一区 二区 三区| 成人动漫一区二区三区| 99久久综合精品| 欧美午夜在线观看| 日韩一区二区三区在线观看| 欧美性xxxxx极品少妇| 欧美一区二区三区小说| 久久色在线视频| 亚洲色图.com| 欧美色网站导航| 在线精品视频免费观看| 久久精子c满五个校花| 欧美经典一区二区| 成人国产视频在线观看| 91浏览器打开| 欧美伦理电影网| 亚洲欧洲成人精品av97| 中文字幕精品一区二区三区精品| 亚洲欧美日韩电影| 91精品国产全国免费观看| 波多野洁衣一区| 视频一区国产视频| 亚洲午夜久久久| 日韩久久一区二区| 日韩精品亚洲专区| 成人av在线网| www.亚洲国产| 日韩一级二级三级| 国产精品久久久久久久久晋中| 亚洲一区二区三区不卡国产欧美| 亚洲另类在线制服丝袜| 麻豆国产一区二区| 一本在线高清不卡dvd| 久久综合网色—综合色88| 2024国产精品| 亚洲综合一区二区精品导航| 国产一区二区三区四区五区美女| 国产精一品亚洲二区在线视频| 狠狠色狠狠色综合系列| 欧美性感一区二区三区| 欧美精品v国产精品v日韩精品 | 日韩电影在线一区二区三区| 成人精品免费网站| 欧美一区二区三区喷汁尤物| 一区二区三区资源| 国产精品91一区二区| 欧美日韩三级在线| 亚洲少妇中出一区| 国产成人小视频| 欧美va在线播放| 亚洲bdsm女犯bdsm网站| 91黄视频在线观看| 国产精品私房写真福利视频| 久久超级碰视频| 大胆欧美人体老妇| 欧美电影免费观看高清完整版在| 国产视频视频一区| 麻豆精品视频在线观看免费| 欧美日本一道本| 亚洲国产精品天堂| 免费观看久久久4p| 成人一区二区三区中文字幕| 久久久www成人免费无遮挡大片| 国产精品全国免费观看高清| 亚洲综合精品久久| 国产mv日韩mv欧美| 91丨porny丨中文| 国产欧美日产一区| 亚洲18色成人| 日韩一区二区电影| 国产乱子伦一区二区三区国色天香| 久久激情五月激情| 精品国产乱码久久久久久蜜臀 | 成人欧美一区二区三区视频网页| 国产精品欧美一区喷水| 国产精品亚洲第一区在线暖暖韩国| 国产一区二区三区四区五区入口 | 色哟哟国产精品| 亚洲激情av在线| 日韩福利电影在线观看| 国产成人自拍网| 国产人成亚洲第一网站在线播放| 国产精品资源在线| 欧美日韩中文字幕一区| 国产欧美日产一区| 成人爱爱电影网址| 一区视频在线播放| 91麻豆国产福利在线观看| 中文字幕人成不卡一区| 97se狠狠狠综合亚洲狠狠| 亚洲精品久久久久久国产精华液| 99re亚洲国产精品| 久久久久久久久久久久久久久99| 国产毛片精品视频| 国产精品久久久一区麻豆最新章节| 日本欧美在线观看| 久久综合资源网| 精品一区二区免费看| 精品视频在线看| 久久国产婷婷国产香蕉| 久久九九久久九九| 91免费看`日韩一区二区| 亚洲一区二区在线播放相泽| 99久久精品免费看国产免费软件| 久久久精品综合| 成人sese在线| 一区二区三区日韩在线观看| 在线观看91精品国产麻豆| 国产综合久久久久影院| 国产精品卡一卡二卡三| 欧美日韩另类国产亚洲欧美一级| 亚洲日韩欧美一区二区在线| 欧美日本韩国一区二区三区视频| 韩国理伦片一区二区三区在线播放| 国产精品成人一区二区艾草| 欧美三级韩国三级日本一级| 国产一区二区三区| 亚洲美女视频在线观看| 欧美成人vr18sexvr| aaa国产一区| 美日韩一区二区| 一区二区久久久久久| 久久精品视频一区二区| 欧美影视一区在线| 国产九九视频一区二区三区| 亚洲午夜久久久久久久久电影网| 久久久亚洲精华液精华液精华液| 91在线观看地址| 国产一区二区不卡在线| 专区另类欧美日韩| 日韩精品最新网址| 欧美视频一区二区在线观看| 国产精品夜夜嗨| 亚洲gay无套男同| 国产精品国产自产拍高清av王其| 日韩精品一区二区三区蜜臀 | 亚洲一区电影777| 欧美国产成人在线| 日韩精品一区二区三区视频|