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

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

?? s3c2410.c

?? 根據(jù)fs2410移植過后的mtd驅(qū)動源碼
?? 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 *	20-Oct-2005  BJD  Fix timing calculation bug * * $Id: s3c2410.c,v 1.20 2005/11/07 11:14:31 gleixner 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/platform_device.h>#include <linux/delay.h>#include <linux/err.h>#include <linux/slab.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/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 platform_device *dev){	return platform_get_drvdata(dev);}static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev){	return dev->dev.platform_data;}/* timing calculations */#define NS_IN_KHZ 1000000static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max){	int result;	result = (wanted * clk) / NS_IN_KHZ;	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) (((ticks) * NS_IN_KHZ) / (unsigned int)(clk))/* controller setup */static int s3c2410_nand_inithw(struct s3c2410_nand_info *info,			       struct platform_device *pdev){	struct s3c2410_platform_nand *plat = to_nand_plat(pdev);	unsigned long clkrate = clk_get_rate(info->clk);	int tacls, twrph0, twrph1;	unsigned long cfg;	/* calculate the timing information for the controller */	clkrate /= 1000;	/* turn clock into kHz for ease of use */	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 "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",	       tacls, to_ns(tacls, clkrate),	       twrph0, to_ns(twrph0, clkrate),	       twrph1, 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产电影在线观看| 一区二区欧美在线观看| 在线观看亚洲精品视频| 狠狠色狠狠色综合系列| 一区二区不卡在线播放| 亚洲国产精品二十页| 日韩午夜在线影院| 在线免费不卡视频| 成人综合在线观看| 久久99热狠狠色一区二区| 亚洲蜜臀av乱码久久精品 | 欧美日韩在线综合| 成人天堂资源www在线| 久久疯狂做爰流白浆xx| 亚洲影院在线观看| 中文字幕制服丝袜一区二区三区| 精品奇米国产一区二区三区| 欧美日韩在线播放| 欧洲一区在线观看| 91久久一区二区| 成人美女视频在线观看18| 激情欧美日韩一区二区| 日韩激情一二三区| 五月婷婷综合激情| 亚洲福利视频三区| 亚洲一区二区在线观看视频 | 色噜噜夜夜夜综合网| 成熟亚洲日本毛茸茸凸凹| 黄色成人免费在线| 久久 天天综合| 麻豆精品视频在线| 青青草国产精品亚洲专区无| 日韩主播视频在线| 日韩精品色哟哟| 无码av中文一区二区三区桃花岛| 亚洲最大成人综合| 亚洲一区二区三区四区在线观看 | 国产精品对白交换视频 | 日韩av午夜在线观看| 午夜视频一区二区| 日韩国产在线观看一区| 丝袜诱惑亚洲看片| 青青草原综合久久大伊人精品优势| 视频一区视频二区在线观看| 偷拍亚洲欧洲综合| 日韩成人伦理电影在线观看| 蜜桃视频在线观看一区二区| 寂寞少妇一区二区三区| 国产精品亚洲第一区在线暖暖韩国| 国产伦精品一区二区三区视频青涩| 国产一区二区看久久| 成人一区二区视频| 91麻豆精品秘密| 91成人网在线| 91精品国产一区二区| 欧美成人精精品一区二区频| 国产午夜精品久久| 18成人在线观看| 丝袜亚洲精品中文字幕一区| 卡一卡二国产精品| 高清不卡一二三区| 色综合色综合色综合色综合色综合| 在线观看91视频| 欧美一级二级三级乱码| 国产午夜精品一区二区三区视频 | 蜜臀久久99精品久久久画质超高清| 免费欧美在线视频| 高清在线成人网| 欧洲国产伦久久久久久久| 88在线观看91蜜桃国自产| 久久夜色精品国产噜噜av| 国产精品不卡在线观看| 亚洲成人一二三| 韩国女主播一区二区三区| 成人av网在线| 欧美高清视频一二三区 | 蜜臂av日日欢夜夜爽一区| 国产精品一二一区| 欧美亚洲一区二区在线| 欧美岛国在线观看| 国产精品久久毛片av大全日韩| 亚洲第一福利视频在线| 国产精一区二区三区| 欧美系列日韩一区| 久久婷婷成人综合色| 亚洲综合区在线| 国产一区二区免费看| 欧美在线小视频| 国产午夜精品理论片a级大结局| 亚洲精品综合在线| 精东粉嫩av免费一区二区三区| 一本色道综合亚洲| 精品嫩草影院久久| 一区二区三区四区亚洲| 国产一级精品在线| 欧美三级日韩三级| 中文字幕欧美国产| 蜜臀av性久久久久av蜜臀妖精| 日韩欧美国产1| 国产精品高潮呻吟久久| 精品一二三四在线| 在线播放国产精品二区一二区四区| 欧美激情一区二区三区| 另类小说欧美激情| 欧美日韩和欧美的一区二区| 国产精品久久久久久久岛一牛影视| 久久国产尿小便嘘嘘尿| 欧美喷潮久久久xxxxx| 最新不卡av在线| 国产91精品露脸国语对白| 欧美一区二区三区在线电影| 一区二区三区免费看视频| 成人免费看视频| 国产亚洲自拍一区| 久久精品国内一区二区三区| 91国产免费看| 亚洲日本中文字幕区| 成人午夜在线视频| 久久久久久97三级| 国产综合久久久久影院| 日韩亚洲电影在线| 午夜成人免费电影| 欧美日韩久久久| 午夜电影久久久| 欧美欧美欧美欧美首页| 亚洲国产va精品久久久不卡综合| 色综合一区二区| 亚洲精品福利视频网站| 91国产福利在线| 亚洲一区国产视频| 欧美伊人久久久久久久久影院| 一区二区三区在线视频观看58| 91一区一区三区| 夜色激情一区二区| 欧美视频一二三区| 午夜精品久久久久久| 欧美精品黑人性xxxx| 午夜国产精品一区| 7777精品伊人久久久大香线蕉| 天堂在线一区二区| 日韩一区二区视频在线观看| 奇米影视7777精品一区二区| 7777女厕盗摄久久久| 另类小说色综合网站| 久久综合狠狠综合久久综合88| 国产九色sp调教91| 18成人在线观看| 91搞黄在线观看| 日韩电影一二三区| 精品国产亚洲在线| 国产91丝袜在线播放0| 中文幕一区二区三区久久蜜桃| 99在线精品视频| 亚洲第一成人在线| 日韩免费一区二区| 国产成人精品一区二区三区四区| 中文字幕一区二区在线观看| 日本道精品一区二区三区| 日日欢夜夜爽一区| 久久久91精品国产一区二区三区| 高清视频一区二区| 一区二区久久久久久| 欧美一区二区日韩| 欧美精品日韩精品| 免费不卡在线视频| 国产精品区一区二区三| 欧美色倩网站大全免费| 狠狠色丁香婷婷综合| 亚洲天堂久久久久久久| 91精品国产免费久久综合| 国产精品一区一区| 亚洲国产精品综合小说图片区| 精品理论电影在线观看| 91麻豆文化传媒在线观看| 天天操天天色综合| 国产精品乱码久久久久久| 欧美主播一区二区三区美女| 久久99国产精品久久| 一区二区三区在线免费视频| 欧美电影免费观看高清完整版在线| www.综合网.com| 日本不卡高清视频| 成人免费在线观看入口| 日韩欧美在线影院| 日本精品一区二区三区四区的功能| 麻豆高清免费国产一区| 中文字幕制服丝袜一区二区三区 | 欧美极品美女视频| 欧美绝品在线观看成人午夜影视| 国产精品白丝jk黑袜喷水| 亚洲一区国产视频| 国产精品人妖ts系列视频| 欧美一区二区观看视频| 99久久99久久久精品齐齐| 黄色资源网久久资源365| 亚洲午夜成aⅴ人片| 中文字幕一区av| 久久蜜桃香蕉精品一区二区三区| 欧美卡1卡2卡| 91久久人澡人人添人人爽欧美|