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

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

?? s3c2410.c

?? 老版本的mtd-snap
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* linux/drivers/mtd/nand/s3c2410.c * * Copyright (c) 2004,2005 Simtec Electronics *	http://www.simtec.co.uk/products/SWLINUX/ *	Ben Dooks <ben@simtec.co.uk> * * Samsung S3C2410/S3C240 NAND driver * * Changelog: *	21-Sep-2004  BJD  Initial version *	23-Sep-2004  BJD  Mulitple device support *	28-Sep-2004  BJD  Fixed ECC placement for Hardware mode *	12-Oct-2004  BJD  Fixed errors in use of platform data *	18-Feb-2005  BJD  Fix sparse errors *	14-Mar-2005  BJD  Applied tglx's code reduction patch *	02-May-2005  BJD  Fixed s3c2440 support *	02-May-2005  BJD  Reduced hwcontrol decode *	20-Jun-2005  BJD  Updated s3c2440 support, fixed timing bug *	08-Jul-2005  BJD  Fix OOPS when no platform data supplied * * $Id: s3c2410.c,v 1.14 2005/07/06 20:05:06 bjd Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include <config/mtd/nand/s3c2410/hwecc.h>#include <config/mtd/nand/s3c2410/debug.h>#ifdef CONFIG_MTD_NAND_S3C2410_DEBUG#define DEBUG#endif#include <linux/module.h>#include <linux/types.h>#include <linux/init.h>#include <linux/kernel.h>#include <linux/string.h>#include <linux/ioport.h>#include <linux/device.h>#include <linux/delay.h>#include <linux/err.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/nand_ecc.h>#include <linux/mtd/partitions.h>#include <asm/io.h>#include <asm/mach-types.h>#include <asm/hardware/clock.h>#include <asm/arch/regs-nand.h>#include <asm/arch/nand.h>#define PFX "s3c2410-nand: "#ifdef CONFIG_MTD_NAND_S3C2410_HWECCstatic int hardware_ecc = 1;#elsestatic int hardware_ecc = 0;#endif/* new oob placement block for use with hardware ecc generation */static struct nand_oobinfo nand_hw_eccoob = {	.useecc		= MTD_NANDECC_AUTOPLACE,	.eccbytes	= 3,	.eccpos		= {0, 1, 2 },	.oobfree	= { {8, 8} }};/* controller and mtd information */struct s3c2410_nand_info;struct s3c2410_nand_mtd {	struct mtd_info			mtd;	struct nand_chip		chip;	struct s3c2410_nand_set		*set;	struct s3c2410_nand_info	*info;	int				scan_res;};/* overview of the s3c2410 nand state */struct s3c2410_nand_info {	/* mtd info */	struct nand_hw_control		controller;	struct s3c2410_nand_mtd		*mtds;	struct s3c2410_platform_nand	*platform;	/* device info */	struct device			*device;	struct resource			*area;	struct clk			*clk;	void __iomem			*regs;	int				mtd_count;	unsigned char			is_s3c2440;};/* conversion functions */static struct s3c2410_nand_mtd *s3c2410_nand_mtd_toours(struct mtd_info *mtd){	return container_of(mtd, struct s3c2410_nand_mtd, mtd);}static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd){	return s3c2410_nand_mtd_toours(mtd)->info;}static struct s3c2410_nand_info *to_nand_info(struct device *dev){	return dev_get_drvdata(dev);}static struct s3c2410_platform_nand *to_nand_plat(struct device *dev){	return dev->platform_data;}/* timing calculations */#define NS_IN_KHZ 10000000static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max){	int result;	result = (wanted * NS_IN_KHZ) / clk;	result++;	pr_debug("result %d from %ld, %d\n", result, clk, wanted);	if (result > max) {		printk("%d ns is too big for current clock rate %ld\n",		       wanted, clk);		return -1;	}	if (result < 1)		result = 1;	return result;}#define to_ns(ticks,clk) (((clk) * (ticks)) / NS_IN_KHZ)/* controller setup */static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, 			       struct device *dev){	struct s3c2410_platform_nand *plat = to_nand_plat(dev);	unsigned int tacls, twrph0, twrph1;	unsigned long clkrate = clk_get_rate(info->clk);	unsigned long cfg;	/* calculate the timing information for the controller */	if (plat != NULL) {		tacls  = s3c2410_nand_calc_rate(plat->tacls, clkrate, 4);		twrph0 = s3c2410_nand_calc_rate(plat->twrph0, clkrate, 8);		twrph1 = s3c2410_nand_calc_rate(plat->twrph1, clkrate, 8);	} else {		/* default timings */		tacls = 4;		twrph0 = 8;		twrph1 = 8;	}		if (tacls < 0 || twrph0 < 0 || twrph1 < 0) {		printk(KERN_ERR PFX "cannot get timings suitable for board\n");		return -EINVAL;	}	printk(KERN_INFO PFX "timing: Tacls %ldns, Twrph0 %ldns, Twrph1 %ldns\n",	       to_ns(tacls, clkrate),	       to_ns(twrph0, clkrate),	       to_ns(twrph1, clkrate));	if (!info->is_s3c2440) {		cfg  = S3C2410_NFCONF_EN;		cfg |= S3C2410_NFCONF_TACLS(tacls-1);		cfg |= S3C2410_NFCONF_TWRPH0(twrph0-1);		cfg |= S3C2410_NFCONF_TWRPH1(twrph1-1);	} else {		cfg   = S3C2440_NFCONF_TACLS(tacls-1);		cfg  |= S3C2440_NFCONF_TWRPH0(twrph0-1);		cfg  |= S3C2440_NFCONF_TWRPH1(twrph1-1);	}	pr_debug(PFX "NF_CONF is 0x%lx\n", cfg);	writel(cfg, info->regs + S3C2410_NFCONF);	return 0;}/* select chip */static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip){	struct s3c2410_nand_info *info;	struct s3c2410_nand_mtd *nmtd; 	struct nand_chip *this = mtd->priv;	void __iomem *reg;	unsigned long cur;	unsigned long bit;	nmtd = this->priv;	info = nmtd->info;	bit = (info->is_s3c2440) ? S3C2440_NFCONT_nFCE : S3C2410_NFCONF_nFCE;	reg = info->regs+((info->is_s3c2440) ? S3C2440_NFCONT:S3C2410_NFCONF);	cur = readl(reg);	if (chip == -1) {		cur |= bit;	} else {		if (nmtd->set != NULL && chip > nmtd->set->nr_chips) {			printk(KERN_ERR PFX "chip %d out of range\n", chip);			return;		}		if (info->platform != NULL) {			if (info->platform->select_chip != NULL)				(info->platform->select_chip)(nmtd->set, chip);		}		cur &= ~bit;	}	writel(cur, reg);}/* command and control functions  * * Note, these all use tglx's method of changing the IO_ADDR_W field * to make the code simpler, and use the nand layer's code to issue the * command and address sequences via the proper IO ports. **/static void s3c2410_nand_hwcontrol(struct mtd_info *mtd, int cmd){	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);	struct nand_chip *chip = mtd->priv;	switch (cmd) {	case NAND_CTL_SETNCE:	case NAND_CTL_CLRNCE:		printk(KERN_ERR "%s: called for NCE\n", __FUNCTION__);		break;	case NAND_CTL_SETCLE:		chip->IO_ADDR_W = info->regs + S3C2410_NFCMD;		break;	case NAND_CTL_SETALE:		chip->IO_ADDR_W = info->regs + S3C2410_NFADDR;		break;		/* NAND_CTL_CLRCLE: */		/* NAND_CTL_CLRALE: */	default:		chip->IO_ADDR_W = info->regs + S3C2410_NFDATA;		break;	}}/* command and control functions */static void s3c2440_nand_hwcontrol(struct mtd_info *mtd, int cmd){	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);	struct nand_chip *chip = mtd->priv;	switch (cmd) {	case NAND_CTL_SETNCE:	case NAND_CTL_CLRNCE:		printk(KERN_ERR "%s: called for NCE\n", __FUNCTION__);		break;	case NAND_CTL_SETCLE:		chip->IO_ADDR_W = info->regs + S3C2440_NFCMD;		break;	case NAND_CTL_SETALE:		chip->IO_ADDR_W = info->regs + S3C2440_NFADDR;		break;		/* NAND_CTL_CLRCLE: */		/* NAND_CTL_CLRALE: */	default:		chip->IO_ADDR_W = info->regs + S3C2440_NFDATA;		break;	}}/* s3c2410_nand_devready() * * returns 0 if the nand is busy, 1 if it is ready*/static int s3c2410_nand_devready(struct mtd_info *mtd){	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);		if (info->is_s3c2440)		return readb(info->regs + S3C2440_NFSTAT) & S3C2440_NFSTAT_READY;	return readb(info->regs + S3C2410_NFSTAT) & S3C2410_NFSTAT_BUSY;}/* ECC handling functions */static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,				     u_char *read_ecc, u_char *calc_ecc){	pr_debug("s3c2410_nand_correct_data(%p,%p,%p,%p)\n",		 mtd, dat, read_ecc, calc_ecc);	pr_debug("eccs: read %02x,%02x,%02x vs calc %02x,%02x,%02x\n",		 read_ecc[0], read_ecc[1], read_ecc[2],		 calc_ecc[0], calc_ecc[1], calc_ecc[2]);	if (read_ecc[0] == calc_ecc[0] &&	    read_ecc[1] == calc_ecc[1] &&	    read_ecc[2] == calc_ecc[2]) 		return 0;	/* we curently have no method for correcting the error */	return -1;}/* ECC functions * * These allow the s3c2410 and s3c2440 to use the controller's ECC * generator block to ECC the data as it passes through]*/static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode){	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);	unsigned long ctrl;	ctrl = readl(info->regs + S3C2410_NFCONF);	ctrl |= S3C2410_NFCONF_INITECC;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美国产一区二区三区| 日本欧美一区二区三区乱码| 欧美精品v日韩精品v韩国精品v| 国产一区二区精品久久91| 亚洲国产精品久久人人爱蜜臀| 国产精品嫩草99a| 国产三级精品三级| 欧美激情综合五月色丁香小说| 久久免费精品国产久精品久久久久| 欧美一区二区三区视频| 日韩精品一区二区三区中文不卡 | www.亚洲激情.com| 高清国产一区二区| 99久久久国产精品| 欧美日韩视频第一区| 欧美乱妇15p| 亚洲精选视频在线| 伊人婷婷欧美激情| www.色综合.com| 久久久久国产精品人| 日韩电影在线观看电影| 欧美三级日韩在线| 一区二区三区中文字幕精品精品 | 91久久精品一区二区三区| 99re视频这里只有精品| 国产人久久人人人人爽| 激情五月婷婷综合网| www.欧美.com| 国产精品美女久久久久aⅴ| 国内成人精品2018免费看| 日韩欧美中文字幕一区| 欧美精品一区二区久久婷婷| 国产精品美女一区二区在线观看| 国产激情一区二区三区| 欧美在线免费观看视频| 久久一留热品黄| 亚洲一区中文在线| 成人午夜又粗又硬又大| 欧美男女性生活在线直播观看| 久久久www免费人成精品| 国内精品不卡在线| 国产精品久久久久久久久图文区| 午夜不卡在线视频| 99精品视频中文字幕| 一区二区视频在线看| 欧美天堂亚洲电影院在线播放| 国产亚洲一本大道中文在线| 日韩国产一区二| 精品日韩99亚洲| 亚洲成人高清在线| 色综合久久66| 久久蜜臀精品av| 不卡视频免费播放| 精品国产91久久久久久久妲己| 国产一区三区三区| 国产精品毛片大码女人| 色噜噜狠狠成人网p站| 午夜精品福利久久久| 欧美一级高清片在线观看| 国产精品一色哟哟哟| 欧美大片在线观看一区二区| 国产馆精品极品| 亚洲综合在线视频| 日韩欧美一级在线播放| 成人黄色软件下载| 亚洲成人自拍网| 2020国产精品自拍| 日本久久一区二区| 久久成人免费日本黄色| 91精品国产麻豆国产自产在线| 国产一区二区三区综合| 亚洲精品视频在线观看网站| 日韩午夜在线观看| 91日韩一区二区三区| 国产精品久久久久久亚洲毛片| 欧美午夜片在线看| 国产精品一卡二卡在线观看| 亚洲香蕉伊在人在线观| 久久久蜜桃精品| 欧美日韩一区三区| 国产精品91一区二区| 亚洲成人精品一区| 国产精品网站在线观看| 日韩一级大片在线观看| 97久久人人超碰| 国精产品一区一区三区mba桃花| 中文字幕一区av| 一本大道久久a久久精二百| 久久精品久久99精品久久| 亚洲精品菠萝久久久久久久| 欧美精品一区二区三区蜜臀| 欧美日韩亚洲国产综合| 成年人国产精品| 国模无码大尺度一区二区三区| 亚洲成人av电影| 亚洲另类在线视频| 中日韩av电影| 久久影音资源网| 日韩精品最新网址| 51精品国自产在线| 国产在线播放一区三区四| 日韩专区在线视频| 久久精品一区八戒影视| 欧美一区二区三区视频免费播放 | 一本色道久久综合精品竹菊| 国产成人小视频| 国产综合久久久久久鬼色| 日韩**一区毛片| 日韩精品乱码av一区二区| 亚洲国产视频在线| 亚洲午夜精品一区二区三区他趣| 亚洲三级在线免费| 日韩欧美中文字幕制服| 91精品福利在线一区二区三区 | 777a∨成人精品桃花网| 欧美日高清视频| 欧美日韩极品在线观看一区| 欧美日韩中文精品| 欧美日韩亚州综合| 在线电影院国产精品| 欧美日韩久久久一区| 欧美精选午夜久久久乱码6080| 欧美日韩一区在线| 69p69国产精品| 精品精品国产高清a毛片牛牛| 久久久噜噜噜久久人人看| 久久精品欧美一区二区三区麻豆| 国产日韩欧美精品电影三级在线| 国产人成亚洲第一网站在线播放| 欧美国产视频在线| 亚洲精品一卡二卡| 亚洲国产精品久久艾草纯爱 | 国产一区二区不卡在线| 懂色av一区二区三区免费看| 不卡av免费在线观看| 在线免费亚洲电影| 欧美一二三四在线| 国产无人区一区二区三区| 亚洲日本一区二区三区| 亚洲国产色一区| 久久99日本精品| caoporen国产精品视频| 欧美少妇性性性| 久久综合色婷婷| 亚洲欧美激情小说另类| 国产欧美一区二区三区网站 | 一本久久综合亚洲鲁鲁五月天| 在线亚洲人成电影网站色www| 欧美日韩不卡在线| 久久久久99精品一区| 亚洲柠檬福利资源导航| 久久精品免费看| 91啪在线观看| 精品剧情v国产在线观看在线| 中文字幕日韩一区二区| 日本aⅴ亚洲精品中文乱码| 亚洲成av人影院在线观看网| 美女精品一区二区| 免费成人在线视频观看| 99精品热视频| 精品国精品自拍自在线| 一区二区日韩av| 国产精品综合av一区二区国产馆| 欧美在线啊v一区| 国产午夜精品久久久久久免费视 | 另类小说欧美激情| 91亚洲精华国产精华精华液| 欧美一二三四在线| 一区二区三区资源| 成人性色生活片| 26uuu国产电影一区二区| 亚洲国产三级在线| 99久久综合国产精品| 日韩一级大片在线| 亚洲午夜久久久久久久久久久 | 国内不卡的二区三区中文字幕 | 亚洲三级久久久| 国产自产高清不卡| 欧美精品1区2区| 亚洲卡通欧美制服中文| 国产一区二区按摩在线观看| 在线电影院国产精品| 亚洲一二三四区| 91色.com| 18涩涩午夜精品.www| 高清在线成人网| 久久众筹精品私拍模特| 免费在线成人网| 91精品免费观看| 午夜视黄欧洲亚洲| 欧美丝袜自拍制服另类| 亚洲精品乱码久久久久久黑人| 国产成人在线网站| 久久久午夜精品| 国产精品一区二区三区网站| 欧美一级高清片| 免费成人美女在线观看| 日韩视频永久免费| 麻豆精品久久久| 精品日韩在线观看|