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

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

?? nand_base.c

?? U-boot latest tarball
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* *  drivers/mtd/nand.c * *  Overview: *   This is the generic MTD driver for NAND flash devices. It should be *   capable of working with almost all NAND chips currently available. *   Basic support for AG-AND chips is provided. * *	Additional technical information is available on *	http://www.linux-mtd.infradead.org/doc/nand.html * *  Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) *		  2002-2006 Thomas Gleixner (tglx@linutronix.de) * *  Credits: *	David Woodhouse for adding multichip support * *	Aleph One Ltd. and Toby Churchill Ltd. for supporting the *	rework for 2K page size chips * *  TODO: *	Enable cached programming for 2k page size chips *	Check, if mtd->ecctype should be set to MTD_ECC_HW *	if we have HW ecc support. *	The AG-AND chips have nice features for speed improvement, *	which are not supported yet. Read / program 4 pages in one go. *	BBT table is not serialized, has to be fixed * * 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. * *//* XXX U-BOOT XXX */#if 0#include <linux/module.h>#include <linux/delay.h>#include <linux/errno.h>#include <linux/err.h>#include <linux/sched.h>#include <linux/slab.h>#include <linux/types.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/nand_ecc.h>#include <linux/mtd/compatmac.h>#include <linux/interrupt.h>#include <linux/bitops.h>#include <linux/leds.h>#include <asm/io.h>#ifdef CONFIG_MTD_PARTITIONS#include <linux/mtd/partitions.h>#endif#endif#include <common.h>#define ENOTSUPP	524	/* Operation is not supported */#include <malloc.h>#include <watchdog.h>#include <linux/err.h>#include <linux/mtd/compat.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/nand_ecc.h>#include <asm/io.h>#include <asm/errno.h>#ifdef CONFIG_JFFS2_NAND#include <jffs2/jffs2.h>#endif/* * CONFIG_SYS_NAND_RESET_CNT is used as a timeout mechanism when resetting * a flash.  NAND flash is initialized prior to interrupts so standard timers * can't be used.  CONFIG_SYS_NAND_RESET_CNT should be set to a value * which is greater than (max NAND reset time / NAND status read time). * A conservative default of 200000 (500 us / 25 ns) is used as a default. */#ifndef CONFIG_SYS_NAND_RESET_CNT#define CONFIG_SYS_NAND_RESET_CNT 200000#endif/* Define default oob placement schemes for large and small page devices */static struct nand_ecclayout nand_oob_8 = {	.eccbytes = 3,	.eccpos = {0, 1, 2},	.oobfree = {		{.offset = 3,		 .length = 2},		{.offset = 6,		 .length = 2}}};static struct nand_ecclayout nand_oob_16 = {	.eccbytes = 6,	.eccpos = {0, 1, 2, 3, 6, 7},	.oobfree = {		{.offset = 8,		 . length = 8}}};static struct nand_ecclayout nand_oob_64 = {	.eccbytes = 24,	.eccpos = {		   40, 41, 42, 43, 44, 45, 46, 47,		   48, 49, 50, 51, 52, 53, 54, 55,		   56, 57, 58, 59, 60, 61, 62, 63},	.oobfree = {		{.offset = 2,		 .length = 38}}};static struct nand_ecclayout nand_oob_128 = {	.eccbytes = 48,	.eccpos = {		    80,  81,  82,  83,  84,  85,  86,  87,		    88,  89,  90,  91,  92,  93,  94,  95,		    96,  97,  98,  99, 100, 101, 102, 103,		   104, 105, 106, 107, 108, 109, 110, 111,		   112, 113, 114, 115, 116, 117, 118, 119,		   120, 121, 122, 123, 124, 125, 126, 127},	.oobfree = {		{.offset = 2,		 .length = 78}}};static int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd,			   int new_state);static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,			     struct mtd_oob_ops *ops);static int nand_wait(struct mtd_info *mtd, struct nand_chip *this);/* * For devices which display every fart in the system on a separate LED. Is * compiled away when LED support is disabled. *//* XXX U-BOOT XXX */#if 0DEFINE_LED_TRIGGER(nand_led_trigger);#endif/** * nand_release_device - [GENERIC] release chip * @mtd:	MTD device structure * * Deselect, release chip lock and wake up anyone waiting on the device *//* XXX U-BOOT XXX */#if 0static void nand_release_device(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	/* De-select the NAND device */	chip->select_chip(mtd, -1);	/* Release the controller and the chip */	spin_lock(&chip->controller->lock);	chip->controller->active = NULL;	chip->state = FL_READY;	wake_up(&chip->controller->wq);	spin_unlock(&chip->controller->lock);}#elsestatic void nand_release_device (struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	this->select_chip(mtd, -1);	/* De-select the NAND device */}#endif/** * nand_read_byte - [DEFAULT] read one byte from the chip * @mtd:	MTD device structure * * Default read function for 8bit buswith */static uint8_t nand_read_byte(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	return readb(chip->IO_ADDR_R);}/** * nand_read_byte16 - [DEFAULT] read one byte endianess aware from the chip * @mtd:	MTD device structure * * Default read function for 16bit buswith with * endianess conversion */static uint8_t nand_read_byte16(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	return (uint8_t) cpu_to_le16(readw(chip->IO_ADDR_R));}/** * nand_read_word - [DEFAULT] read one word from the chip * @mtd:	MTD device structure * * Default read function for 16bit buswith without * endianess conversion */static u16 nand_read_word(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	return readw(chip->IO_ADDR_R);}/** * nand_select_chip - [DEFAULT] control CE line * @mtd:	MTD device structure * @chipnr:	chipnumber to select, -1 for deselect * * Default select function for 1 chip devices. */static void nand_select_chip(struct mtd_info *mtd, int chipnr){	struct nand_chip *chip = mtd->priv;	switch (chipnr) {	case -1:		chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 | NAND_CTRL_CHANGE);		break;	case 0:		break;	default:		BUG();	}}/** * nand_write_buf - [DEFAULT] write buffer to chip * @mtd:	MTD device structure * @buf:	data buffer * @len:	number of bytes to write * * Default write function for 8bit buswith */static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len){	int i;	struct nand_chip *chip = mtd->priv;	for (i = 0; i < len; i++)		writeb(buf[i], chip->IO_ADDR_W);}/** * nand_read_buf - [DEFAULT] read chip data into buffer * @mtd:	MTD device structure * @buf:	buffer to store date * @len:	number of bytes to read * * Default read function for 8bit buswith */static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len){	int i;	struct nand_chip *chip = mtd->priv;	for (i = 0; i < len; i++)		buf[i] = readb(chip->IO_ADDR_R);}/** * nand_verify_buf - [DEFAULT] Verify chip data against buffer * @mtd:	MTD device structure * @buf:	buffer containing the data to compare * @len:	number of bytes to compare * * Default verify function for 8bit buswith */static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len){	int i;	struct nand_chip *chip = mtd->priv;	for (i = 0; i < len; i++)		if (buf[i] != readb(chip->IO_ADDR_R))			return -EFAULT;	return 0;}/** * nand_write_buf16 - [DEFAULT] write buffer to chip * @mtd:	MTD device structure * @buf:	data buffer * @len:	number of bytes to write * * Default write function for 16bit buswith */static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len){	int i;	struct nand_chip *chip = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i = 0; i < len; i++)		writew(p[i], chip->IO_ADDR_W);}/** * nand_read_buf16 - [DEFAULT] read chip data into buffer * @mtd:	MTD device structure * @buf:	buffer to store date * @len:	number of bytes to read * * Default read function for 16bit buswith */static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len){	int i;	struct nand_chip *chip = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i = 0; i < len; i++)		p[i] = readw(chip->IO_ADDR_R);}/** * nand_verify_buf16 - [DEFAULT] Verify chip data against buffer * @mtd:	MTD device structure * @buf:	buffer containing the data to compare * @len:	number of bytes to compare * * Default verify function for 16bit buswith */static int nand_verify_buf16(struct mtd_info *mtd, const uint8_t *buf, int len){	int i;	struct nand_chip *chip = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i = 0; i < len; i++)		if (p[i] != readw(chip->IO_ADDR_R))			return -EFAULT;	return 0;}/** * nand_block_bad - [DEFAULT] Read bad block marker from the chip * @mtd:	MTD device structure * @ofs:	offset from device start * @getchip:	0, if the chip is already selected * * Check, if the block is bad. */static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip){	int page, chipnr, res = 0;	struct nand_chip *chip = mtd->priv;	u16 bad;	page = (int)(ofs >> chip->page_shift) & chip->pagemask;	if (getchip) {		chipnr = (int)(ofs >> chip->chip_shift);		nand_get_device(chip, mtd, FL_READING);		/* Select the NAND device */		chip->select_chip(mtd, chipnr);	}	if (chip->options & NAND_BUSWIDTH_16) {		chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE,			      page);		bad = cpu_to_le16(chip->read_word(mtd));		if (chip->badblockpos & 0x1)			bad >>= 8;		if ((bad & 0xFF) != 0xff)			res = 1;	} else {		chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos, page);		if (chip->read_byte(mtd) != 0xff)			res = 1;	}	if (getchip)		nand_release_device(mtd);	return res;}/** * nand_default_block_markbad - [DEFAULT] mark a block bad * @mtd:	MTD device structure * @ofs:	offset from device start * * This is the default implementation, which can be overridden by * a hardware specific driver.*/static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs){	struct nand_chip *chip = mtd->priv;	uint8_t buf[2] = { 0, 0 };	int block, ret;	/* Get block number */	block = (int)(ofs >> chip->bbt_erase_shift);	if (chip->bbt)		chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);	/* Do we have a flash based bad block table ? */	if (chip->options & NAND_USE_FLASH_BBT)		ret = nand_update_bbt(mtd, ofs);	else {		/* We write two bytes, so we dont have to mess with 16 bit		 * access		 */		nand_get_device(chip, mtd, FL_WRITING);		ofs += mtd->oobsize;		chip->ops.len = chip->ops.ooblen = 2;		chip->ops.datbuf = NULL;		chip->ops.oobbuf = buf;		chip->ops.ooboffs = chip->badblockpos & ~0x01;		ret = nand_do_write_oob(mtd, ofs, &chip->ops);		nand_release_device(mtd);	}	if (!ret)		mtd->ecc_stats.badblocks++;	return ret;}/** * nand_check_wp - [GENERIC] check if the chip is write protected * @mtd:	MTD device structure * Check, if the device is write protected * * The function expects, that the device is already selected */static int nand_check_wp(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	/* Check the WP bit */	chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);	return (chip->read_byte(mtd) & NAND_STATUS_WP) ? 0 : 1;}/** * nand_block_checkbad - [GENERIC] Check if a block is marked bad * @mtd:	MTD device structure * @ofs:	offset from device start * @getchip:	0, if the chip is already selected * @allowbbt:	1, if its allowed to access the bbt area * * Check, if the block is bad. Either by reading the bad block table or * calling of the scan function. */static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip,			       int allowbbt){	struct nand_chip *chip = mtd->priv;	if (!(chip->options & NAND_BBT_SCANNED)) {		chip->options |= NAND_BBT_SCANNED;		chip->scan_bbt(mtd);	}	if (!chip->bbt)		return chip->block_bad(mtd, ofs, getchip);	/* Return info from the table */	return nand_isbad_bbt(mtd, ofs, allowbbt);}/* * Wait for the ready pin, after a command * The timeout is catched later. *//* XXX U-BOOT XXX */#if 0void nand_wait_ready(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	unsigned long timeo = jiffies + 2;	led_trigger_event(nand_led_trigger, LED_FULL);	/* wait until command is processed or timeout occures */	do {		if (chip->dev_ready(mtd))			break;		touch_softlockup_watchdog();	} while (time_before(jiffies, timeo));	led_trigger_event(nand_led_trigger, LED_OFF);}EXPORT_SYMBOL_GPL(nand_wait_ready);#elsevoid nand_wait_ready(struct mtd_info *mtd){	struct nand_chip *chip = mtd->priv;	u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区欧美| 99精品国产视频| 亚洲欧美日韩久久| 久久精品亚洲精品国产欧美kt∨| 精品裸体舞一区二区三区| 91精品国产高清一区二区三区 | 国产精品性做久久久久久| 美女尤物国产一区| 久久se精品一区二区| 国产麻豆精品在线| 国产suv精品一区二区883| 成人免费高清在线观看| 97久久超碰国产精品电影| 91浏览器打开| 欧美二区三区91| 精品捆绑美女sm三区| 中文字幕av免费专区久久| 成人欧美一区二区三区黑人麻豆 | 国产91精品露脸国语对白| 99久久精品免费| 在线视频一区二区免费| 欧美一二三区精品| 国产精品午夜在线| 亚洲chinese男男1069| 精品一区二区av| av在线不卡电影| 欧美日韩电影在线| 久久综合一区二区| 亚洲色图丝袜美腿| 蜜乳av一区二区| 色综合中文字幕国产| 欧美午夜一区二区| 国产清纯在线一区二区www| 亚洲品质自拍视频网站| 精品影视av免费| 欧美色图天堂网| 久久精品综合网| 午夜精品一区在线观看| 成人综合激情网| 91麻豆精品国产无毒不卡在线观看| 久久亚洲精品小早川怜子| 一区二区三区蜜桃| 国产高清亚洲一区| 91麻豆精品国产自产在线观看一区| 国产丝袜美腿一区二区三区| 亚洲国产日韩在线一区模特| 国产成人在线免费| 精品日产卡一卡二卡麻豆| 伊人开心综合网| 成人av免费观看| 久久综合色天天久久综合图片| 亚洲va韩国va欧美va| 一本色道综合亚洲| 国产精品国产三级国产aⅴ原创| 久久av资源网| 91精品国产综合久久久久久久久久 | 免费成人小视频| 日本高清无吗v一区| 国产精品乱码人人做人人爱| 精品亚洲国内自在自线福利| 欧美精品日韩综合在线| 一区二区三区欧美| 色综合天天综合在线视频| 久久久影视传媒| 国内精品写真在线观看| 精品免费日韩av| 日韩国产精品大片| 日本大香伊一区二区三区| 亚洲欧洲一区二区三区| heyzo一本久久综合| 国产欧美精品一区aⅴ影院| 国产在线视频不卡二| 日韩精品一区二区三区四区| 日韩**一区毛片| 日韩视频一区二区在线观看| 蜜桃一区二区三区在线| 欧美一区二区三区视频在线| 日韩国产成人精品| 日韩精品中文字幕在线一区| 寂寞少妇一区二区三区| 精品av综合导航| 粉嫩蜜臀av国产精品网站| 中文一区在线播放| 91在线码无精品| 夜夜精品视频一区二区| 欧美日韩国产影片| 日韩电影免费在线看| 26uuu国产日韩综合| 豆国产96在线|亚洲| 亚洲精品乱码久久久久久日本蜜臀| 日本高清免费不卡视频| 奇米在线7777在线精品| 久久精品日韩一区二区三区| jiyouzz国产精品久久| 亚洲图片欧美视频| 精品国产百合女同互慰| 9久草视频在线视频精品| 亚洲一区二区精品久久av| 精品免费国产一区二区三区四区| 国产成人综合亚洲网站| 亚洲精品视频在线观看免费| 欧美女孩性生活视频| 国产精品乡下勾搭老头1| 一区二区三区在线观看网站| 欧美一区二区性放荡片| jlzzjlzz亚洲女人18| 日本不卡高清视频| 最新国产精品久久精品| 欧美欧美午夜aⅴ在线观看| 国产福利视频一区二区三区| 亚洲成av人影院| 国产精品素人视频| 日韩一区二区免费电影| 99久久夜色精品国产网站| 天天操天天综合网| 亚洲欧美在线视频| 精品国产sm最大网站| 日本乱人伦aⅴ精品| 国产精品一区一区| 日韩在线观看一区二区| 国产精品久久免费看| 日韩一区二区三区av| 色婷婷久久久亚洲一区二区三区 | 中文字幕第一区二区| 欧美伦理视频网站| 91麻豆免费看片| 国产精品66部| 精品一区二区三区香蕉蜜桃 | 夜夜嗨av一区二区三区四季av | 26uuu国产在线精品一区二区| 91精品福利视频| caoporen国产精品视频| 加勒比av一区二区| 免费的国产精品| 日日骚欧美日韩| 亚洲综合一区在线| 亚洲天堂av老司机| 欧美高清在线视频| 久久久久久久久久久黄色| 欧美成人精品3d动漫h| 欧美日韩视频在线第一区| 色综合久久久久综合体桃花网| 国产盗摄视频一区二区三区| 国产麻豆91精品| 国产一区二区在线看| 国产在线视视频有精品| 韩国在线一区二区| 国产专区欧美精品| 国内精品国产成人国产三级粉色| 日本欧美肥老太交大片| 秋霞电影一区二区| 免费久久99精品国产| 热久久国产精品| 国内外精品视频| 成人性生交大片免费看中文网站| 国产91高潮流白浆在线麻豆| av电影天堂一区二区在线观看| 成人蜜臀av电影| 97精品电影院| 欧美亚洲综合色| 欧美精品日韩精品| 欧美成人精精品一区二区频| 国产日本亚洲高清| 中文字幕佐山爱一区二区免费| 亚洲色图视频免费播放| 亚洲愉拍自拍另类高清精品| 亚洲一区在线看| 老司机精品视频导航| 国产91在线|亚洲| 日本丶国产丶欧美色综合| 欧美日韩免费高清一区色橹橹| 91麻豆精品国产| 2021中文字幕一区亚洲| 国产精品久久久久久久久搜平片| 综合久久久久久| 香蕉久久夜色精品国产使用方法| 免费xxxx性欧美18vr| 风流少妇一区二区| 欧美日韩国产精品成人| 欧美变态tickle挠乳网站| 国产午夜精品一区二区三区嫩草 | 欧美成人精品二区三区99精品| 国产人伦精品一区二区| 亚洲线精品一区二区三区| 久久99久久99精品免视看婷婷 | 中文字幕精品在线不卡| 亚洲精品v日韩精品| 精品一区二区国语对白| 91成人国产精品| 久久欧美中文字幕| 亚洲一区二区免费视频| 国产iv一区二区三区| 欧美人妖巨大在线| 亚洲欧洲精品一区二区三区| 男男视频亚洲欧美| 99久久99久久久精品齐齐 | 成人免费高清在线| 91麻豆精品国产91久久久久| 亚洲视频资源在线| 国产激情精品久久久第一区二区 |