Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
e5580fbe
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e5580fbe
编写于
11月 07, 2005
作者:
T
Thomas Gleixner
提交者:
Thomas Gleixner
11月 07, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MTD] devices: Clean up trailing white spaces
Signed-off-by:
N
Thomas Gleixner
<
tglx@linutronix.de
>
上级
69f34c98
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
156 addition
and
156 deletion
+156
-156
drivers/mtd/devices/Kconfig
drivers/mtd/devices/Kconfig
+4
-4
drivers/mtd/devices/blkmtd.c
drivers/mtd/devices/blkmtd.c
+5
-5
drivers/mtd/devices/block2mtd.c
drivers/mtd/devices/block2mtd.c
+4
-4
drivers/mtd/devices/doc2000.c
drivers/mtd/devices/doc2000.c
+21
-21
drivers/mtd/devices/doc2001.c
drivers/mtd/devices/doc2001.c
+12
-12
drivers/mtd/devices/doc2001plus.c
drivers/mtd/devices/doc2001plus.c
+10
-10
drivers/mtd/devices/docecc.c
drivers/mtd/devices/docecc.c
+20
-20
drivers/mtd/devices/docprobe.c
drivers/mtd/devices/docprobe.c
+42
-42
drivers/mtd/devices/lart.c
drivers/mtd/devices/lart.c
+4
-4
drivers/mtd/devices/phram.c
drivers/mtd/devices/phram.c
+7
-7
drivers/mtd/devices/pmc551.c
drivers/mtd/devices/pmc551.c
+12
-12
drivers/mtd/devices/slram.c
drivers/mtd/devices/slram.c
+15
-15
未找到文件。
drivers/mtd/devices/Kconfig
浏览文件 @
e5580fbe
# drivers/mtd/maps/Kconfig
# $Id: Kconfig,v 1.1
5 2004/12/22 17:51:15 joern
Exp $
# $Id: Kconfig,v 1.1
8 2005/11/07 11:14:24 gleixner
Exp $
menu "Self-contained MTD device drivers"
depends on MTD!=n
...
...
@@ -110,7 +110,7 @@ config MTDRAM_ABS_POS
If you have system RAM accessible by the CPU but not used by Linux
in normal operation, you can give the physical address at which the
available RAM starts, and the MTDRAM driver will use it instead of
allocating space from Linux's available memory. Otherwise, leave
allocating space from Linux's available memory. Otherwise, leave
this set to zero. Most people will want to leave this as zero.
config MTD_BLKMTD
...
...
@@ -165,7 +165,7 @@ config MTD_DOC2001
select MTD_DOCPROBE
select MTD_NAND_IDS
---help---
This provides an alternative MTD device driver for the M-Systems
This provides an alternative MTD device driver for the M-Systems
DiskOnChip Millennium devices. Use this if you have problems with
the combined DiskOnChip 2000 and Millennium driver above. To get
the DiskOnChip probe code to load and use this driver instead of
...
...
@@ -192,7 +192,7 @@ config MTD_DOC2001PLUS
If you use this device, you probably also want to enable the INFTL
'Inverse NAND Flash Translation Layer' option below, which is used
to emulate a block device by using a kind of file system on the
to emulate a block device by using a kind of file system on the
flash chips.
NOTE: This driver will soon be replaced by the new DiskOnChip driver
...
...
drivers/mtd/devices/blkmtd.c
浏览文件 @
e5580fbe
/*
* $Id: blkmtd.c,v 1.2
4 2004/11/16 18:29:01 dwmw2
Exp $
* $Id: blkmtd.c,v 1.2
7 2005/11/07 11:14:24 gleixner
Exp $
*
* blkmtd.c - use a block device as a fake MTD
*
...
...
@@ -39,7 +39,7 @@
/* Default erase size in K, always make it a multiple of PAGE_SIZE */
#define CONFIG_MTD_BLKDEV_ERASESIZE (128 << 10)
/* 128KiB */
#define VERSION "$Revision: 1.2
4
$"
#define VERSION "$Revision: 1.2
7
$"
/* Info for the block device */
struct
blkmtd_dev
{
...
...
@@ -117,7 +117,7 @@ static int bi_write_complete(struct bio *bio, unsigned int bytes_done, int error
unlock_page
(
page
);
page_cache_release
(
page
);
}
while
(
bvec
>=
bio
->
bi_io_vec
);
complete
((
struct
completion
*
)
bio
->
bi_private
);
return
0
;
}
...
...
@@ -135,7 +135,7 @@ static int blkmtd_readpage(struct blkmtd_dev *dev, struct page *page)
unlock_page
(
page
);
return
0
;
}
ClearPageUptodate
(
page
);
ClearPageError
(
page
);
...
...
@@ -710,7 +710,7 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size
dev
->
mtd_info
.
erasesize
>>
10
,
readonly
?
"(read-only)"
:
""
);
}
return
dev
;
devinit_err:
...
...
drivers/mtd/devices/block2mtd.c
浏览文件 @
e5580fbe
/*
* $Id: block2mtd.c,v 1.2
8 2005/03/19 22:40:4
4 gleixner Exp $
* $Id: block2mtd.c,v 1.2
9 2005/11/07 11:14:2
4 gleixner Exp $
*
* block2mtd.c - create an mtd from a block device
*
...
...
@@ -19,7 +19,7 @@
#include <linux/mtd/mtd.h>
#include <linux/buffer_head.h>
#define VERSION "$Revision: 1.2
8
$"
#define VERSION "$Revision: 1.2
9
$"
#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
...
...
@@ -111,7 +111,7 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
return
PTR_ERR
(
page
);
max
=
(
u_long
*
)
page_address
(
page
)
+
PAGE_SIZE
;
for
(
p
=
(
u_long
*
)
page_address
(
page
);
p
<
max
;
p
++
)
for
(
p
=
(
u_long
*
)
page_address
(
page
);
p
<
max
;
p
++
)
if
(
*
p
!=
-
1UL
)
{
lock_page
(
page
);
memset
(
page_address
(
page
),
0xff
,
PAGE_SIZE
);
...
...
@@ -206,7 +206,7 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
if
(
retlen
)
*
retlen
=
0
;
while
(
len
)
{
if
((
offset
+
len
)
>
PAGE_SIZE
)
if
((
offset
+
len
)
>
PAGE_SIZE
)
cpylen
=
PAGE_SIZE
-
offset
;
// multiple pages
else
cpylen
=
len
;
// this page
...
...
drivers/mtd/devices/doc2000.c
浏览文件 @
e5580fbe
...
...
@@ -4,7 +4,7 @@
* (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
*
* $Id: doc2000.c,v 1.6
6 2005/01/05 18:05:12 dwmw2
Exp $
* $Id: doc2000.c,v 1.6
7 2005/11/07 11:14:24 gleixner
Exp $
*/
#include <linux/kernel.h>
...
...
@@ -58,7 +58,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
size_t
*
retlen
,
u_char
*
buf
,
u_char
*
eccbuf
,
struct
nand_oobinfo
*
oobsel
);
static
int
doc_write_ecc
(
struct
mtd_info
*
mtd
,
loff_t
to
,
size_t
len
,
size_t
*
retlen
,
const
u_char
*
buf
,
u_char
*
eccbuf
,
struct
nand_oobinfo
*
oobsel
);
static
int
doc_writev_ecc
(
struct
mtd_info
*
mtd
,
const
struct
kvec
*
vecs
,
static
int
doc_writev_ecc
(
struct
mtd_info
*
mtd
,
const
struct
kvec
*
vecs
,
unsigned
long
count
,
loff_t
to
,
size_t
*
retlen
,
u_char
*
eccbuf
,
struct
nand_oobinfo
*
oobsel
);
static
int
doc_read_oob
(
struct
mtd_info
*
mtd
,
loff_t
ofs
,
size_t
len
,
...
...
@@ -76,14 +76,14 @@ static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles)
{
volatile
char
dummy
;
int
i
;
for
(
i
=
0
;
i
<
cycles
;
i
++
)
{
if
(
DoC_is_Millennium
(
doc
))
dummy
=
ReadDOC
(
doc
->
virtadr
,
NOP
);
else
dummy
=
ReadDOC
(
doc
->
virtadr
,
DOCStatus
);
}
}
/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */
...
...
@@ -220,8 +220,8 @@ static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,
WriteDOC
(
ofs
&
0xff
,
docptr
,
WritePipeTerm
);
DoC_Delay
(
doc
,
2
);
/* Needed for some slow flash chips. mf. */
/* FIXME: The SlowIO's for millennium could be replaced by
/* FIXME: The SlowIO's for millennium could be replaced by
a single WritePipeTerm here. mf. */
/* Lower the ALE line */
...
...
@@ -377,9 +377,9 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
if
(
mfr
==
0xff
||
mfr
==
0
)
return
0
;
/* Check it's the same as the first chip we identified.
/* Check it's the same as the first chip we identified.
* M-Systems say that any given DiskOnChip device should only
* contain _one_ type of flash part, although that's not a
* contain _one_ type of flash part, although that's not a
* hardware restriction. */
if
(
doc
->
mfr
)
{
if
(
doc
->
mfr
==
mfr
&&
doc
->
id
==
id
)
...
...
@@ -397,7 +397,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
for
(
j
=
0
;
nand_manuf_ids
[
j
].
id
!=
0x0
;
j
++
)
{
if
(
nand_manuf_ids
[
j
].
id
==
mfr
)
break
;
}
}
printk
(
KERN_INFO
"Flash chip found: Manufacturer ID: %2.2X, "
"Chip ID: %2.2X (%s:%s)
\n
"
,
mfr
,
id
,
...
...
@@ -405,7 +405,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
if
(
!
doc
->
mfr
)
{
doc
->
mfr
=
mfr
;
doc
->
id
=
id
;
doc
->
chipshift
=
doc
->
chipshift
=
ffs
((
nand_flash_ids
[
i
].
chipsize
<<
20
))
-
1
;
doc
->
page256
=
(
nand_flash_ids
[
i
].
pagesize
==
256
)
?
1
:
0
;
doc
->
pageadrlen
=
doc
->
chipshift
>
25
?
3
:
2
;
...
...
@@ -467,7 +467,7 @@ static void DoC_ScanChips(struct DiskOnChip *this, int maxchips)
ret
=
0
;
/* Fill out the chip array with {floor, chipno} for each
/* Fill out the chip array with {floor, chipno} for each
* detected chip in the device. */
for
(
floor
=
0
;
floor
<
MAX_FLOORS
;
floor
++
)
{
for
(
chip
=
0
;
chip
<
numchips
[
floor
];
chip
++
)
{
...
...
@@ -757,12 +757,12 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
(
long
)
from
,
eccbuf
[
0
],
eccbuf
[
1
],
eccbuf
[
2
],
eccbuf
[
3
],
eccbuf
[
4
],
eccbuf
[
5
]);
#endif
/* disable the ECC engine */
WriteDOC
(
DOC_ECC_DIS
,
docptr
,
ECCConf
);
}
/* according to 11.4.1, we need to wait for the busy line
/* according to 11.4.1, we need to wait for the busy line
* drop if we read to the end of the page. */
if
(
0
==
((
from
+
len
)
&
0x1ff
))
{
...
...
@@ -941,7 +941,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
/* Let the caller know we completed it */
*
retlen
+=
len
;
if
(
eccbuf
)
{
unsigned
char
x
[
8
];
size_t
dummy
;
...
...
@@ -950,10 +950,10 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
/* Write the ECC data to flash */
for
(
di
=
0
;
di
<
6
;
di
++
)
x
[
di
]
=
eccbuf
[
di
];
x
[
6
]
=
0x55
;
x
[
7
]
=
0x55
;
ret
=
doc_write_oob_nolock
(
mtd
,
to
,
8
,
&
dummy
,
x
);
if
(
ret
)
{
up
(
&
this
->
lock
);
...
...
@@ -970,7 +970,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
return
0
;
}
static
int
doc_writev_ecc
(
struct
mtd_info
*
mtd
,
const
struct
kvec
*
vecs
,
static
int
doc_writev_ecc
(
struct
mtd_info
*
mtd
,
const
struct
kvec
*
vecs
,
unsigned
long
count
,
loff_t
to
,
size_t
*
retlen
,
u_char
*
eccbuf
,
struct
nand_oobinfo
*
oobsel
)
{
...
...
@@ -1022,7 +1022,7 @@ static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
break
;
to
+=
thislen
;
}
}
up
(
&
writev_buf_sem
);
*
retlen
=
totretlen
;
...
...
@@ -1080,7 +1080,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
/* Reading the full OOB data drops us off of the end of the page,
* causing the flash device to go into busy mode, so we need
* to wait until ready 11.4.1 and Toshiba TC58256FT docs */
ret
=
DoC_WaitReady
(
this
);
up
(
&
this
->
lock
);
...
...
@@ -1190,7 +1190,7 @@ static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,
return
0
;
}
static
int
doc_write_oob
(
struct
mtd_info
*
mtd
,
loff_t
ofs
,
size_t
len
,
size_t
*
retlen
,
const
u_char
*
buf
)
{
...
...
@@ -1222,7 +1222,7 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
}
instr
->
state
=
MTD_ERASING
;
/* FIXME: Do this in the background. Use timers or schedule_task() */
while
(
len
)
{
mychip
=
&
this
->
chips
[
ofs
>>
this
->
chipshift
];
...
...
drivers/mtd/devices/doc2001.c
浏览文件 @
e5580fbe
...
...
@@ -4,7 +4,7 @@
* (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
*
* $Id: doc2001.c,v 1.4
8 2005/01/05 18:05:12 dwmw2
Exp $
* $Id: doc2001.c,v 1.4
9 2005/11/07 11:14:24 gleixner
Exp $
*/
#include <linux/kernel.h>
...
...
@@ -196,10 +196,10 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
DoC_Command
(
doc
->
virtadr
,
NAND_CMD_RESET
,
CDSN_CTRL_WP
);
DoC_WaitReady
(
doc
->
virtadr
);
/* Read the NAND chip ID: 1. Send ReadID command */
/* Read the NAND chip ID: 1. Send ReadID command */
DoC_Command
(
doc
->
virtadr
,
NAND_CMD_READID
,
CDSN_CTRL_WP
);
/* Read the NAND chip ID: 2. Send address byte zero */
/* Read the NAND chip ID: 2. Send address byte zero */
DoC_Address
(
doc
->
virtadr
,
1
,
0x00
,
CDSN_CTRL_WP
,
0x00
);
/* Read the manufacturer and device id codes of the flash device through
...
...
@@ -223,7 +223,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
for
(
j
=
0
;
nand_manuf_ids
[
j
].
id
!=
0x0
;
j
++
)
{
if
(
nand_manuf_ids
[
j
].
id
==
mfr
)
break
;
}
}
printk
(
KERN_INFO
"Flash chip found: Manufacturer ID: %2.2X, "
"Chip ID: %2.2X (%s:%s)
\n
"
,
mfr
,
id
,
nand_manuf_ids
[
j
].
name
,
nand_flash_ids
[
i
].
name
);
...
...
@@ -275,7 +275,7 @@ static void DoC_ScanChips(struct DiskOnChip *this)
return
;
}
/* Fill out the chip array with {floor, chipno} for each
/* Fill out the chip array with {floor, chipno} for each
* detected chip in the device. */
for
(
floor
=
0
,
ret
=
0
;
floor
<
MAX_FLOORS_MIL
;
floor
++
)
{
for
(
chip
=
0
;
chip
<
numchips
[
floor
]
;
chip
++
)
{
...
...
@@ -309,7 +309,7 @@ static int DoCMil_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2)
tmp2
=
ReadDOC
(
doc2
->
virtadr
,
AliasResolution
);
if
(
tmp1
!=
tmp2
)
return
0
;
WriteDOC
((
tmp1
+
1
)
%
0xff
,
doc1
->
virtadr
,
AliasResolution
);
tmp2
=
ReadDOC
(
doc2
->
virtadr
,
AliasResolution
);
if
(
tmp2
==
(
tmp1
+
1
)
%
0xff
)
...
...
@@ -425,7 +425,7 @@ static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
return
-
EINVAL
;
/* Don't allow a single read to cross a 512-byte block boundary */
if
(
from
+
len
>
((
from
|
0x1ff
)
+
1
))
if
(
from
+
len
>
((
from
|
0x1ff
)
+
1
))
len
=
((
from
|
0x1ff
)
+
1
)
-
from
;
/* Find the chip which is to be used and select it */
...
...
@@ -552,7 +552,7 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
#if 0
/* Don't allow a single write to cross a 512-byte block boundary */
if (to + len > ( (to | 0x1ff) + 1))
if (to + len > ( (to | 0x1ff) + 1))
len = ((to | 0x1ff) + 1) - to;
#else
/* Don't allow writes which aren't exactly one block */
...
...
@@ -632,7 +632,7 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
/* write the block status BLOCK_USED (0x5555) at the end of ECC data
FIXME: this is only a hack for programming the IPL area for LinuxBIOS
and should be replace with proper codes in user space utilities */
and should be replace with proper codes in user space utilities */
WriteDOC
(
0x55
,
docptr
,
Mil_CDSN_IO
);
WriteDOC
(
0x55
,
docptr
,
Mil_CDSN_IO
+
1
);
...
...
@@ -802,7 +802,7 @@ int doc_erase (struct mtd_info *mtd, struct erase_info *instr)
void
__iomem
*
docptr
=
this
->
virtadr
;
struct
Nand
*
mychip
=
&
this
->
chips
[
ofs
>>
this
->
chipshift
];
if
(
len
!=
mtd
->
erasesize
)
if
(
len
!=
mtd
->
erasesize
)
printk
(
KERN_WARNING
"Erase not right size (%x != %x)n"
,
len
,
mtd
->
erasesize
);
...
...
@@ -870,9 +870,9 @@ static void __exit cleanup_doc2001(void)
while
((
mtd
=
docmillist
))
{
this
=
mtd
->
priv
;
docmillist
=
this
->
nextdoc
;
del_mtd_device
(
mtd
);
iounmap
(
this
->
virtadr
);
kfree
(
this
->
chips
);
kfree
(
mtd
);
...
...
drivers/mtd/devices/doc2001plus.c
浏览文件 @
e5580fbe
...
...
@@ -6,7 +6,7 @@
* (c) 1999 Machine Vision Holdings, Inc.
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
*
* $Id: doc2001plus.c,v 1.1
3 2005/01/05 18:05:12 dwmw2
Exp $
* $Id: doc2001plus.c,v 1.1
4 2005/11/07 11:14:24 gleixner
Exp $
*
* Released under GPL
*/
...
...
@@ -293,10 +293,10 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
DoC_Command
(
docptr
,
NAND_CMD_RESET
,
0
);
DoC_WaitReady
(
docptr
);
/* Read the NAND chip ID: 1. Send ReadID command */
/* Read the NAND chip ID: 1. Send ReadID command */
DoC_Command
(
docptr
,
NAND_CMD_READID
,
0
);
/* Read the NAND chip ID: 2. Send address byte zero */
/* Read the NAND chip ID: 2. Send address byte zero */
DoC_Address
(
doc
,
1
,
0x00
,
0
,
0x00
);
WriteDOC
(
0
,
docptr
,
Mplus_FlashControl
);
...
...
@@ -365,7 +365,7 @@ static void DoC_ScanChips(struct DiskOnChip *this)
this
->
interleave
=
1
;
/* Check the ASIC agrees */
if
(
(
this
->
interleave
<<
2
)
!=
if
(
(
this
->
interleave
<<
2
)
!=
(
ReadDOC
(
this
->
virtadr
,
Mplus_Configuration
)
&
4
))
{
u_char
conf
=
ReadDOC
(
this
->
virtadr
,
Mplus_Configuration
);
printk
(
KERN_NOTICE
"Setting DiskOnChip Millennium Plus interleave to %s
\n
"
,
...
...
@@ -398,7 +398,7 @@ static void DoC_ScanChips(struct DiskOnChip *this)
return
;
}
/* Fill out the chip array with {floor, chipno} for each
/* Fill out the chip array with {floor, chipno} for each
* detected chip in the device. */
for
(
floor
=
0
,
ret
=
0
;
floor
<
MAX_FLOORS_MPLUS
;
floor
++
)
{
for
(
chip
=
0
;
chip
<
numchips
[
floor
]
;
chip
++
)
{
...
...
@@ -432,7 +432,7 @@ static int DoCMilPlus_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2)
tmp2
=
ReadDOC
(
doc2
->
virtadr
,
Mplus_AliasResolution
);
if
(
tmp1
!=
tmp2
)
return
0
;
WriteDOC
((
tmp1
+
1
)
%
0xff
,
doc1
->
virtadr
,
Mplus_AliasResolution
);
tmp2
=
ReadDOC
(
doc2
->
virtadr
,
Mplus_AliasResolution
);
if
(
tmp2
==
(
tmp1
+
1
)
%
0xff
)
...
...
@@ -624,7 +624,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
return
-
EINVAL
;
/* Don't allow a single read to cross a 512-byte block boundary */
if
(
from
+
len
>
((
from
|
0x1ff
)
+
1
))
if
(
from
+
len
>
((
from
|
0x1ff
)
+
1
))
len
=
((
from
|
0x1ff
)
+
1
)
-
from
;
DoC_CheckASIC
(
docptr
);
...
...
@@ -1066,7 +1066,7 @@ int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
DoC_CheckASIC
(
docptr
);
if
(
len
!=
mtd
->
erasesize
)
if
(
len
!=
mtd
->
erasesize
)
printk
(
KERN_WARNING
"MTD: Erase not right size (%x != %x)n"
,
len
,
mtd
->
erasesize
);
...
...
@@ -1136,9 +1136,9 @@ static void __exit cleanup_doc2001plus(void)
while
((
mtd
=
docmilpluslist
))
{
this
=
mtd
->
priv
;
docmilpluslist
=
this
->
nextdoc
;
del_mtd_device
(
mtd
);
iounmap
(
this
->
virtadr
);
kfree
(
this
->
chips
);
kfree
(
mtd
);
...
...
drivers/mtd/devices/docecc.c
浏览文件 @
e5580fbe
...
...
@@ -4,10 +4,10 @@
* GNU GPL License. The rest is simply to convert the disk on chip
* syndrom into a standard syndom.
*
* Author: Fabrice Bellard (fabrice.bellard@netgem.com)
* Author: Fabrice Bellard (fabrice.bellard@netgem.com)
* Copyright (C) 2000 Netgem S.A.
*
* $Id: docecc.c,v 1.
5 2003/05/21 15:15:06 dwmw2
Exp $
* $Id: docecc.c,v 1.
7 2005/11/07 11:14:25 gleixner
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
...
...
@@ -122,7 +122,7 @@ for(ci=(n)-1;ci >=0;ci--)\
a(0) + a(1) @ + a(2) @^2 + ... + a(m-1) @^(m-1)
we consider the integer "i" whose binary representation with a(0) being LSB
and a(m-1) MSB is (a(0),a(1),...,a(m-1)) and locate the entry
"index_of[i]". Now, @^index_of[i] is that element whose polynomial
"index_of[i]". Now, @^index_of[i] is that element whose polynomial
representation is (a(0),a(1),a(2),...,a(m-1)).
NOTE:
The element alpha_to[2^m-1] = 0 always signifying that the
...
...
@@ -130,7 +130,7 @@ for(ci=(n)-1;ci >=0;ci--)\
Similarily, the element index_of[0] = A0 always signifying
that the power of alpha which has the polynomial representation
(0,0,...,0) is "infinity".
*/
static
void
...
...
@@ -176,7 +176,7 @@ generate_gf(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1])
* are written back. NOTE! This array must be at least NN-KK elements long.
* The corrected data are written in eras_val[]. They must be xor with the data
* to retrieve the correct data : data[erase_pos[i]] ^= erase_val[i] .
*
*
* First "no_eras" erasures are declared by the calling program. Then, the
* maximum # of errors correctable is t_after_eras = floor((NN-KK-no_eras)/2).
* If the number of channel errors is not greater than "t_after_eras" the
...
...
@@ -189,7 +189,7 @@ generate_gf(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1])
* */
static
int
eras_dec_rs
(
dtype
Alpha_to
[
NN
+
1
],
dtype
Index_of
[
NN
+
1
],
gf
bb
[
NN
-
KK
+
1
],
gf
eras_val
[
NN
-
KK
],
int
eras_pos
[
NN
-
KK
],
gf
bb
[
NN
-
KK
+
1
],
gf
eras_val
[
NN
-
KK
],
int
eras_pos
[
NN
-
KK
],
int
no_eras
)
{
int
deg_lambda
,
el
,
deg_omega
;
...
...
@@ -212,7 +212,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
count
=
0
;
goto
finish
;
}
for
(
i
=
1
;
i
<=
NN
-
KK
;
i
++
){
s
[
i
]
=
bb
[
0
];
}
...
...
@@ -220,7 +220,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
if
(
bb
[
j
]
==
0
)
continue
;
tmp
=
Index_of
[
bb
[
j
]];
for
(
i
=
1
;
i
<=
NN
-
KK
;
i
++
)
s
[
i
]
^=
Alpha_to
[
modnn
(
tmp
+
(
B0
+
i
-
1
)
*
PRIM
*
j
)];
}
...
...
@@ -234,7 +234,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
tmp
=
modnn
(
tmp
+
2
*
KK
*
(
B0
+
i
-
1
)
*
PRIM
);
s
[
i
]
=
tmp
;
}
CLEAR
(
&
lambda
[
1
],
NN
-
KK
);
lambda
[
0
]
=
1
;
...
...
@@ -252,7 +252,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
#if DEBUG_ECC >= 1
/* Test code that verifies the erasure locator polynomial just constructed
Needed only for decoder debugging. */
/* find roots of the erasure location polynomial */
for
(
i
=
1
;
i
<=
no_eras
;
i
++
)
reg
[
i
]
=
Index_of
[
lambda
[
i
]];
...
...
@@ -286,7 +286,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
}
for
(
i
=
0
;
i
<
NN
-
KK
+
1
;
i
++
)
b
[
i
]
=
Index_of
[
lambda
[
i
]];
/*
* Begin Berlekamp-Massey algorithm to determine error+erasure
* locator polynomial
...
...
@@ -389,7 +389,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
omega
[
i
]
=
Index_of
[
tmp
];
}
omega
[
NN
-
KK
]
=
A0
;
/*
* Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
* inv(X(l))**(B0-1) and den = lambda_pr(inv(X(l))) all in poly-form
...
...
@@ -402,7 +402,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
}
num2
=
Alpha_to
[
modnn
(
root
[
j
]
*
(
B0
-
1
)
+
NN
)];
den
=
0
;
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
for
(
i
=
min
(
deg_lambda
,
NN
-
KK
-
1
)
&
~
1
;
i
>=
0
;
i
-=
2
)
{
if
(
lambda
[
i
+
1
]
!=
A0
)
...
...
@@ -436,11 +436,11 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
/* The sector bytes are packed into NB_DATA MM bits words */
#define NB_DATA (((SECTOR_SIZE + 1) * 8 + 6) / MM)
/*
/*
* Correct the errors in 'sector[]' by using 'ecc1[]' which is the
* content of the feedback shift register applyied to the sector and
* the ECC. Return the number of errors corrected (and correct them in
* sector), or -1 if error
* sector), or -1 if error
*/
int
doc_decode_ecc
(
unsigned
char
sector
[
SECTOR_SIZE
],
unsigned
char
ecc1
[
6
])
{
...
...
@@ -454,7 +454,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
Alpha_to
=
kmalloc
((
NN
+
1
)
*
sizeof
(
dtype
),
GFP_KERNEL
);
if
(
!
Alpha_to
)
return
-
1
;
Index_of
=
kmalloc
((
NN
+
1
)
*
sizeof
(
dtype
),
GFP_KERNEL
);
if
(
!
Index_of
)
{
kfree
(
Alpha_to
);
...
...
@@ -470,7 +470,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
bb
[
2
]
=
((
ecc1
[
2
]
&
0xf0
)
>>
4
)
|
((
ecc1
[
3
]
&
0x3f
)
<<
4
);
bb
[
3
]
=
((
ecc1
[
3
]
&
0xc0
)
>>
6
)
|
((
ecc1
[
0
]
&
0xff
)
<<
2
);
nb_errors
=
eras_dec_rs
(
Alpha_to
,
Index_of
,
bb
,
nb_errors
=
eras_dec_rs
(
Alpha_to
,
Index_of
,
bb
,
error_val
,
error_pos
,
0
);
if
(
nb_errors
<=
0
)
goto
the_end
;
...
...
@@ -489,7 +489,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
can be modified since pos is even */
index
=
(
pos
>>
3
)
^
1
;
bitpos
=
pos
&
7
;
if
((
index
>=
0
&&
index
<
SECTOR_SIZE
)
||
if
((
index
>=
0
&&
index
<
SECTOR_SIZE
)
||
index
==
(
SECTOR_SIZE
+
1
))
{
val
=
error_val
[
i
]
>>
(
2
+
bitpos
);
parity
^=
val
;
...
...
@@ -500,7 +500,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
bitpos
=
(
bitpos
+
10
)
&
7
;
if
(
bitpos
==
0
)
bitpos
=
8
;
if
((
index
>=
0
&&
index
<
SECTOR_SIZE
)
||
if
((
index
>=
0
&&
index
<
SECTOR_SIZE
)
||
index
==
(
SECTOR_SIZE
+
1
))
{
val
=
error_val
[
i
]
<<
(
8
-
bitpos
);
parity
^=
val
;
...
...
@@ -509,7 +509,7 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
}
}
}
/* use parity to test extra errors */
if
((
parity
&
0xff
)
!=
0
)
nb_errors
=
-
1
;
...
...
drivers/mtd/devices/docprobe.c
浏览文件 @
e5580fbe
...
...
@@ -4,22 +4,22 @@
/* (C) 1999 Machine Vision Holdings, Inc. */
/* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */
/* $Id: docprobe.c,v 1.4
4 2005/01/05 12:40:36 dwmw2
Exp $ */
/* $Id: docprobe.c,v 1.4
6 2005/11/07 11:14:25 gleixner
Exp $ */
/* DOC_PASSIVE_PROBE:
In order to ensure that the BIOS checksum is correct at boot time, and
hence that the onboard BIOS extension gets executed, the DiskOnChip
goes into reset mode when it is read sequentially: all registers
return 0xff until the chip is woken up again by writing to the
DOCControl register.
Unfortunately, this means that the probe for the DiskOnChip is unsafe,
because one of the first things it does is write to where it thinks
the DOCControl register should be - which may well be shared memory
for another device. I've had machines which lock up when this is
attempted. Hence the possibility to do a passive probe, which will fail
In order to ensure that the BIOS checksum is correct at boot time, and
hence that the onboard BIOS extension gets executed, the DiskOnChip
goes into reset mode when it is read sequentially: all registers
return 0xff until the chip is woken up again by writing to the
DOCControl register.
Unfortunately, this means that the probe for the DiskOnChip is unsafe,
because one of the first things it does is write to where it thinks
the DOCControl register should be - which may well be shared memory
for another device. I've had machines which lock up when this is
attempted. Hence the possibility to do a passive probe, which will fail
to detect a chip in reset mode, but is at least guaranteed not to lock
the machine.
...
...
@@ -33,9 +33,9 @@
The old Millennium-only driver has been retained just in case there
are problems with the new code. If the combined driver doesn't work
for you, you can try the old one by undefining DOC_SINGLE_DRIVER
for you, you can try the old one by undefining DOC_SINGLE_DRIVER
below and also enabling it in your configuration. If this fixes the
problems, please send a report to the MTD mailing list at
problems, please send a report to the MTD mailing list at
<linux-mtd@lists.infradead.org>.
*/
#define DOC_SINGLE_DRIVER
...
...
@@ -68,16 +68,16 @@ MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe
static
unsigned
long
__initdata
doc_locations
[]
=
{
#if defined (__alpha__) || defined(__i386__) || defined(__x86_64__)
#ifdef CONFIG_MTD_DOCPROBE_HIGH
0xfffc8000
,
0xfffca000
,
0xfffcc000
,
0xfffce000
,
0xfffc8000
,
0xfffca000
,
0xfffcc000
,
0xfffce000
,
0xfffd0000
,
0xfffd2000
,
0xfffd4000
,
0xfffd6000
,
0xfffd8000
,
0xfffda000
,
0xfffdc000
,
0xfffde000
,
0xfffe0000
,
0xfffe2000
,
0xfffe4000
,
0xfffe6000
,
0xfffd8000
,
0xfffda000
,
0xfffdc000
,
0xfffde000
,
0xfffe0000
,
0xfffe2000
,
0xfffe4000
,
0xfffe6000
,
0xfffe8000
,
0xfffea000
,
0xfffec000
,
0xfffee000
,
#else
/* CONFIG_MTD_DOCPROBE_HIGH */
0xc8000
,
0xca000
,
0xcc000
,
0xce000
,
0xc8000
,
0xca000
,
0xcc000
,
0xce000
,
0xd0000
,
0xd2000
,
0xd4000
,
0xd6000
,
0xd8000
,
0xda000
,
0xdc000
,
0xde000
,
0xe0000
,
0xe2000
,
0xe4000
,
0xe6000
,
0xd8000
,
0xda000
,
0xdc000
,
0xde000
,
0xe0000
,
0xe2000
,
0xe4000
,
0xe6000
,
0xe8000
,
0xea000
,
0xec000
,
0xee000
,
#endif
/* CONFIG_MTD_DOCPROBE_HIGH */
#elif defined(__PPC__)
...
...
@@ -111,35 +111,35 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
return
0
;
#endif
/* CONFIG_MTD_DOCPROBE_55AA */
#ifndef DOC_PASSIVE_PROBE
#ifndef DOC_PASSIVE_PROBE
/* It's not possible to cleanly detect the DiskOnChip - the
* bootup procedure will put the device into reset mode, and
* it's not possible to talk to it without actually writing
* to the DOCControl register. So we store the current contents
* of the DOCControl register's location, in case we later decide
* that it's not a DiskOnChip, and want to put it back how we
* found it.
* found it.
*/
tmp2
=
ReadDOC
(
window
,
DOCControl
);
/* Reset the DiskOnChip ASIC */
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_RESET
,
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_RESET
,
window
,
DOCControl
);
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_RESET
,
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_RESET
,
window
,
DOCControl
);
/* Enable the DiskOnChip ASIC */
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_NORMAL
,
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_NORMAL
,
window
,
DOCControl
);
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_NORMAL
,
WriteDOC
(
DOC_MODE_CLR_ERR
|
DOC_MODE_MDWREN
|
DOC_MODE_NORMAL
,
window
,
DOCControl
);
#endif
/* !DOC_PASSIVE_PROBE */
#endif
/* !DOC_PASSIVE_PROBE */
/* We need to read the ChipID register four times. For some
newer DiskOnChip 2000 units, the first three reads will
return the DiskOnChip Millennium ident. Don't ask. */
ChipID
=
ReadDOC
(
window
,
ChipID
);
switch
(
ChipID
)
{
case
DOC_ChipID_Doc2k
:
/* Check the TOGGLE bit in the ECC register */
...
...
@@ -149,7 +149,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
if
(
tmp
!=
tmpb
&&
tmp
==
tmpc
)
return
ChipID
;
break
;
case
DOC_ChipID_DocMil
:
/* Check for the new 2000 with Millennium ASIC */
ReadDOC
(
window
,
ChipID
);
...
...
@@ -164,7 +164,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
if
(
tmp
!=
tmpb
&&
tmp
==
tmpc
)
return
ChipID
;
break
;
case
DOC_ChipID_DocMilPlus16
:
case
DOC_ChipID_DocMilPlus32
:
case
0
:
...
...
@@ -179,7 +179,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
DOC_MODE_BDECT
;
WriteDOC
(
tmp
,
window
,
Mplus_DOCControl
);
WriteDOC
(
~
tmp
,
window
,
Mplus_CtrlConfirm
);
mdelay
(
1
);
/* Enable the DiskOnChip ASIC */
tmp
=
DOC_MODE_NORMAL
|
DOC_MODE_MDWREN
|
DOC_MODE_RST_LAT
|
...
...
@@ -187,7 +187,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
WriteDOC
(
tmp
,
window
,
Mplus_DOCControl
);
WriteDOC
(
~
tmp
,
window
,
Mplus_CtrlConfirm
);
mdelay
(
1
);
#endif
/* !DOC_PASSIVE_PROBE */
#endif
/* !DOC_PASSIVE_PROBE */
ChipID
=
ReadDOC
(
window
,
ChipID
);
...
...
@@ -227,7 +227,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr
WriteDOC
(
tmp2
,
window
,
DOCControl
);
#endif
return
0
;
}
}
static
int
docfound
;
...
...
@@ -244,10 +244,10 @@ static void __init DoC_Probe(unsigned long physadr)
void
(
*
initroutine
)(
struct
mtd_info
*
)
=
NULL
;
docptr
=
ioremap
(
physadr
,
DOC_IOREMAP_LEN
);
if
(
!
docptr
)
return
;
if
((
ChipID
=
doccheck
(
docptr
,
physadr
)))
{
if
(
ChipID
==
DOC_ChipID_Doc2kTSOP
)
{
/* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */
...
...
@@ -263,9 +263,9 @@ static void __init DoC_Probe(unsigned long physadr)
iounmap
(
docptr
);
return
;
}
this
=
(
struct
DiskOnChip
*
)(
&
mtd
[
1
]);
memset
((
char
*
)
mtd
,
0
,
sizeof
(
struct
mtd_info
));
memset
((
char
*
)
this
,
0
,
sizeof
(
struct
DiskOnChip
));
...
...
@@ -281,13 +281,13 @@ static void __init DoC_Probe(unsigned long physadr)
im_funcname
=
"DoC2k_init"
;
im_modname
=
"doc2000"
;
break
;
case
DOC_ChipID_Doc2k
:
name
=
"2000"
;
im_funcname
=
"DoC2k_init"
;
im_modname
=
"doc2000"
;
break
;
case
DOC_ChipID_DocMil
:
name
=
"Millennium"
;
#ifdef DOC_SINGLE_DRIVER
...
...
@@ -331,7 +331,7 @@ static void __init DoC_Probe(unsigned long physadr)
static
int
__init
init_doc
(
void
)
{
int
i
;
if
(
doc_config_location
)
{
printk
(
KERN_INFO
"Using configured DiskOnChip probe address 0x%lx
\n
"
,
doc_config_location
);
DoC_Probe
(
doc_config_location
);
...
...
drivers/mtd/devices/lart.c
浏览文件 @
e5580fbe
...
...
@@ -2,7 +2,7 @@
/*
* MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART.
*
* $Id: lart.c,v 1.
7 2004/08/09 13:19:44 dwmw2
Exp $
* $Id: lart.c,v 1.
9 2005/11/07 11:14:25 gleixner
Exp $
*
* Author: Abraham vd Merwe <abraham@2d3d.co.za>
*
...
...
@@ -122,7 +122,7 @@ static char module_name[] = "lart";
/*
* The data line mapping on LART is as follows:
*
*
* U2 CPU | U3 CPU
* -------------------
* 0 20 | 0 12
...
...
@@ -181,7 +181,7 @@ static char module_name[] = "lart";
(((x) & 0x00004000) >> 13) \
)
/*
/*
* The address line mapping on LART is as follows:
*
* U3 CPU | U2 CPU
...
...
@@ -204,7 +204,7 @@ static char module_name[] = "lart";
* 12 15 | 12 15
* 13 14 | 13 14
* 14 16 | 14 16
*
*
* MAIN BLOCK BOUNDARY
*
* 15 17 | 15 18
...
...
drivers/mtd/devices/phram.c
浏览文件 @
e5580fbe
/**
* $Id: phram.c,v 1.1
4 2005/03/07 21:43:38 joern
Exp $
* $Id: phram.c,v 1.1
6 2005/11/07 11:14:25 gleixner
Exp $
*
* Copyright (c) ???? Jochen Schuble <psionic@psionic.de>
* Copyright (c) 2003-2004 Jrn Engel <joern@wh.fh-wedel.de>
...
...
@@ -41,10 +41,10 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
if
(
instr
->
addr
+
instr
->
len
>
mtd
->
size
)
return
-
EINVAL
;
memset
(
start
+
instr
->
addr
,
0xff
,
instr
->
len
);
/* This'll catch a few races. Free the thing before returning :)
/* This'll catch a few races. Free the thing before returning :)
* I don't feel at all ashamed. This kind of thing is possible anyway
* with flash, but unlikely.
*/
...
...
@@ -63,7 +63,7 @@ static int phram_point(struct mtd_info *mtd, loff_t from, size_t len,
if
(
from
+
len
>
mtd
->
size
)
return
-
EINVAL
;
*
mtdbuf
=
start
+
from
;
*
retlen
=
len
;
return
0
;
...
...
@@ -84,7 +84,7 @@ static int phram_read(struct mtd_info *mtd, loff_t from, size_t len,
if
(
len
>
mtd
->
size
-
from
)
len
=
mtd
->
size
-
from
;
memcpy
(
buf
,
start
+
from
,
len
);
*
retlen
=
len
;
...
...
@@ -101,7 +101,7 @@ static int phram_write(struct mtd_info *mtd, loff_t to, size_t len,
if
(
len
>
mtd
->
size
-
to
)
len
=
mtd
->
size
-
to
;
memcpy
(
start
+
to
,
buf
,
len
);
*
retlen
=
len
;
...
...
@@ -159,7 +159,7 @@ static int register_device(char *name, unsigned long start, unsigned long len)
}
list_add_tail
(
&
new
->
list
,
&
phram_list
);
return
0
;
return
0
;
out2:
iounmap
(
new
->
mtd
.
priv
);
...
...
drivers/mtd/devices/pmc551.c
浏览文件 @
e5580fbe
/*
* $Id: pmc551.c,v 1.3
0 2005/01/05 18:05:13 dwmw2
Exp $
* $Id: pmc551.c,v 1.3
2 2005/11/07 11:14:25 gleixner
Exp $
*
* PMC551 PCI Mezzanine Ram Device
*
...
...
@@ -27,7 +27,7 @@
* it as high speed swap or for a high speed disk device of some
* sort. Which becomes very useful on diskless systems in the
* embedded market I might add.
*
*
* Notes:
* Due to what I assume is more buggy SROM, the 64M PMC551 I
* have available claims that all 4 of it's DRAM banks have 64M
...
...
@@ -63,10 +63,10 @@
* Minyard set up the card to utilize a 1M sliding apature.
*
* Corey Minyard <minyard@nortelnetworks.com>
* * Modified driver to utilize a sliding aperture instead of
* * Modified driver to utilize a sliding aperture instead of
* mapping all memory into kernel space which turned out to
* be very wasteful.
* * Located a bug in the SROM's initialization sequence that
* * Located a bug in the SROM's initialization sequence that
* made the memory unusable, added a fix to code to touch up
* the DRAM some.
*
...
...
@@ -390,7 +390,7 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
bcmd
|=
(
0x40
|
0x20
);
pci_write_config_byte
(
dev
,
PMC551_SYS_CTRL_REG
,
bcmd
);
/*
/*
* Take care and turn off the memory on the device while we
* tweak the configurations
*/
...
...
@@ -408,7 +408,7 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
* Grab old BAR0 config so that we can figure out memory size
* This is another bit of kludge going on. The reason for the
* redundancy is I am hoping to retain the original configuration
* previously assigned to the card by the BIOS or some previous
* previously assigned to the card by the BIOS or some previous
* fixup routine in the kernel. So we read the old config into cfg,
* then write all 1's to the memory space, read back the result into
* "size", and then write back all the old config.
...
...
@@ -480,7 +480,7 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
}
while
(
(
PCI_COMMAND_IO
)
&
cmd
);
/*
* Turn on auto refresh
* Turn on auto refresh
* The loop is taken directly from Ramix's example code. I assume that
* this must be held high for some duration of time, but I can find no
* documentation refrencing the reasons why.
...
...
@@ -615,7 +615,7 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
pci_read_config_byte
(
dev
,
PMC551_SYS_CTRL_REG
,
&
bcmd
);
printk
(
KERN_DEBUG
"pmc551: EEPROM is under %s control
\n
"
"pmc551: System Control Register is %slocked to PCI access
\n
"
"pmc551: System Control Register is %slocked to EEPROM access
\n
"
,
"pmc551: System Control Register is %slocked to EEPROM access
\n
"
,
(
bcmd
&
0x1
)
?
"software"
:
"hardware"
,
(
bcmd
&
0x20
)
?
""
:
"un"
,
(
bcmd
&
0x40
)
?
""
:
"un"
);
#endif
...
...
@@ -744,7 +744,7 @@ static int __init init_pmc551(void)
priv
->
start
=
ioremap
(((
PCI_Device
->
resource
[
0
].
start
)
&
PCI_BASE_ADDRESS_MEM_MASK
),
priv
->
asize
);
if
(
!
priv
->
start
)
{
printk
(
KERN_NOTICE
"pmc551: Unable to map IO space
\n
"
);
kfree
(
mtd
->
priv
);
...
...
@@ -765,7 +765,7 @@ static int __init init_pmc551(void)
priv
->
curr_map0
);
#ifdef CONFIG_MTD_PMC551_DEBUG
printk
(
KERN_DEBUG
"pmc551: aperture set to %d
\n
"
,
printk
(
KERN_DEBUG
"pmc551: aperture set to %d
\n
"
,
(
priv
->
base_map0
&
0xF0
)
>>
4
);
#endif
...
...
@@ -823,13 +823,13 @@ static void __exit cleanup_pmc551(void)
while
((
mtd
=
pmc551list
))
{
priv
=
mtd
->
priv
;
pmc551list
=
priv
->
nextpmc551
;
if
(
priv
->
start
)
{
printk
(
KERN_DEBUG
"pmc551: unmapping %dM starting at 0x%p
\n
"
,
priv
->
asize
>>
20
,
priv
->
start
);
iounmap
(
priv
->
start
);
}
kfree
(
mtd
->
priv
);
del_mtd_device
(
mtd
);
kfree
(
mtd
);
...
...
drivers/mtd/devices/slram.c
浏览文件 @
e5580fbe
/*======================================================================
$Id: slram.c,v 1.3
4 2005/01/06 21:16:42 jwboy
er Exp $
$Id: slram.c,v 1.3
6 2005/11/07 11:14:25 gleixn
er Exp $
This driver provides a method to access memory not used by the kernel
itself (i.e. if the kernel commandline mem=xxx is used). To actually
...
...
@@ -18,14 +18,14 @@
<start>: start of the memory region, decimal or hex (0xabcdef)
<end/offset>: end of the memory region. It's possible to use +0x1234
to specify the offset instead of the absolute address
NOTE:
With slram it's only possible to map a contigous memory region. Therfore
if there's a device mapped somewhere in the region specified slram will
fail to load (see kernel log if modprobe fails).
-
Jochen Schaeuble <psionic@psionic.de>
======================================================================*/
...
...
@@ -89,10 +89,10 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
if
(
instr
->
addr
+
instr
->
len
>
mtd
->
size
)
{
return
(
-
EINVAL
);
}
memset
(
priv
->
start
+
instr
->
addr
,
0xff
,
instr
->
len
);
/* This'll catch a few races. Free the thing before returning :)
/* This'll catch a few races. Free the thing before returning :)
* I don't feel at all ashamed. This kind of thing is possible anyway
* with flash, but unlikely.
*/
...
...
@@ -170,12 +170,12 @@ static int register_device(char *name, unsigned long start, unsigned long length
}
(
*
curmtd
)
->
mtdinfo
=
kmalloc
(
sizeof
(
struct
mtd_info
),
GFP_KERNEL
);
(
*
curmtd
)
->
next
=
NULL
;
if
((
*
curmtd
)
->
mtdinfo
)
{
memset
((
char
*
)(
*
curmtd
)
->
mtdinfo
,
0
,
sizeof
(
struct
mtd_info
));
(
*
curmtd
)
->
mtdinfo
->
priv
=
kmalloc
(
sizeof
(
slram_priv_t
),
GFP_KERNEL
);
if
(
!
(
*
curmtd
)
->
mtdinfo
->
priv
)
{
kfree
((
*
curmtd
)
->
mtdinfo
);
(
*
curmtd
)
->
mtdinfo
=
NULL
;
...
...
@@ -188,7 +188,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
E
(
"slram: Cannot allocate new MTD device.
\n
"
);
return
(
-
ENOMEM
);
}
if
(
!
(((
slram_priv_t
*
)(
*
curmtd
)
->
mtdinfo
->
priv
)
->
start
=
ioremap
(
start
,
length
)))
{
E
(
"slram: ioremap failed
\n
"
);
...
...
@@ -223,7 +223,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
T
(
"slram: Mapped from 0x%p to 0x%p
\n
"
,
((
slram_priv_t
*
)(
*
curmtd
)
->
mtdinfo
->
priv
)
->
start
,
((
slram_priv_t
*
)(
*
curmtd
)
->
mtdinfo
->
priv
)
->
end
);
return
(
0
);
return
(
0
);
}
static
void
unregister_devices
(
void
)
...
...
@@ -256,7 +256,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength)
char
*
buffer
;
unsigned
long
devstart
;
unsigned
long
devlength
;
if
((
!
devname
)
||
(
!
szstart
)
||
(
!
szlength
))
{
unregister_devices
();
return
(
-
EINVAL
);
...
...
@@ -264,7 +264,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength)
devstart
=
simple_strtoul
(
szstart
,
&
buffer
,
0
);
devstart
=
handle_unit
(
devstart
,
buffer
);
if
(
*
(
szlength
)
!=
'+'
)
{
devlength
=
simple_strtoul
(
szlength
,
&
buffer
,
0
);
devlength
=
handle_unit
(
devlength
,
buffer
)
-
devstart
;
...
...
@@ -278,7 +278,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength)
E
(
"slram: Illegal start / length parameter.
\n
"
);
return
(
-
EINVAL
);
}
if
((
devstart
=
register_device
(
devname
,
devstart
,
devlength
))){
unregister_devices
();
return
((
int
)
devstart
);
...
...
@@ -335,7 +335,7 @@ static int init_slram(void)
}
#else
int
count
;
for
(
count
=
0
;
(
map
[
count
])
&&
(
count
<
SLRAM_MAX_DEVICES_PARAMS
);
count
++
)
{
}
...
...
@@ -350,10 +350,10 @@ static int init_slram(void)
if
(
parse_cmdline
(
devname
,
map
[
i
*
3
+
1
],
map
[
i
*
3
+
2
])
!=
0
)
{
return
(
-
EINVAL
);
}
}
#endif
/* !MODULE */
return
(
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录