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

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

?? au1550nd.c

?? 根據fs2410移植過后的mtd驅動源碼
?? C
字號:
/* *  drivers/mtd/nand/au1550nd.c * *  Copyright (C) 2004 Embedded Edge, LLC * * $Id: au1550nd.c,v 1.13 2005/11/07 11:14:30 gleixner Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */#include <linux/slab.h>#include <linux/init.h>#include <linux/module.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/partitions.h>#include <linux/version.h>#include <asm/io.h>/* fixme: this is ugly */#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)#include <asm/mach-au1x00/au1xxx.h>#else#include <asm/au1000.h>#ifdef CONFIG_MIPS_PB1550#include <asm/pb1550.h>#endif#ifdef CONFIG_MIPS_DB1550#include <asm/db1x00.h>#endif#endif/* * MTD structure for NAND controller */static struct mtd_info *au1550_mtd = NULL;static void __iomem *p_nand;static int nand_width = 1; /* default x8*//* * Define partitions for flash device */const static struct mtd_partition partition_info[] = {	{		.name 	= "NAND FS 0",	  	.offset = 0,	  	.size 	= 8*1024*1024	},	{		.name 	= "NAND FS 1",		.offset =  MTDPART_OFS_APPEND, 		.size 	=    MTDPART_SIZ_FULL	}};#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))/** * au_read_byte -  read one byte from the chip * @mtd:	MTD device structure * *  read function for 8bit buswith */static u_char au_read_byte(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	u_char ret = readb(this->IO_ADDR_R);	au_sync();	return ret;}/** * au_write_byte -  write one byte to the chip * @mtd:	MTD device structure * @byte:	pointer to data byte to write * *  write function for 8it buswith */static void au_write_byte(struct mtd_info *mtd, u_char byte){	struct nand_chip *this = mtd->priv;	writeb(byte, this->IO_ADDR_W);	au_sync();}/** * au_read_byte16 -  read one byte endianess aware from the chip * @mtd:	MTD device structure * *  read function for 16bit buswith with * endianess conversion */static u_char au_read_byte16(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	u_char ret = (u_char) cpu_to_le16(readw(this->IO_ADDR_R));	au_sync();	return ret;}/** * au_write_byte16 -  write one byte endianess aware to the chip * @mtd:	MTD device structure * @byte:	pointer to data byte to write * *  write function for 16bit buswith with * endianess conversion */static void au_write_byte16(struct mtd_info *mtd, u_char byte){	struct nand_chip *this = mtd->priv;	writew(le16_to_cpu((u16) byte), this->IO_ADDR_W);	au_sync();}/** * au_read_word -  read one word from the chip * @mtd:	MTD device structure * *  read function for 16bit buswith without * endianess conversion */static u16 au_read_word(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	u16 ret = readw(this->IO_ADDR_R);	au_sync();	return ret;}/** * au_write_word -  write one word to the chip * @mtd:	MTD device structure * @word:	data word to write * *  write function for 16bit buswith without * endianess conversion */static void au_write_word(struct mtd_info *mtd, u16 word){	struct nand_chip *this = mtd->priv;	writew(word, this->IO_ADDR_W);	au_sync();}/** * au_write_buf -  write buffer to chip * @mtd:	MTD device structure * @buf:	data buffer * @len:	number of bytes to write * *  write function for 8bit buswith */static void au_write_buf(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	for (i=0; i<len; i++) {		writeb(buf[i], this->IO_ADDR_W);		au_sync();	}}/** * au_read_buf -  read chip data into buffer * @mtd:	MTD device structure * @buf:	buffer to store date * @len:	number of bytes to read * *  read function for 8bit buswith */static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	for (i=0; i<len; i++) {		buf[i] = readb(this->IO_ADDR_R);		au_sync();	}}/** * au_verify_buf -  Verify chip data against buffer * @mtd:	MTD device structure * @buf:	buffer containing the data to compare * @len:	number of bytes to compare * *  verify function for 8bit buswith */static int au_verify_buf(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	for (i=0; i<len; i++) {		if (buf[i] != readb(this->IO_ADDR_R))			return -EFAULT;		au_sync();	}	return 0;}/** * au_write_buf16 -  write buffer to chip * @mtd:	MTD device structure * @buf:	data buffer * @len:	number of bytes to write * *  write function for 16bit buswith */static void au_write_buf16(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i=0; i<len; i++) {		writew(p[i], this->IO_ADDR_W);		au_sync();	}}/** * au_read_buf16 -  read chip data into buffer * @mtd:	MTD device structure * @buf:	buffer to store date * @len:	number of bytes to read * *  read function for 16bit buswith */static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i=0; i<len; i++) {		p[i] = readw(this->IO_ADDR_R);		au_sync();	}}/** * au_verify_buf16 -  Verify chip data against buffer * @mtd:	MTD device structure * @buf:	buffer containing the data to compare * @len:	number of bytes to compare * *  verify function for 16bit buswith */static int au_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i=0; i<len; i++) {		if (p[i] != readw(this->IO_ADDR_R))			return -EFAULT;		au_sync();	}	return 0;}static void au1550_hwcontrol(struct mtd_info *mtd, int cmd){	register struct nand_chip *this = mtd->priv;	switch(cmd){	case NAND_CTL_SETCLE: this->IO_ADDR_W = p_nand + MEM_STNAND_CMD; break;	case NAND_CTL_CLRCLE: this->IO_ADDR_W = p_nand + MEM_STNAND_DATA; break;	case NAND_CTL_SETALE: this->IO_ADDR_W = p_nand + MEM_STNAND_ADDR; break;	case NAND_CTL_CLRALE:		this->IO_ADDR_W = p_nand + MEM_STNAND_DATA;		/* FIXME: Nobody knows why this is neccecary,		 * but it works only that way */		udelay(1);		break;	case NAND_CTL_SETNCE:		/* assert (force assert) chip enable */		au_writel((1<<(4+NAND_CS)) , MEM_STNDCTL); break;		break;	case NAND_CTL_CLRNCE: 		/* deassert chip enable */		au_writel(0, MEM_STNDCTL); break;		break;	}	this->IO_ADDR_R = this->IO_ADDR_W;	/* Drain the writebuffer */	au_sync();}int au1550_device_ready(struct mtd_info *mtd){	int ret = (au_readl(MEM_STSTAT) & 0x1) ? 1 : 0;	au_sync();	return ret;}/* * Main initialization routine */int __init au1xxx_nand_init (void){	struct nand_chip *this;	u16 boot_swapboot = 0; /* default value */	int retval;	u32 mem_staddr;	u32 nand_phys;	/* Allocate memory for MTD device structure and private data */	au1550_mtd = kmalloc (sizeof(struct mtd_info) +			sizeof (struct nand_chip), GFP_KERNEL);	if (!au1550_mtd) {		printk ("Unable to allocate NAND MTD dev structure.\n");		return -ENOMEM;	}	/* Get pointer to private data */	this = (struct nand_chip *) (&au1550_mtd[1]);	/* Initialize structures */	memset((char *) au1550_mtd, 0, sizeof(struct mtd_info));	memset((char *) this, 0, sizeof(struct nand_chip));	/* Link the private data with the MTD structure */	au1550_mtd->priv = this;	/* disable interrupts */	au_writel(au_readl(MEM_STNDCTL) & ~(1<<8), MEM_STNDCTL);	/* disable NAND boot */	au_writel(au_readl(MEM_STNDCTL) & ~(1<<0), MEM_STNDCTL);#ifdef CONFIG_MIPS_PB1550	/* set gpio206 high */	au_writel(au_readl(GPIO2_DIR) & ~(1<<6), GPIO2_DIR);	boot_swapboot = (au_readl(MEM_STSTAT) & (0x7<<1)) |		((bcsr->status >> 6)  & 0x1);	switch (boot_swapboot) {		case 0:		case 2:		case 8:		case 0xC:		case 0xD:			/* x16 NAND Flash */			nand_width = 0;			break;		case 1:		case 9:		case 3:		case 0xE:		case 0xF:			/* x8 NAND Flash */			nand_width = 1;			break;		default:			printk("Pb1550 NAND: bad boot:swap\n");			retval = -EINVAL;			goto outmem;	}#endif	/* Configure chip-select; normally done by boot code, e.g. YAMON */#ifdef NAND_STCFG	if (NAND_CS == 0) {		au_writel(NAND_STCFG,  MEM_STCFG0);		au_writel(NAND_STTIME, MEM_STTIME0);		au_writel(NAND_STADDR, MEM_STADDR0);	}	if (NAND_CS == 1) {		au_writel(NAND_STCFG,  MEM_STCFG1);		au_writel(NAND_STTIME, MEM_STTIME1);		au_writel(NAND_STADDR, MEM_STADDR1);	}	if (NAND_CS == 2) {		au_writel(NAND_STCFG,  MEM_STCFG2);		au_writel(NAND_STTIME, MEM_STTIME2);		au_writel(NAND_STADDR, MEM_STADDR2);	}	if (NAND_CS == 3) {		au_writel(NAND_STCFG,  MEM_STCFG3);		au_writel(NAND_STTIME, MEM_STTIME3);		au_writel(NAND_STADDR, MEM_STADDR3);	}#endif	/* Locate NAND chip-select in order to determine NAND phys address */	mem_staddr = 0x00000000;	if (((au_readl(MEM_STCFG0) & 0x7) == 0x5) && (NAND_CS == 0))		mem_staddr = au_readl(MEM_STADDR0);	else if (((au_readl(MEM_STCFG1) & 0x7) == 0x5) && (NAND_CS == 1))		mem_staddr = au_readl(MEM_STADDR1);	else if (((au_readl(MEM_STCFG2) & 0x7) == 0x5) && (NAND_CS == 2))		mem_staddr = au_readl(MEM_STADDR2);	else if (((au_readl(MEM_STCFG3) & 0x7) == 0x5) && (NAND_CS == 3))		mem_staddr = au_readl(MEM_STADDR3);	if (mem_staddr == 0x00000000) {		printk("Au1xxx NAND: ERROR WITH NAND CHIP-SELECT\n");		kfree(au1550_mtd);		return 1;	}	nand_phys = (mem_staddr << 4) & 0xFFFC0000;	p_nand = (void __iomem *)ioremap(nand_phys, 0x1000);	/* make controller and MTD agree */	if (NAND_CS == 0)		nand_width = au_readl(MEM_STCFG0) & (1<<22);	if (NAND_CS == 1)		nand_width = au_readl(MEM_STCFG1) & (1<<22);	if (NAND_CS == 2)		nand_width = au_readl(MEM_STCFG2) & (1<<22);	if (NAND_CS == 3)		nand_width = au_readl(MEM_STCFG3) & (1<<22);	/* Set address of hardware control function */	this->hwcontrol = au1550_hwcontrol;	this->dev_ready = au1550_device_ready;	/* 30 us command delay time */	this->chip_delay = 30;	this->eccmode = NAND_ECC_SOFT;	this->options = NAND_NO_AUTOINCR;	if (!nand_width)		this->options |= NAND_BUSWIDTH_16;	this->read_byte = (!nand_width) ? au_read_byte16 : au_read_byte;	this->write_byte = (!nand_width) ? au_write_byte16 : au_write_byte;	this->write_word = au_write_word;	this->read_word = au_read_word;	this->write_buf = (!nand_width) ? au_write_buf16 : au_write_buf;	this->read_buf = (!nand_width) ? au_read_buf16 : au_read_buf;	this->verify_buf = (!nand_width) ? au_verify_buf16 : au_verify_buf;	/* Scan to find existence of the device */	if (nand_scan (au1550_mtd, 1)) {		retval = -ENXIO;		goto outio;	}	/* Register the partitions */	add_mtd_partitions(au1550_mtd, partition_info, NB_OF(partition_info));	return 0; outio:	iounmap ((void *)p_nand); outmem:	kfree (au1550_mtd);	return retval;}module_init(au1xxx_nand_init);/* * Clean up routine */#ifdef MODULEstatic void __exit au1550_cleanup (void){	struct nand_chip *this = (struct nand_chip *) &au1550_mtd[1];	/* Release resources, unregister device */	nand_release (au1550_mtd);	/* Free the MTD device structure */	kfree (au1550_mtd);	/* Unmap */	iounmap ((void *)p_nand);}module_exit(au1550_cleanup);#endifMODULE_LICENSE("GPL");MODULE_AUTHOR("Embedded Edge, LLC");MODULE_DESCRIPTION("Board-specific glue layer for NAND flash on Pb1550 board");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本欧美一区二区| 国产清纯白嫩初高生在线观看91| 欧美一区二区三区啪啪| 久久久久久综合| 亚洲精品一二三| 美女视频一区二区三区| 丁香另类激情小说| 欧美另类videos死尸| 国产喂奶挤奶一区二区三区| 亚洲在线中文字幕| 国产精品一卡二卡| 欧美亚洲图片小说| 国产喷白浆一区二区三区| 综合色中文字幕| 久久超碰97中文字幕| 91免费看视频| 亚洲精品在线观看视频| 国产精品乱码久久久久久| 亚洲成人资源在线| 成人丝袜高跟foot| 欧美一级日韩不卡播放免费| 亚洲欧洲美洲综合色网| 久久99日本精品| 欧美日韩久久不卡| 中文字幕日韩一区| 国产原创一区二区| 欧美一级在线观看| 亚洲一区av在线| 国产成人夜色高潮福利影视| 欧美国产成人精品| 丝袜诱惑制服诱惑色一区在线观看| 国产精品一区二区视频| 欧美精品久久一区二区三区| 国产精品久久看| 九九视频精品免费| 欧美少妇xxx| 亚洲乱码精品一二三四区日韩在线| 国精产品一区一区三区mba视频| 欧美日韩高清影院| 一区二区三区在线观看欧美| 成人午夜在线播放| 久久综合色8888| 日韩国产精品久久久久久亚洲| 91视视频在线观看入口直接观看www| 久久综合久久99| 麻豆精品视频在线观看免费 | 久久久久久一二三区| 亚洲国产综合人成综合网站| av一区二区三区| 国产精品素人视频| 国产精品99久久久久久宅男| 日韩一二在线观看| 日韩国产高清影视| 欧美精品 日韩| 偷拍与自拍一区| 欧美日韩亚洲综合一区二区三区 | 在线视频国内一区二区| 国产精品色哟哟| 成人精品高清在线| 国产精品毛片久久久久久| 国产美女在线精品| www激情久久| 韩国女主播成人在线| 欧美xxxx老人做受| 久久电影网站中文字幕| 精品国产伦一区二区三区观看方式| 日日夜夜精品免费视频| 欧美巨大另类极品videosbest | 亚洲精品第一国产综合野| 国产成人精品综合在线观看| 亚洲精品在线免费播放| 国产制服丝袜一区| 国产色爱av资源综合区| 国产精品资源在线看| 欧美国产日韩a欧美在线观看| 国产成人精品免费| 亚洲国产精品传媒在线观看| 成人免费不卡视频| 亚洲视频一区二区在线观看| 91猫先生在线| 亚洲自拍另类综合| 在线综合视频播放| 麻豆高清免费国产一区| 欧美xxx久久| 成人激情校园春色| 亚洲欧美偷拍三级| 欧美色综合网站| 看片网站欧美日韩| 久久综合色婷婷| 99国产精品久久| 亚洲国产精品天堂| 欧美tickling网站挠脚心| 国产激情精品久久久第一区二区| 国产精品美女久久久久久久久久久| 99久精品国产| 日韩激情一二三区| 久久嫩草精品久久久精品一| 高清视频一区二区| 一区二区三区高清| 日韩欧美国产1| 99久久综合狠狠综合久久| 亚洲精品综合在线| 日韩免费一区二区| a4yy欧美一区二区三区| 亚洲成人免费在线观看| 久久蜜桃一区二区| 色噜噜夜夜夜综合网| 日韩不卡在线观看日韩不卡视频| 久久久99精品免费观看| 色诱亚洲精品久久久久久| 日韩av电影免费观看高清完整版| 国产日韩欧美在线一区| 在线观看网站黄不卡| 久久精品国产亚洲一区二区三区| 国产精品久久777777| 欧美丰满一区二区免费视频 | 亚洲色大成网站www久久九九| 欧美探花视频资源| 国产成人免费视频一区| 亚洲午夜影视影院在线观看| 精品国产免费久久| 色菇凉天天综合网| 精品亚洲欧美一区| 亚洲乱码国产乱码精品精可以看| 精品少妇一区二区三区在线视频| 99麻豆久久久国产精品免费优播| 亚洲国产欧美日韩另类综合| 26uuu精品一区二区| 欧美亚洲国产一卡| 成人午夜视频在线观看| 视频一区中文字幕| 亚洲免费在线观看视频| 欧美zozo另类异族| 欧美日韩高清一区二区三区| 成人精品亚洲人成在线| 91麻豆精品国产91久久久使用方法| wwwwww.欧美系列| 图片区小说区区亚洲影院| 国产成人在线视频免费播放| 在线观看亚洲专区| 久久综合一区二区| 91视频国产观看| 欧美高清视频不卡网| 欧美一级黄色片| 久久99久久久久| 欧美色视频一区| 亚洲美女一区二区三区| 色综合 综合色| 一区二区三区国产精品| 国产又粗又猛又爽又黄91精品| 欧美日韩免费电影| 日韩一区中文字幕| 成人黄色小视频在线观看| 国产精品久久久久久户外露出| 欧美96一区二区免费视频| 欧美午夜片在线观看| 欧美电影免费提供在线观看| 国产精品嫩草影院av蜜臀| 爽好多水快深点欧美视频| 欧美精品久久99久久在免费线| 国产精品视频线看| 日韩视频免费观看高清完整版| 国产91高潮流白浆在线麻豆| 午夜精品久久久久久久久久| 欧美日韩一区二区三区免费看| 午夜激情久久久| 欧美性色黄大片| 亚洲视频一二区| jlzzjlzz欧美大全| 久久夜色精品国产欧美乱极品| 亚洲成人一区在线| 91久久精品一区二区三区| 国产亚洲欧美激情| 国内精品久久久久影院薰衣草| 欧美日韩卡一卡二| 日韩精品视频网| 精品噜噜噜噜久久久久久久久试看| 欧美理论在线播放| 99国产精品久| 欧美aa在线视频| 亚洲国产精品成人综合| 国产色婷婷亚洲99精品小说| 久久久久久久久久久99999| 久久久精品黄色| 国产日本一区二区| 国产精品美女久久久久高潮| 国产精品视频免费| 亚洲日本欧美天堂| 亚洲自拍欧美精品| 三级亚洲高清视频| 久88久久88久久久| 成人一区在线观看| 91视频免费播放| 欧美日韩亚洲综合一区二区三区| 欧美日韩国产高清一区二区三区| 3d动漫精品啪啪| 久久久青草青青国产亚洲免观| 国产精品婷婷午夜在线观看| 亚洲免费观看高清完整版在线观看 | 日本道精品一区二区三区 |