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

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

?? s3c2410.c

?? 項目源碼察看工具---- MTD工具
?? 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 *	14-Jan-2006  BJD  Allow clock to be stopped when idle * * $Id: s3c2410.c,v 1.23 2006/04/01 18:06:29 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 <linux/config.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#ifdef CONFIG_MTD_NAND_S3C2410_CLKSTOPstatic int clock_stop = 1;#elsestatic const int clock_stop = 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;}static inline int allow_clk_stop(struct s3c2410_nand_info *info){	return clock_stop;}/* 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);		/* enable the controller and de-assert nFCE */		writel(S3C2440_NFCONT_ENABLE | S3C2440_NFCONT_ENABLE,		       info->regs + S3C2440_NFCONT);	}	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);	if (chip != -1 && allow_clk_stop(info))		clk_enable(info->clk);	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);	if (chip == -1 && allow_clk_stop(info))		clk_disable(info->clk);}/* 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;	writel(ctrl, info->regs + S3C2410_NFCONF);}static void s3c2440_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 + S3C2440_NFCONT);	writel(ctrl | S3C2440_NFCONT_INITECC, info->regs + S3C2440_NFCONT);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级日韩免费不卡| 视频精品一区二区| 日韩av一级电影| 欧美日韩和欧美的一区二区| 亚洲精品免费看| 成人av资源网站| 国产精品女上位| 91欧美一区二区| 综合欧美一区二区三区| 99精品国产视频| 亚洲视频 欧洲视频| 91免费观看国产| 亚洲午夜一区二区| 欧美狂野另类xxxxoooo| 日韩av在线发布| 欧美本精品男人aⅴ天堂| 国产麻豆一精品一av一免费| 中文无字幕一区二区三区| 国产做a爰片久久毛片| 久久精品夜夜夜夜久久| jizz一区二区| 亚洲一区成人在线| 日韩视频一区二区三区在线播放| 美女免费视频一区| 久久精品一区四区| 91麻豆国产在线观看| 亚洲国产va精品久久久不卡综合| 91精品综合久久久久久| 国产精品自拍三区| 亚洲欧洲日韩av| 色综合久久天天| 无码av中文一区二区三区桃花岛| 日韩欧美aaaaaa| 精品一区二区三区在线观看国产| 国产欧美日韩在线| 欧美综合欧美视频| 国内外精品视频| 日韩一区在线看| 欧美一区二区福利视频| 成人午夜视频福利| 午夜影院久久久| 亚洲国产精品二十页| 欧美性大战久久久| 国产自产v一区二区三区c| 综合激情成人伊人| 欧美不卡123| 欧美主播一区二区三区| 久久99精品国产麻豆婷婷洗澡| 悠悠色在线精品| 国产精品福利电影一区二区三区四区| 日韩视频永久免费| 欧美日韩视频在线一区二区| 成人综合婷婷国产精品久久蜜臀| 日韩不卡一区二区三区| 亚洲国产成人tv| 一区二区在线免费观看| 国产精品视频免费看| 久久在线观看免费| 欧美一卡2卡3卡4卡| 欧美日韩电影一区| 欧美精品色一区二区三区| 91久久精品一区二区三区| 成人网在线播放| 国产91丝袜在线播放0| 国产制服丝袜一区| 激情综合色播五月| 激情久久五月天| 九九九久久久精品| 奇米一区二区三区| 麻豆视频一区二区| 狠狠狠色丁香婷婷综合激情| 久久精品免费看| 精品亚洲免费视频| 国产老女人精品毛片久久| 精品一区二区三区在线视频| 久久精品国产亚洲5555| 久久99国产精品成人| 久久99精品国产麻豆婷婷| 国产综合一区二区| 高清成人在线观看| 不卡一区二区中文字幕| 91香蕉视频黄| 欧美午夜精品久久久久久超碰| 欧美日韩中文字幕一区二区| 欧美日本高清视频在线观看| 欧美一区二区三区四区久久| 欧美xingq一区二区| 国产午夜精品一区二区| 国产精品高潮久久久久无| 日韩一区有码在线| 午夜精品一区二区三区免费视频 | 精品1区2区在线观看| 精品久久一区二区| 国产欧美视频一区二区三区| 国产精品盗摄一区二区三区| 一区二区三区不卡在线观看| 亚洲成av人综合在线观看| 久久国产三级精品| 粉嫩蜜臀av国产精品网站| 色综合天天综合色综合av | 国产欧美一区二区三区网站 | 琪琪一区二区三区| 国产精一品亚洲二区在线视频| 99久久国产综合色|国产精品| 色婷婷久久久亚洲一区二区三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 欧美精选在线播放| 久久精品一区蜜桃臀影院| 亚洲精品成人悠悠色影视| 日本不卡的三区四区五区| 国产精品18久久久| 欧美亚洲动漫另类| 久久久亚洲高清| 一区二区三区成人在线视频| 精品一区二区三区在线播放视频 | 2020国产精品自拍| 亚洲精品免费播放| 激情小说亚洲一区| 欧美中文字幕一区| 久久精品在线观看| 日韩国产欧美视频| 91丝袜美女网| 久久亚洲一区二区三区四区| 亚洲精品菠萝久久久久久久| 国内偷窥港台综合视频在线播放| 色视频欧美一区二区三区| 精品国产91久久久久久久妲己 | 精品99999| 亚洲精品高清在线观看| 国产在线视视频有精品| 欧美日韩一区小说| 国产精品免费丝袜| 久久精品国产亚洲a| 欧美日韩一区久久| 亚洲欧美自拍偷拍色图| 精品亚洲国内自在自线福利| 欧美在线观看禁18| 亚洲天堂中文字幕| 国产福利一区二区三区视频 | 久久av老司机精品网站导航| 欧洲亚洲国产日韩| 中文字幕的久久| 精品一区二区三区在线观看 | 欧美大尺度电影在线| 亚洲影院理伦片| 91蝌蚪porny九色| 国产欧美综合色| 久久激情五月婷婷| 91精品国产综合久久久蜜臀粉嫩| 亚洲欧美日韩精品久久久久| 国产成人午夜精品影院观看视频| 日韩欧美国产系列| 日韩高清一区在线| 91精品国产一区二区| 亚洲丶国产丶欧美一区二区三区| 91丨porny丨在线| 国产精品美女久久久久久久久久久| 国产精品正在播放| 久久久久久一二三区| 国产在线观看一区二区| 欧美成人精品1314www| 秋霞影院一区二区| 日韩欧美一级二级三级久久久| 日本视频中文字幕一区二区三区 | 日韩欧美卡一卡二| 美女网站一区二区| 精品久久久久香蕉网| 经典三级视频一区| 欧美精品一区在线观看| 国产真实精品久久二三区| 久久久久久久久蜜桃| 国产成人免费在线| 国产精品嫩草99a| 色av综合在线| 午夜成人免费视频| 日韩视频免费观看高清完整版 | 亚洲国产精品人人做人人爽| 欧美亚洲综合在线| 亚洲h精品动漫在线观看| 欧美一区二区三区视频| 久久激情五月激情| 亚洲国产精品激情在线观看| 91在线观看地址| 亚洲成人自拍偷拍| 欧美一区二区三区在| 国产在线国偷精品免费看| 日本一区二区三区国色天香 | 国产人妖乱国产精品人妖| 不卡欧美aaaaa| 亚洲中国最大av网站| 欧美男人的天堂一二区| 久久99精品一区二区三区三区| 国产欧美一区二区三区鸳鸯浴| 99r国产精品| 免费在线观看一区| 国产欧美一区二区在线观看| 色噜噜夜夜夜综合网| 日本电影亚洲天堂一区| 亚洲国产aⅴ天堂久久| 久久亚洲精品小早川怜子|