Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3b85c321
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3b85c321
编写于
9月 25, 2006
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MTD NAND] Split nand_scan() into two parts; allow board driver to intervene
Signed-off-by:
N
David Woodhouse
<
dwmw2@infradead.org
>
上级
4b648b02
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
25 deletion
+70
-25
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_base.c
+65
-25
include/linux/mtd/nand.h
include/linux/mtd/nand.h
+5
-0
未找到文件。
drivers/mtd/nand/nand_base.c
浏览文件 @
3b85c321
...
...
@@ -2289,40 +2289,22 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
return
type
;
}
/* module_text_address() isn't exported, and it's mostly a pointless
test if this is a module _anyway_ -- they'd have to try _really_ hard
to call us from in-kernel code if the core NAND support is modular. */
#ifdef MODULE
#define caller_is_module() (1)
#else
#define caller_is_module() \
module_text_address((unsigned long)__builtin_return_address(0))
#endif
/**
* nand_scan - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
* @maxchips: Number of chips to scan for
* nand_scan
_ident
- [NAND Interface] Scan for the NAND device
* @mtd:
MTD device structure
* @maxchips:
Number of chips to scan for
*
* This fills out all the uninitialized function pointers
* with the defaults.
* The flash ID is read and the mtd/chip structures are
* filled with the appropriate values.
* The mtd->owner field must be set to the module of the caller
* This is the first phase of the normal nand_scan() function. It
* reads the flash ID and sets up MTD fields accordingly.
*
* The mtd->owner field must be set to the module of the caller.
*/
int
nand_scan
(
struct
mtd_info
*
mtd
,
int
maxchips
)
int
nand_scan
_ident
(
struct
mtd_info
*
mtd
,
int
maxchips
)
{
int
i
,
busw
,
nand_maf_id
;
struct
nand_chip
*
chip
=
mtd
->
priv
;
struct
nand_flash_dev
*
type
;
/* Many callers got this wrong, so check for it for a while... */
if
(
!
mtd
->
owner
&&
caller_is_module
())
{
printk
(
KERN_CRIT
"nand_scan() called with NULL mtd->owner!
\n
"
);
BUG
();
}
/* Get buswidth to select the correct functions */
busw
=
chip
->
options
&
NAND_BUSWIDTH_16
;
/* Set the default functions */
...
...
@@ -2354,6 +2336,24 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
chip
->
numchips
=
i
;
mtd
->
size
=
i
*
chip
->
chipsize
;
return
0
;
}
/**
* nand_scan_tail - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
* @maxchips: Number of chips to scan for
*
* This is the second phase of the normal nand_scan() function. It
* fills out all the uninitialized function pointers with the defaults
* and scans for a bad block table if appropriate.
*/
int
nand_scan_tail
(
struct
mtd_info
*
mtd
)
{
int
i
;
struct
nand_chip
*
chip
=
mtd
->
priv
;
/* Preset the internal oob write buffer */
memset
(
chip
->
buffers
.
oobwbuf
,
0xff
,
mtd
->
oobsize
);
...
...
@@ -2504,6 +2504,44 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
return
chip
->
scan_bbt
(
mtd
);
}
/* module_text_address() isn't exported, and it's mostly a pointless
test if this is a module _anyway_ -- they'd have to try _really_ hard
to call us from in-kernel code if the core NAND support is modular. */
#ifdef MODULE
#define caller_is_module() (1)
#else
#define caller_is_module() \
module_text_address((unsigned long)__builtin_return_address(0))
#endif
/**
* nand_scan - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
* @maxchips: Number of chips to scan for
*
* This fills out all the uninitialized function pointers
* with the defaults.
* The flash ID is read and the mtd/chip structures are
* filled with the appropriate values.
* The mtd->owner field must be set to the module of the caller
*
*/
int
nand_scan
(
struct
mtd_info
*
mtd
,
int
maxchips
)
{
int
ret
;
/* Many callers got this wrong, so check for it for a while... */
if
(
!
mtd
->
owner
&&
caller_is_module
())
{
printk
(
KERN_CRIT
"nand_scan() called with NULL mtd->owner!
\n
"
);
BUG
();
}
ret
=
nand_scan_ident
(
mtd
,
maxchips
);
if
(
!
ret
)
ret
=
nand_scan_tail
(
mtd
);
return
ret
;
}
/**
* nand_release - [NAND Interface] Free resources held by the NAND device
* @mtd: MTD device structure
...
...
@@ -2524,6 +2562,8 @@ void nand_release(struct mtd_info *mtd)
}
EXPORT_SYMBOL_GPL
(
nand_scan
);
EXPORT_SYMBOL_GPL
(
nand_scan_ident
);
EXPORT_SYMBOL_GPL
(
nand_scan_tail
);
EXPORT_SYMBOL_GPL
(
nand_release
);
static
int
__init
nand_base_init
(
void
)
...
...
include/linux/mtd/nand.h
浏览文件 @
3b85c321
...
...
@@ -27,6 +27,11 @@
struct
mtd_info
;
/* Scan and identify a NAND device */
extern
int
nand_scan
(
struct
mtd_info
*
mtd
,
int
max_chips
);
/* Separate phases of nand_scan(), allowing board driver to intervene
* and override command or ECC setup according to flash type */
extern
int
nand_scan_ident
(
struct
mtd_info
*
mtd
,
int
max_chips
);
extern
int
nand_scan_tail
(
struct
mtd_info
*
mtd
);
/* Free resources held by the NAND device */
extern
void
nand_release
(
struct
mtd_info
*
mtd
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录