Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
248ae5cf
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
248ae5cf
编写于
6月 06, 2008
作者:
S
Sergei Poselenov
提交者:
Andrew Fleming-AFLEMING
6月 11, 2008
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NAND: Added support for 128-bit OOB, adapted
Signed-off-by:
N
Sergei Poselenov
<
sposelenov@emcraft.com
>
上级
31ca0208
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
14 deletion
+34
-14
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_base.c
+33
-13
include/linux/mtd/mtd-abi.h
include/linux/mtd/mtd-abi.h
+1
-1
未找到文件。
drivers/mtd/nand/nand_base.c
浏览文件 @
248ae5cf
...
@@ -113,18 +113,22 @@ static struct nand_oobinfo nand_oob_64 = {
...
@@ -113,18 +113,22 @@ static struct nand_oobinfo nand_oob_64 = {
.
oobfree
=
{
{
2
,
38
}
}
.
oobfree
=
{
{
2
,
38
}
}
};
};
/* This is used for padding purposes in nand_write_oob */
static
struct
nand_oobinfo
nand_oob_128
=
{
static
u_char
ffchars
[]
=
{
.
useecc
=
MTD_NANDECC_AUTOPLACE
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
.
eccbytes
=
48
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
.
eccpos
=
{
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
80
,
81
,
82
,
83
,
84
,
85
,
86
,
87
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
88
,
89
,
90
,
91
,
92
,
93
,
94
,
95
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
96
,
97
,
98
,
99
,
100
,
101
,
102
,
103
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
104
,
105
,
106
,
107
,
108
,
109
,
110
,
111
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
112
,
113
,
114
,
115
,
116
,
117
,
118
,
119
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
120
,
121
,
122
,
123
,
124
,
125
,
126
,
127
},
.
oobfree
=
{
{
2
,
78
}
}
};
};
/* This is used for padding purposes in nand_write_oob */
static
u_char
*
ffchars
;
/*
/*
* NAND low-level MTD interface functions
* NAND low-level MTD interface functions
*/
*/
...
@@ -193,6 +197,10 @@ static void nand_release_device (struct mtd_info *mtd)
...
@@ -193,6 +197,10 @@ static void nand_release_device (struct mtd_info *mtd)
{
{
struct
nand_chip
*
this
=
mtd
->
priv
;
struct
nand_chip
*
this
=
mtd
->
priv
;
this
->
select_chip
(
mtd
,
-
1
);
/* De-select the NAND device */
this
->
select_chip
(
mtd
,
-
1
);
/* De-select the NAND device */
if
(
ffchars
)
{
kfree
(
ffchars
);
ffchars
=
NULL
;
}
}
}
#endif
#endif
...
@@ -891,7 +899,7 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa
...
@@ -891,7 +899,7 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa
u_char
*
oob_buf
,
struct
nand_oobinfo
*
oobsel
,
int
cached
)
u_char
*
oob_buf
,
struct
nand_oobinfo
*
oobsel
,
int
cached
)
{
{
int
i
,
status
;
int
i
,
status
;
u_char
ecc_code
[
32
];
u_char
ecc_code
[
NAND_MAX_OOBSIZE
];
int
eccmode
=
oobsel
->
useecc
?
this
->
eccmode
:
NAND_ECC_NONE
;
int
eccmode
=
oobsel
->
useecc
?
this
->
eccmode
:
NAND_ECC_NONE
;
uint
*
oob_config
=
oobsel
->
eccpos
;
uint
*
oob_config
=
oobsel
->
eccpos
;
int
datidx
=
0
,
eccidx
=
0
,
eccsteps
=
this
->
eccsteps
;
int
datidx
=
0
,
eccidx
=
0
,
eccsteps
=
this
->
eccsteps
;
...
@@ -1112,8 +1120,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
...
@@ -1112,8 +1120,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
int
read
=
0
,
oob
=
0
,
ecc_status
=
0
,
ecc_failed
=
0
;
int
read
=
0
,
oob
=
0
,
ecc_status
=
0
,
ecc_failed
=
0
;
struct
nand_chip
*
this
=
mtd
->
priv
;
struct
nand_chip
*
this
=
mtd
->
priv
;
u_char
*
data_poi
,
*
oob_data
=
oob_buf
;
u_char
*
data_poi
,
*
oob_data
=
oob_buf
;
u_char
ecc_calc
[
32
];
u_char
ecc_calc
[
NAND_MAX_OOBSIZE
];
u_char
ecc_code
[
32
];
u_char
ecc_code
[
NAND_MAX_OOBSIZE
];
int
eccmode
,
eccsteps
;
int
eccmode
,
eccsteps
;
unsigned
*
oob_config
;
unsigned
*
oob_config
;
int
datidx
;
int
datidx
;
...
@@ -1811,6 +1819,15 @@ static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t *
...
@@ -1811,6 +1819,15 @@ static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t *
if
(
NAND_MUST_PAD
(
this
))
{
if
(
NAND_MUST_PAD
(
this
))
{
/* Write out desired data */
/* Write out desired data */
this
->
cmdfunc
(
mtd
,
NAND_CMD_SEQIN
,
mtd
->
oobblock
,
page
&
this
->
pagemask
);
this
->
cmdfunc
(
mtd
,
NAND_CMD_SEQIN
,
mtd
->
oobblock
,
page
&
this
->
pagemask
);
if
(
!
ffchars
)
{
if
(
!
(
ffchars
=
kmalloc
(
mtd
->
oobsize
,
GFP_KERNEL
)))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"nand_write_oob: "
"No memory for padding array, need %d bytes"
,
mtd
->
oobsize
);
ret
=
-
ENOMEM
;
goto
out
;
}
memset
(
ffchars
,
0xff
,
mtd
->
oobsize
);
}
/* prepad 0xff for partial programming */
/* prepad 0xff for partial programming */
this
->
write_buf
(
mtd
,
ffchars
,
column
);
this
->
write_buf
(
mtd
,
ffchars
,
column
);
/* write data */
/* write data */
...
@@ -2479,6 +2496,9 @@ int nand_scan (struct mtd_info *mtd, int maxchips)
...
@@ -2479,6 +2496,9 @@ int nand_scan (struct mtd_info *mtd, int maxchips)
case
64
:
case
64
:
this
->
autooob
=
&
nand_oob_64
;
this
->
autooob
=
&
nand_oob_64
;
break
;
break
;
case
128
:
this
->
autooob
=
&
nand_oob_128
;
break
;
default:
default:
printk
(
KERN_WARNING
"No oob scheme defined for oobsize %d
\n
"
,
printk
(
KERN_WARNING
"No oob scheme defined for oobsize %d
\n
"
,
mtd
->
oobsize
);
mtd
->
oobsize
);
...
...
include/linux/mtd/mtd-abi.h
浏览文件 @
248ae5cf
...
@@ -93,7 +93,7 @@ struct nand_oobinfo {
...
@@ -93,7 +93,7 @@ struct nand_oobinfo {
uint32_t
useecc
;
uint32_t
useecc
;
uint32_t
eccbytes
;
uint32_t
eccbytes
;
uint32_t
oobfree
[
8
][
2
];
uint32_t
oobfree
[
8
][
2
];
uint32_t
eccpos
[
32
];
uint32_t
eccpos
[
48
];
};
};
#endif
/* __MTD_ABI_H__ */
#endif
/* __MTD_ABI_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录