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

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

?? onenand_base.c

?? u-boot 源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* *  linux/drivers/mtd/onenand/onenand_base.c * *  Copyright (C) 2005-2007 Samsung Electronics *  Kyungmin Park <kyungmin.park@samsung.com> * * 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 <common.h>#ifdef CONFIG_CMD_ONENAND#include <linux/mtd/compat.h>#include <linux/mtd/mtd.h>#include <linux/mtd/onenand.h>#include <asm/io.h>#include <asm/errno.h>static const unsigned char ffchars[] = {	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* 16 */	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* 32 */	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* 48 */	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	/* 64 */};/** * onenand_readw - [OneNAND Interface] Read OneNAND register * @param addr		address to read * * Read OneNAND register */static unsigned short onenand_readw(void __iomem * addr){	return readw(addr);}/** * onenand_writew - [OneNAND Interface] Write OneNAND register with value * @param value		value to write * @param addr		address to write * * Write OneNAND register with value */static void onenand_writew(unsigned short value, void __iomem * addr){	writew(value, addr);}/** * onenand_block_address - [DEFAULT] Get block address * @param device	the device id * @param block		the block * @return		translated block address if DDP, otherwise same * * Setup Start Address 1 Register (F100h) */static int onenand_block_address(int device, int block){	if (device & ONENAND_DEVICE_IS_DDP) {		/* Device Flash Core select, NAND Flash Block Address */		int dfs = 0, density, mask;		density = device >> ONENAND_DEVICE_DENSITY_SHIFT;		mask = (1 << (density + 6));		if (block & mask)			dfs = 1;		return (dfs << ONENAND_DDP_SHIFT) | (block & (mask - 1));	}	return block;}/** * onenand_bufferram_address - [DEFAULT] Get bufferram address * @param device	the device id * @param block		the block * @return		set DBS value if DDP, otherwise 0 * * Setup Start Address 2 Register (F101h) for DDP */static int onenand_bufferram_address(int device, int block){	if (device & ONENAND_DEVICE_IS_DDP) {		/* Device BufferRAM Select */		int dbs = 0, density, mask;		density = device >> ONENAND_DEVICE_DENSITY_SHIFT;		mask = (1 << (density + 6));		if (block & mask)			dbs = 1;		return (dbs << ONENAND_DDP_SHIFT);	}	return 0;}/** * onenand_page_address - [DEFAULT] Get page address * @param page		the page address * @param sector	the sector address * @return		combined page and sector address * * Setup Start Address 8 Register (F107h) */static int onenand_page_address(int page, int sector){	/* Flash Page Address, Flash Sector Address */	int fpa, fsa;	fpa = page & ONENAND_FPA_MASK;	fsa = sector & ONENAND_FSA_MASK;	return ((fpa << ONENAND_FPA_SHIFT) | fsa);}/** * onenand_buffer_address - [DEFAULT] Get buffer address * @param dataram1	DataRAM index * @param sectors	the sector address * @param count		the number of sectors * @return		the start buffer value * * Setup Start Buffer Register (F200h) */static int onenand_buffer_address(int dataram1, int sectors, int count){	int bsa, bsc;	/* BufferRAM Sector Address */	bsa = sectors & ONENAND_BSA_MASK;	if (dataram1)		bsa |= ONENAND_BSA_DATARAM1;	/* DataRAM1 */	else		bsa |= ONENAND_BSA_DATARAM0;	/* DataRAM0 */	/* BufferRAM Sector Count */	bsc = count & ONENAND_BSC_MASK;	return ((bsa << ONENAND_BSA_SHIFT) | bsc);}/** * onenand_command - [DEFAULT] Send command to OneNAND device * @param mtd		MTD device structure * @param cmd		the command to be sent * @param addr		offset to read from or write to * @param len		number of bytes to read or write * * Send command to OneNAND device. This function is used for middle/large page * devices (1KB/2KB Bytes per page) */static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr,			   size_t len){	struct onenand_chip *this = mtd->priv;	int value, readcmd = 0;	int block, page;	/* Now we use page size operation */	int sectors = 4, count = 4;	/* Address translation */	switch (cmd) {	case ONENAND_CMD_UNLOCK:	case ONENAND_CMD_LOCK:	case ONENAND_CMD_LOCK_TIGHT:		block = -1;		page = -1;		break;	case ONENAND_CMD_ERASE:	case ONENAND_CMD_BUFFERRAM:		block = (int)(addr >> this->erase_shift);		page = -1;		break;	default:		block = (int)(addr >> this->erase_shift);		page = (int)(addr >> this->page_shift);		page &= this->page_mask;		break;	}	/* NOTE: The setting order of the registers is very important! */	if (cmd == ONENAND_CMD_BUFFERRAM) {		/* Select DataRAM for DDP */		value = onenand_bufferram_address(this->device_id, block);		this->write_word(value,				 this->base + ONENAND_REG_START_ADDRESS2);		/* Switch to the next data buffer */		ONENAND_SET_NEXT_BUFFERRAM(this);		return 0;	}	if (block != -1) {		/* Write 'DFS, FBA' of Flash */		value = onenand_block_address(this->device_id, block);		this->write_word(value,				 this->base + ONENAND_REG_START_ADDRESS1);	}	if (page != -1) {		int dataram;		switch (cmd) {		case ONENAND_CMD_READ:		case ONENAND_CMD_READOOB:			dataram = ONENAND_SET_NEXT_BUFFERRAM(this);			readcmd = 1;			break;		default:			dataram = ONENAND_CURRENT_BUFFERRAM(this);			break;		}		/* Write 'FPA, FSA' of Flash */		value = onenand_page_address(page, sectors);		this->write_word(value,				 this->base + ONENAND_REG_START_ADDRESS8);		/* Write 'BSA, BSC' of DataRAM */		value = onenand_buffer_address(dataram, sectors, count);		this->write_word(value, this->base + ONENAND_REG_START_BUFFER);		if (readcmd) {			/* Select DataRAM for DDP */			value =			    onenand_bufferram_address(this->device_id, block);			this->write_word(value,					 this->base +					 ONENAND_REG_START_ADDRESS2);		}	}	/* Interrupt clear */	this->write_word(ONENAND_INT_CLEAR, this->base + ONENAND_REG_INTERRUPT);	/* Write command */	this->write_word(cmd, this->base + ONENAND_REG_COMMAND);	return 0;}/** * onenand_wait - [DEFAULT] wait until the command is done * @param mtd		MTD device structure * @param state		state to select the max. timeout value * * Wait for command done. This applies to all OneNAND command * Read can take up to 30us, erase up to 2ms and program up to 350us * according to general OneNAND specs */static int onenand_wait(struct mtd_info *mtd, int state){	struct onenand_chip *this = mtd->priv;	unsigned int flags = ONENAND_INT_MASTER;	unsigned int interrupt = 0;	unsigned int ctrl, ecc;	while (1) {		interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);		if (interrupt & flags)			break;	}	ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);	if (ctrl & ONENAND_CTRL_ERROR) {		DEBUG(MTD_DEBUG_LEVEL0,		      "onenand_wait: controller error = 0x%04x\n", ctrl);		return -EAGAIN;	}	if (ctrl & ONENAND_CTRL_LOCK) {		DEBUG(MTD_DEBUG_LEVEL0,		      "onenand_wait: it's locked error = 0x%04x\n", ctrl);		return -EIO;	}	if (interrupt & ONENAND_INT_READ) {		ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS);		if (ecc & ONENAND_ECC_2BIT_ALL) {			DEBUG(MTD_DEBUG_LEVEL0,			      "onenand_wait: ECC error = 0x%04x\n", ecc);			return -EBADMSG;		}	}	return 0;}/** * onenand_bufferram_offset - [DEFAULT] BufferRAM offset * @param mtd		MTD data structure * @param area		BufferRAM area * @return		offset given area * * Return BufferRAM offset given area */static inline int onenand_bufferram_offset(struct mtd_info *mtd, int area){	struct onenand_chip *this = mtd->priv;	if (ONENAND_CURRENT_BUFFERRAM(this)) {		if (area == ONENAND_DATARAM)			return mtd->oobblock;		if (area == ONENAND_SPARERAM)			return mtd->oobsize;	}	return 0;}/** * onenand_read_bufferram - [OneNAND Interface] Read the bufferram area * @param mtd		MTD data structure * @param area		BufferRAM area * @param buffer	the databuffer to put/get data * @param offset	offset to read from or write to * @param count		number of bytes to read/write * * Read the BufferRAM area */static int onenand_read_bufferram(struct mtd_info *mtd, int area,				  unsigned char *buffer, int offset,				  size_t count){	struct onenand_chip *this = mtd->priv;	void __iomem *bufferram;	bufferram = this->base + area;	bufferram += onenand_bufferram_offset(mtd, area);	memcpy(buffer, bufferram + offset, count);	return 0;}/** * onenand_sync_read_bufferram - [OneNAND Interface] Read the bufferram area with Sync. Burst mode * @param mtd		MTD data structure * @param area		BufferRAM area * @param buffer	the databuffer to put/get data * @param offset	offset to read from or write to * @param count		number of bytes to read/write * * Read the BufferRAM area with Sync. Burst Mode */static int onenand_sync_read_bufferram(struct mtd_info *mtd, int area,				       unsigned char *buffer, int offset,				       size_t count){	struct onenand_chip *this = mtd->priv;	void __iomem *bufferram;	bufferram = this->base + area;	bufferram += onenand_bufferram_offset(mtd, area);	this->mmcontrol(mtd, ONENAND_SYS_CFG1_SYNC_READ);	memcpy(buffer, bufferram + offset, count);	this->mmcontrol(mtd, 0);	return 0;}/** * onenand_write_bufferram - [OneNAND Interface] Write the bufferram area * @param mtd		MTD data structure * @param area		BufferRAM area * @param buffer	the databuffer to put/get data * @param offset	offset to read from or write to * @param count		number of bytes to read/write * * Write the BufferRAM area */static int onenand_write_bufferram(struct mtd_info *mtd, int area,				   const unsigned char *buffer, int offset,				   size_t count){	struct onenand_chip *this = mtd->priv;	void __iomem *bufferram;	bufferram = this->base + area;	bufferram += onenand_bufferram_offset(mtd, area);	memcpy(bufferram + offset, buffer, count);	return 0;}/** * onenand_check_bufferram - [GENERIC] Check BufferRAM information * @param mtd		MTD data structure * @param addr		address to check * @return		1 if there are valid data, otherwise 0 * * Check bufferram if there is data we required */static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr){	struct onenand_chip *this = mtd->priv;	int block, page;	int i;	block = (int)(addr >> this->erase_shift);	page = (int)(addr >> this->page_shift);	page &= this->page_mask;	i = ONENAND_CURRENT_BUFFERRAM(this);	/* Is there valid data? */	if (this->bufferram[i].block == block &&	    this->bufferram[i].page == page && this->bufferram[i].valid)		return 1;	return 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品伦一区二区三级视频| 九九视频精品免费| 青椒成人免费视频| 成人av免费在线播放| 欧美日韩国产一二三| 欧美激情一区二区三区全黄| 婷婷国产v国产偷v亚洲高清| 成人黄动漫网站免费app| 777色狠狠一区二区三区| 国产精品福利一区二区三区| 久久精品国产一区二区三区免费看| 91免费国产在线观看| 国产欧美日韩中文久久| 蜜桃视频一区二区三区| 欧美日韩亚洲国产综合| 亚洲精品午夜久久久| 成人av网站在线观看| 久久亚洲精精品中文字幕早川悠里 | 成人免费视频国产在线观看| 久久综合五月天婷婷伊人| 视频一区中文字幕| 欧美性一区二区| 亚洲情趣在线观看| 99久久伊人精品| 国产三级欧美三级日产三级99| 麻豆视频一区二区| 日韩一区二区三区四区| 日韩黄色在线观看| 欧美日韩国产在线观看| 亚洲成人777| 欧美性生活大片视频| 亚洲老妇xxxxxx| 色中色一区二区| 亚洲一区二区三区四区在线免费观看 | 久久久久久9999| 国产一区二区三区四区五区美女| 日韩三级视频在线看| 日韩电影在线观看网站| 7799精品视频| 久久成人免费电影| 亚洲精品在线观| 国产精品911| 国产精品伦一区| 色欧美乱欧美15图片| 亚洲综合图片区| 欧美日韩在线观看一区二区| 日日夜夜精品视频免费| 精品免费视频一区二区| 国产成人亚洲综合色影视| 国产精品高清亚洲| 欧美性生活一区| 久久国产乱子精品免费女| 26uuu欧美| 99精品视频一区| 午夜精品久久久久久久| 精品欧美乱码久久久久久 | 亚洲高清久久久| 日韩一级在线观看| 国产成人av自拍| 亚洲男同1069视频| 制服丝袜亚洲网站| 丁香啪啪综合成人亚洲小说| 亚洲免费av网站| 欧美一区二区三区在线看| 国产乱码精品一区二区三| 中文字幕在线一区| 欧美日本在线一区| 国产麻豆成人传媒免费观看| 亚洲人成7777| 2022国产精品视频| 欧美亚洲禁片免费| 国产一区二区调教| 亚洲综合区在线| 久久免费国产精品| 欧美色视频在线观看| 国产九色sp调教91| 亚洲v日本v欧美v久久精品| 久久精品视频一区二区三区| 日本韩国视频一区二区| 国产在线精品视频| 天天色图综合网| 国产精品不卡一区二区三区| 日韩精品一区二区三区在线 | 国产精品一线二线三线| 亚洲一区欧美一区| 国产精品私人自拍| 精品国产一区二区在线观看| 欧美性生交片4| 99久久久久久| 国产精品一区二区久久不卡| 日韩精品电影一区亚洲| 亚洲欧洲成人精品av97| 久久精品一区八戒影视| 欧美一区二区三区免费视频| 91成人免费在线视频| 不卡在线观看av| 国产成人午夜精品影院观看视频| 五月婷婷综合在线| 一卡二卡三卡日韩欧美| 中文字幕制服丝袜成人av| 国产午夜精品一区二区三区四区| 91精品啪在线观看国产60岁| 欧美性色aⅴ视频一区日韩精品| 国产成人综合视频| 国产一区二区免费在线| 久久99国产精品免费| 日本成人在线电影网| 亚洲二区视频在线| 激情亚洲综合在线| 激情都市一区二区| 精品一区二区三区av| 蜜臀国产一区二区三区在线播放| 日韩精品视频网| 蜜桃av一区二区| 日韩av午夜在线观看| 日韩电影免费在线看| 日韩精品亚洲一区二区三区免费| 亚洲一区二区欧美激情| 亚洲一级二级三级在线免费观看| 怡红院av一区二区三区| 椎名由奈av一区二区三区| 专区另类欧美日韩| 亚洲一区二区视频在线观看| 亚洲v中文字幕| 捆绑紧缚一区二区三区视频| 激情欧美日韩一区二区| 丁香六月久久综合狠狠色| av综合在线播放| 欧美中文字幕一区| 91精品欧美福利在线观看| 精品国产乱码久久久久久闺蜜| 欧美成人精品1314www| 国产亚洲欧洲997久久综合| 中文av一区特黄| 樱花草国产18久久久久| 日韩一区精品字幕| 国产做a爰片久久毛片| 成人激情动漫在线观看| 色中色一区二区| 91精品国产综合久久久久| 精品处破学生在线二十三| 国产精品入口麻豆九色| 亚洲综合色噜噜狠狠| 久国产精品韩国三级视频| 国产激情91久久精品导航| 97se亚洲国产综合自在线不卡| 欧美日韩亚洲丝袜制服| 精品成人佐山爱一区二区| 五月激情综合婷婷| 国产精品一区在线| 精品污污网站免费看| 精品久久一二三区| 亚洲人吸女人奶水| 美女视频第一区二区三区免费观看网站| 国产乱人伦偷精品视频免下载| 91亚洲国产成人精品一区二区三| 欧美一区二区三区视频| 国产精品三级av| 蜜桃视频一区二区三区在线观看| 成人一级视频在线观看| 欧美一二三区在线观看| 中文字幕亚洲综合久久菠萝蜜| 日本视频免费一区| 99精品黄色片免费大全| 欧美成人女星排名| 亚洲一区二区在线免费观看视频| 国产成+人+日韩+欧美+亚洲| 欧美午夜片在线观看| 亚洲国产精品ⅴa在线观看| 秋霞电影网一区二区| 91色.com| 国产精品私房写真福利视频| 捆绑调教美女网站视频一区| 在线免费观看日本一区| 亚洲国产高清aⅴ视频| 精彩视频一区二区| 欧美日韩你懂得| 亚洲美女在线国产| 岛国av在线一区| wwwwxxxxx欧美| 日韩国产欧美视频| 欧美日韩中文国产| 亚洲伦理在线精品| www.亚洲色图.com| 国产人成亚洲第一网站在线播放| 奇米影视在线99精品| 欧美男同性恋视频网站| 一区二区三区日本| 日本韩国精品在线| 精品影视av免费| 欧美一区二区在线视频| 亚洲va国产天堂va久久en| 一本大道综合伊人精品热热| 国产精品久久久久久妇女6080| 国产精品亚洲人在线观看| 日韩欧美国产一区二区在线播放| 日本不卡视频在线| 精品理论电影在线观看 | 亚洲一区二区三区四区在线| 色呦呦日韩精品|