Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
c1f16258
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1f16258
编写于
2月 09, 2007
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://git.infradead.org/~kmpark/onenand-mtd-2.6
上级
552a8278
cde36b37
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
446 addition
and
182 deletion
+446
-182
drivers/mtd/onenand/onenand_base.c
drivers/mtd/onenand/onenand_base.c
+413
-159
drivers/mtd/onenand/onenand_bbt.c
drivers/mtd/onenand/onenand_bbt.c
+15
-12
include/linux/mtd/bbm.h
include/linux/mtd/bbm.h
+7
-0
include/linux/mtd/onenand.h
include/linux/mtd/onenand.h
+6
-9
include/linux/mtd/onenand_regs.h
include/linux/mtd/onenand_regs.h
+5
-2
未找到文件。
drivers/mtd/onenand/onenand_base.c
浏览文件 @
c1f16258
此差异已折叠。
点击以展开。
drivers/mtd/onenand/onenand_bbt.c
浏览文件 @
c1f16258
...
...
@@ -17,8 +17,8 @@
#include <linux/mtd/onenand.h>
#include <linux/mtd/compatmac.h>
extern
int
onenand_
do_read_oob
(
struct
mtd_info
*
mtd
,
loff_t
from
,
size_t
len
,
size_t
*
retlen
,
u_char
*
buf
);
extern
int
onenand_
bbt_read_oob
(
struct
mtd_info
*
mtd
,
loff_t
from
,
struct
mtd_oob_ops
*
ops
);
/**
* check_short_pattern - [GENERIC] check if a pattern is in the buffer
...
...
@@ -65,10 +65,11 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
int
startblock
;
loff_t
from
;
size_t
readlen
,
ooblen
;
struct
mtd_oob_ops
ops
;
printk
(
KERN_INFO
"Scanning device for bad blocks
\n
"
);
len
=
1
;
len
=
2
;
/* We need only read few bytes from the OOB area */
scanlen
=
ooblen
=
0
;
...
...
@@ -82,22 +83,24 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
startblock
=
0
;
from
=
0
;
ops
.
mode
=
MTD_OOB_PLACE
;
ops
.
ooblen
=
readlen
;
ops
.
oobbuf
=
buf
;
ops
.
len
=
ops
.
ooboffs
=
ops
.
retlen
=
ops
.
oobretlen
=
0
;
for
(
i
=
startblock
;
i
<
numblocks
;
)
{
int
ret
;
for
(
j
=
0
;
j
<
len
;
j
++
)
{
size_t
retlen
;
/* No need to read pages fully,
* just read required OOB bytes */
ret
=
onenand_do_read_oob
(
mtd
,
from
+
j
*
mtd
->
writesize
+
bd
->
offs
,
readlen
,
&
retlen
,
&
buf
[
0
]);
ret
=
onenand_bbt_read_oob
(
mtd
,
from
+
j
*
mtd
->
writesize
+
bd
->
offs
,
&
ops
);
/* If it is a initial bad block, just ignore it */
if
(
ret
&&
!
(
ret
&
ONENAND_CTRL_LOAD
)
)
return
ret
;
if
(
ret
==
ONENAND_BBT_READ_FATAL_ERROR
)
return
-
EIO
;
if
(
check_short_pattern
(
&
buf
[
j
*
scanlen
],
scanlen
,
mtd
->
writesize
,
bd
))
{
if
(
ret
||
check_short_pattern
(
&
buf
[
j
*
scanlen
],
scanlen
,
mtd
->
writesize
,
bd
))
{
bbm
->
bbt
[
i
>>
3
]
|=
0x03
<<
(
i
&
0x6
);
printk
(
KERN_WARNING
"Bad eraseblock %d at 0x%08x
\n
"
,
i
>>
1
,
(
unsigned
int
)
from
);
...
...
@@ -168,8 +171,8 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
* marked good / bad blocks and writes the bad block table(s) to
* the selected place.
*
* The bad block table memory is allocated here. It
must be
freed
* by
calling the onenand_free_bbt
function.
* The bad block table memory is allocated here. It
is
freed
* by
the onenand_release
function.
*
*/
int
onenand_scan_bbt
(
struct
mtd_info
*
mtd
,
struct
nand_bbt_descr
*
bd
)
...
...
include/linux/mtd/bbm.h
浏览文件 @
c1f16258
...
...
@@ -92,6 +92,13 @@ struct nand_bbt_descr {
*/
#define ONENAND_BADBLOCK_POS 0
/*
* Bad block scanning errors
*/
#define ONENAND_BBT_READ_ERROR 1
#define ONENAND_BBT_READ_ECC_ERROR 2
#define ONENAND_BBT_READ_FATAL_ERROR 4
/**
* struct bbm_info - [GENERIC] Bad Block Table data structure
* @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
...
...
include/linux/mtd/onenand.h
浏览文件 @
c1f16258
/*
* linux/include/linux/mtd/onenand.h
*
* Copyright (C) 2005-200
6
Samsung Electronics
* Copyright (C) 2005-200
7
Samsung Electronics
* Kyungmin Park <kyungmin.park@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -42,14 +42,10 @@ typedef enum {
/**
* struct onenand_bufferram - OneNAND BufferRAM Data
* @block: block address in BufferRAM
* @page: page address in BufferRAM
* @valid: valid flag
* @blockpage: block & page address in BufferRAM
*/
struct
onenand_bufferram
{
int
block
;
int
page
;
int
valid
;
int
blockpage
;
};
/**
...
...
@@ -63,7 +59,6 @@ struct onenand_bufferram {
* partly be set to inform onenand_scan about
* @erase_shift: [INTERN] number of address bits in a block
* @page_shift: [INTERN] number of address bits in a page
* @ppb_shift: [INTERN] number of address bits in a pages per block
* @page_mask: [INTERN] a page per block mask
* @bufferram_index: [INTERN] BufferRAM index
* @bufferram: [INTERN] BufferRAM info
...
...
@@ -103,7 +98,6 @@ struct onenand_chip {
unsigned
int
erase_shift
;
unsigned
int
page_shift
;
unsigned
int
ppb_shift
;
/* Pages per block shift */
unsigned
int
page_mask
;
unsigned
int
bufferram_index
;
...
...
@@ -150,6 +144,9 @@ struct onenand_chip {
#define ONENAND_SET_SYS_CFG1(v, this) \
(this->write_word(v, this->base + ONENAND_REG_SYS_CFG1))
#define ONENAND_IS_DDP(this) \
(this->device_id & ONENAND_DEVICE_IS_DDP)
/* Check byte access in OneNAND */
#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
...
...
include/linux/mtd/onenand_regs.h
浏览文件 @
c1f16258
...
...
@@ -3,7 +3,8 @@
*
* OneNAND Register header file
*
* Copyright (C) 2005-2006 Samsung Electronics
* 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
...
...
@@ -80,9 +81,11 @@
#define ONENAND_VERSION_PROCESS_SHIFT (8)
/*
* Start Address 1 F100h (R/W)
* Start Address 1 F100h (R/W)
& Start Address 2 F101h (R/W)
*/
#define ONENAND_DDP_SHIFT (15)
#define ONENAND_DDP_CHIP0 (0)
#define ONENAND_DDP_CHIP1 (1 << ONENAND_DDP_SHIFT)
/*
* Start Address 8 F107h (R/W)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录