Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
b7e23d91
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看板
提交
b7e23d91
编写于
2月 03, 2008
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
差异文件
Merge
git://git.infradead.org/~kmpark/onenand-mtd-2.6
上级
c1f3ee12
69d79186
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
31 deletion
+29
-31
drivers/mtd/onenand/onenand_base.c
drivers/mtd/onenand/onenand_base.c
+28
-31
include/linux/mtd/onenand_regs.h
include/linux/mtd/onenand_regs.h
+1
-0
未找到文件。
drivers/mtd/onenand/onenand_base.c
浏览文件 @
b7e23d91
...
...
@@ -169,6 +169,18 @@ static int onenand_buffer_address(int dataram1, int sectors, int count)
return
((
bsa
<<
ONENAND_BSA_SHIFT
)
|
bsc
);
}
/**
* onenand_get_density - [DEFAULT] Get OneNAND density
* @param dev_id OneNAND device ID
*
* Get OneNAND density from device ID
*/
static
inline
int
onenand_get_density
(
int
dev_id
)
{
int
density
=
dev_id
>>
ONENAND_DEVICE_DENSITY_SHIFT
;
return
(
density
&
ONENAND_DEVICE_DENSITY_MASK
);
}
/**
* onenand_command - [DEFAULT] Send command to OneNAND device
* @param mtd MTD device structure
...
...
@@ -182,8 +194,7 @@ static int onenand_buffer_address(int dataram1, int sectors, int count)
static
int
onenand_command
(
struct
mtd_info
*
mtd
,
int
cmd
,
loff_t
addr
,
size_t
len
)
{
struct
onenand_chip
*
this
=
mtd
->
priv
;
int
value
,
readcmd
=
0
,
block_cmd
=
0
;
int
block
,
page
;
int
value
,
block
,
page
;
/* Address translation */
switch
(
cmd
)
{
...
...
@@ -198,7 +209,6 @@ static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, size_t le
case
ONENAND_CMD_ERASE
:
case
ONENAND_CMD_BUFFERRAM
:
case
ONENAND_CMD_OTP_ACCESS
:
block_cmd
=
1
;
block
=
(
int
)
(
addr
>>
this
->
erase_shift
);
page
=
-
1
;
break
;
...
...
@@ -240,11 +250,9 @@ static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, size_t le
value
=
onenand_block_address
(
this
,
block
);
this
->
write_word
(
value
,
this
->
base
+
ONENAND_REG_START_ADDRESS1
);
if
(
block_cmd
)
{
/* Select DataRAM for DDP */
value
=
onenand_bufferram_address
(
this
,
block
);
this
->
write_word
(
value
,
this
->
base
+
ONENAND_REG_START_ADDRESS2
);
}
/* Select DataRAM for DDP */
value
=
onenand_bufferram_address
(
this
,
block
);
this
->
write_word
(
value
,
this
->
base
+
ONENAND_REG_START_ADDRESS2
);
}
if
(
page
!=
-
1
)
{
...
...
@@ -256,7 +264,6 @@ static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, size_t le
case
ONENAND_CMD_READ
:
case
ONENAND_CMD_READOOB
:
dataram
=
ONENAND_SET_NEXT_BUFFERRAM
(
this
);
readcmd
=
1
;
break
;
default:
...
...
@@ -273,12 +280,6 @@ static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, size_t le
/* Write 'BSA, BSC' of DataRAM */
value
=
onenand_buffer_address
(
dataram
,
sectors
,
count
);
this
->
write_word
(
value
,
this
->
base
+
ONENAND_REG_START_BUFFER
);
if
(
readcmd
)
{
/* Select DataRAM for DDP */
value
=
onenand_bufferram_address
(
this
,
block
);
this
->
write_word
(
value
,
this
->
base
+
ONENAND_REG_START_ADDRESS2
);
}
}
/* Interrupt clear */
...
...
@@ -1118,12 +1119,10 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state)
interrupt
=
this
->
read_word
(
this
->
base
+
ONENAND_REG_INTERRUPT
);
ctrl
=
this
->
read_word
(
this
->
base
+
ONENAND_REG_CTRL_STATUS
);
/* Initial bad block case: 0x2400 or 0x0400 */
if
(
ctrl
&
ONENAND_CTRL_ERROR
)
{
printk
(
KERN_DEBUG
"onenand_bbt_wait: controller error = 0x%04x
\n
"
,
ctrl
);
/* Initial bad block case */
if
(
ctrl
&
ONENAND_CTRL_LOAD
)
return
ONENAND_BBT_READ_ERROR
;
return
ONENAND_BBT_READ_FATAL_ERROR
;
return
ONENAND_BBT_READ_ERROR
;
}
if
(
interrupt
&
ONENAND_INT_READ
)
{
...
...
@@ -1218,7 +1217,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
static
int
onenand_verify_oob
(
struct
mtd_info
*
mtd
,
const
u_char
*
buf
,
loff_t
to
)
{
struct
onenand_chip
*
this
=
mtd
->
priv
;
char
oobbuf
[
64
]
;
u_char
*
oob_buf
=
this
->
oob_buf
;
int
status
,
i
;
this
->
command
(
mtd
,
ONENAND_CMD_READOOB
,
to
,
mtd
->
oobsize
);
...
...
@@ -1227,9 +1226,9 @@ static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to
if
(
status
)
return
status
;
this
->
read_bufferram
(
mtd
,
ONENAND_SPARERAM
,
oobbuf
,
0
,
mtd
->
oobsize
);
this
->
read_bufferram
(
mtd
,
ONENAND_SPARERAM
,
oob
_
buf
,
0
,
mtd
->
oobsize
);
for
(
i
=
0
;
i
<
mtd
->
oobsize
;
i
++
)
if
(
buf
[
i
]
!=
0xFF
&&
buf
[
i
]
!=
oobbuf
[
i
])
if
(
buf
[
i
]
!=
0xFF
&&
buf
[
i
]
!=
oob
_
buf
[
i
])
return
-
EBADMSG
;
return
0
;
...
...
@@ -1431,7 +1430,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
}
/* Only check verify write turn on */
ret
=
onenand_verify
(
mtd
,
(
u_char
*
)
w
buf
,
to
,
thislen
);
ret
=
onenand_verify
(
mtd
,
buf
,
to
,
thislen
);
if
(
ret
)
{
printk
(
KERN_ERR
"onenand_write_ops_nolock: verify failed %d
\n
"
,
ret
);
break
;
...
...
@@ -1447,9 +1446,6 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
buf
+=
thislen
;
}
/* Deselect and wake up anyone waiting on the device */
onenand_release_device
(
mtd
);
ops
->
retlen
=
written
;
return
ret
;
...
...
@@ -2160,7 +2156,7 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
*
retlen
=
0
;
density
=
this
->
device_id
>>
ONENAND_DEVICE_DENSITY_SHIFT
;
density
=
onenand_get_density
(
this
->
device_id
)
;
if
(
density
<
ONENAND_DEVICE_DENSITY_512Mb
)
otp_pages
=
20
;
else
...
...
@@ -2311,7 +2307,8 @@ static int onenand_write_user_prot_reg(struct mtd_info *mtd, loff_t from,
static
int
onenand_lock_user_prot_reg
(
struct
mtd_info
*
mtd
,
loff_t
from
,
size_t
len
)
{
unsigned
char
oob_buf
[
64
];
struct
onenand_chip
*
this
=
mtd
->
priv
;
u_char
*
oob_buf
=
this
->
oob_buf
;
size_t
retlen
;
int
ret
;
...
...
@@ -2351,7 +2348,7 @@ static void onenand_check_features(struct mtd_info *mtd)
unsigned
int
density
,
process
;
/* Lock scheme depends on density and process */
density
=
this
->
device_id
>>
ONENAND_DEVICE_DENSITY_SHIFT
;
density
=
onenand_get_density
(
this
->
device_id
)
;
process
=
this
->
version_id
>>
ONENAND_VERSION_PROCESS_SHIFT
;
/* Lock scheme */
...
...
@@ -2400,7 +2397,7 @@ static void onenand_print_device_info(int device, int version)
vcc
=
device
&
ONENAND_DEVICE_VCC_MASK
;
demuxed
=
device
&
ONENAND_DEVICE_IS_DEMUX
;
ddp
=
device
&
ONENAND_DEVICE_IS_DDP
;
density
=
device
>>
ONENAND_DEVICE_DENSITY_SHIFT
;
density
=
onenand_get_density
(
device
)
;
printk
(
KERN_INFO
"%sOneNAND%s %dMB %sV 16-bit (0x%02x)
\n
"
,
demuxed
?
""
:
"Muxed "
,
ddp
?
"(DDP)"
:
""
,
...
...
@@ -2492,7 +2489,7 @@ static int onenand_probe(struct mtd_info *mtd)
this
->
device_id
=
dev_id
;
this
->
version_id
=
ver_id
;
density
=
dev_id
>>
ONENAND_DEVICE_DENSITY_SHIFT
;
density
=
onenand_get_density
(
dev_id
)
;
this
->
chipsize
=
(
16
<<
density
)
<<
20
;
/* Set density mask. it is used for DDP */
if
(
ONENAND_IS_DDP
(
this
))
...
...
include/linux/mtd/onenand_regs.h
浏览文件 @
b7e23d91
...
...
@@ -67,6 +67,7 @@
/*
* Device ID Register F001h (R)
*/
#define ONENAND_DEVICE_DENSITY_MASK (0xf)
#define ONENAND_DEVICE_DENSITY_SHIFT (4)
#define ONENAND_DEVICE_IS_DDP (1 << 3)
#define ONENAND_DEVICE_IS_DEMUX (1 << 2)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录