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

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

?? doc2001plus.c

?? 飛思卡爾芯片imx27下的MTD模塊的驅動源碼
?? 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.1.1.1 2007/09/01 10:29:10 hansorblue 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_oob(struct mtd_info *mtd, loff_t ofs,			struct mtd_oob_ops *ops);static int doc_write_oob(struct mtd_info *mtd, loff_t ofs,			 struct mtd_oob_ops *ops);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 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人网男人的天堂| 欧美国产日本视频| 91在线视频观看| 天天av天天翘天天综合网 | 香蕉久久夜色精品国产使用方法| 中文字幕第一区| 2023国产精品| 久久精品一区八戒影视| 国产亚洲视频系列| 国产精品美女久久久久久久| 国产精品国产精品国产专区不片| 国产精品对白交换视频| 亚洲专区一二三| 一区二区三区资源| 日韩国产欧美三级| 国产尤物一区二区| 国产成人丝袜美腿| 色视频欧美一区二区三区| 欧美视频精品在线| 日韩久久久精品| 欧美激情一区二区三区蜜桃视频| 国产精品视频一二| 亚洲妇女屁股眼交7| 日韩精品色哟哟| 懂色av一区二区夜夜嗨| 色综合久久久久| 日韩精品中文字幕一区二区三区| 国产精品久久久久影院老司| 亚洲国产精品久久久久婷婷884| 美美哒免费高清在线观看视频一区二区 | 91蝌蚪porny| 欧美肥妇free| 中文字幕av一区 二区| 亚洲高清免费视频| 国产成人av影院| 欧美久久高跟鞋激| 国产精品视频看| 免费人成精品欧美精品| 成人av在线观| 日韩欧美视频一区| 亚洲精品免费在线播放| 国产一区欧美一区| 欧美喷潮久久久xxxxx| 国产精品乱子久久久久| 免费精品视频在线| 欧美在线视频不卡| 国产欧美日本一区视频| 亚洲成av人片一区二区| av一区二区不卡| 久久久久久久久久久久久久久99 | 在线免费一区三区| 国产日韩欧美综合一区| 日本欧美肥老太交大片| 在线一区二区三区做爰视频网站| 国产亚洲欧美一区在线观看| 日韩中文字幕亚洲一区二区va在线| 风间由美一区二区av101| 精品国产乱码91久久久久久网站| 一区二区三区免费| av中文字幕不卡| 久久精品视频一区二区三区| 男人的j进女人的j一区| 欧美亚洲综合色| 日韩美女久久久| 国产激情一区二区三区| 精品国产一区二区三区忘忧草 | 欧美精品tushy高清| 国产精品不卡一区二区三区| 国产一区二区三区四区五区美女| 欧美优质美女网站| 亚洲综合在线五月| 一本大道综合伊人精品热热| 中文字幕的久久| av不卡免费电影| 1区2区3区精品视频| 国产91丝袜在线18| 日本一区二区在线不卡| 成人性生交大片免费看中文| 国产亚洲制服色| 国产成人综合自拍| 国产精品久久久久久亚洲毛片 | 亚洲精品老司机| 欧美日韩精品二区第二页| 亚洲一区二区三区国产| 欧美在线免费视屏| 亚洲超碰精品一区二区| 91麻豆精品国产91久久久更新时间| 日韩在线观看一区二区| 日韩精品在线网站| 国产iv一区二区三区| 亚洲视频 欧洲视频| 欧美日韩黄色一区二区| 秋霞成人午夜伦在线观看| 欧美变态tickling挠脚心| 国产69精品久久99不卡| 一区二区三区加勒比av| 日韩亚洲电影在线| 成人激情开心网| 亚洲美女少妇撒尿| 日韩欧美亚洲国产另类| 暴力调教一区二区三区| 亚洲成人你懂的| 国产亚洲精久久久久久| 日本韩国一区二区三区视频| 另类小说视频一区二区| 国产精品你懂的在线| 欧美日韩成人综合天天影院| 国内外精品视频| 亚洲男同性恋视频| 欧美va日韩va| 欧美性欧美巨大黑白大战| 毛片一区二区三区| 日韩一区欧美一区| 精品国产不卡一区二区三区| 一本到一区二区三区| 韩国理伦片一区二区三区在线播放| 亚洲日本丝袜连裤袜办公室| 精品久久久久久久久久久院品网| 91色九色蝌蚪| 粉嫩蜜臀av国产精品网站| 天天综合网 天天综合色| 国产精品白丝在线| 精品国产91洋老外米糕| 欧美日韩激情一区二区| 91麻豆国产福利在线观看| 国产乱码精品一品二品| 日韩av在线播放中文字幕| 亚洲乱码中文字幕| 国产精品视频麻豆| 久久久久久一二三区| 日韩一级欧美一级| 日本电影欧美片| 一本久久综合亚洲鲁鲁五月天| 国产精品影视网| 久久成人免费日本黄色| 亚洲成人在线免费| 亚洲午夜在线电影| 亚洲免费观看高清完整| 国产精品成人免费精品自在线观看| 久久夜色精品国产欧美乱极品| 日韩一级免费一区| 欧美一区二区三区视频在线| 欧美美女一区二区在线观看| 欧洲一区二区三区在线| 日本道色综合久久| 色丁香久综合在线久综合在线观看| 成人黄色电影在线| 白白色 亚洲乱淫| 成人免费黄色大片| 色综合久久综合| 91国在线观看| 欧美日韩在线不卡| 欧美日韩一区 二区 三区 久久精品| 在线精品亚洲一区二区不卡| 欧美性受极品xxxx喷水| 欧美日韩精品欧美日韩精品一| 精品视频123区在线观看| 欧美日韩一区二区不卡| 日韩亚洲欧美高清| 久久久久久久久久久黄色| 国产蜜臀av在线一区二区三区| 中文字幕欧美区| 亚洲品质自拍视频| 婷婷中文字幕综合| 久久精品72免费观看| 国产一区二区三区高清播放| 国产69精品久久777的优势| 99精品欧美一区二区三区综合在线| 99久久婷婷国产综合精品| 在线免费不卡视频| 欧美一区二区日韩一区二区| 26uuu久久综合| 亚洲欧洲色图综合| 亚洲高清一区二区三区| 激情综合色播五月| 99久久精品国产导航| 欧美日韩一区二区不卡| 久久久一区二区| 亚洲欧洲中文日韩久久av乱码| 亚洲成av人片一区二区三区| 国内精品免费**视频| 91丨porny丨国产入口| 欧美一卡二卡三卡四卡| 中文字幕中文字幕一区二区| 日韩精品欧美精品| 成年人网站91| 日韩精品一区二区三区老鸭窝| 亚洲视频每日更新| 精品在线一区二区三区| 色成年激情久久综合| 久久夜色精品国产噜噜av| 亚洲一二三区在线观看| 国产99久久久国产精品免费看| 欧美日韩一级二级| 国产人成亚洲第一网站在线播放 | 九九九久久久精品| 色悠悠久久综合| 久久精品欧美一区二区三区不卡| 亚洲综合在线免费观看| 成人激情小说网站|