Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
e08e56c8
Commit
e08e56c8
authored
Sep 15, 2009
by
Stephen Rothwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'mtd/master'
Conflicts: drivers/mtd/mtdcore.c
parents
cd2423f2
2c78c443
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
147 additions
and
95 deletions
+147
-95
drivers/mtd/afs.c
drivers/mtd/afs.c
+1
-1
drivers/mtd/devices/m25p80.c
drivers/mtd/devices/m25p80.c
+3
-0
drivers/mtd/devices/mtd_dataflash.c
drivers/mtd/devices/mtd_dataflash.c
+2
-2
drivers/mtd/devices/slram.c
drivers/mtd/devices/slram.c
+1
-1
drivers/mtd/maps/physmap_of.c
drivers/mtd/maps/physmap_of.c
+11
-9
drivers/mtd/maps/plat-ram.c
drivers/mtd/maps/plat-ram.c
+1
-1
drivers/mtd/maps/pmcmsp-flash.c
drivers/mtd/maps/pmcmsp-flash.c
+59
-17
drivers/mtd/mtdblock.c
drivers/mtd/mtdblock.c
+1
-1
drivers/mtd/mtdcore.c
drivers/mtd/mtdcore.c
+2
-2
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_base.c
+45
-43
drivers/mtd/onenand/Kconfig
drivers/mtd/onenand/Kconfig
+1
-1
drivers/mtd/onenand/onenand_base.c
drivers/mtd/onenand/onenand_base.c
+10
-10
drivers/mtd/tests/mtd_oobtest.c
drivers/mtd/tests/mtd_oobtest.c
+1
-1
drivers/mtd/tests/mtd_pagetest.c
drivers/mtd/tests/mtd_pagetest.c
+6
-6
include/linux/mtd/onenand_regs.h
include/linux/mtd/onenand_regs.h
+3
-0
No files found.
drivers/mtd/afs.c
View file @
e08e56c8
...
@@ -239,7 +239,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,
...
@@ -239,7 +239,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,
parts
[
idx
].
offset
=
img_ptr
;
parts
[
idx
].
offset
=
img_ptr
;
parts
[
idx
].
mask_flags
=
0
;
parts
[
idx
].
mask_flags
=
0
;
printk
(
" mtd%d: at 0x%08x, %5
dK
B, %8u, %s
\n
"
,
printk
(
" mtd%d: at 0x%08x, %5
lluKi
B, %8u, %s
\n
"
,
idx
,
img_ptr
,
parts
[
idx
].
size
/
1024
,
idx
,
img_ptr
,
parts
[
idx
].
size
/
1024
,
iis
.
imageNumber
,
str
);
iis
.
imageNumber
,
str
);
...
...
drivers/mtd/devices/m25p80.c
View file @
e08e56c8
...
@@ -501,7 +501,10 @@ static struct flash_info __devinitdata m25p_data [] = {
...
@@ -501,7 +501,10 @@ static struct flash_info __devinitdata m25p_data [] = {
{
"at26df321"
,
0x1f4701
,
0
,
64
*
1024
,
64
,
SECT_4K
,
},
{
"at26df321"
,
0x1f4701
,
0
,
64
*
1024
,
64
,
SECT_4K
,
},
/* Macronix */
/* Macronix */
{
"mx25l3205d"
,
0xc22016
,
0
,
64
*
1024
,
64
,
},
{
"mx25l6405d"
,
0xc22017
,
0
,
64
*
1024
,
128
,
},
{
"mx25l12805d"
,
0xc22018
,
0
,
64
*
1024
,
256
,
},
{
"mx25l12805d"
,
0xc22018
,
0
,
64
*
1024
,
256
,
},
{
"mx25l12855e"
,
0xc22618
,
0
,
64
*
1024
,
256
,
},
/* Spansion -- single (large) sector size only, at least
/* Spansion -- single (large) sector size only, at least
* for the chips listed here (without boot sectors).
* for the chips listed here (without boot sectors).
...
...
drivers/mtd/devices/mtd_dataflash.c
View file @
e08e56c8
...
@@ -401,7 +401,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
...
@@ -401,7 +401,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
(
void
)
dataflash_waitready
(
priv
->
spi
);
(
void
)
dataflash_waitready
(
priv
->
spi
);
#ifdef CONFIG_MTD_DATAFLASH_
VERIFY_WRITE
#ifdef CONFIG_MTD_DATAFLASH_
WRITE_VERIFY
/* (3) Compare to Buffer1 */
/* (3) Compare to Buffer1 */
addr
=
pageaddr
<<
priv
->
page_offset
;
addr
=
pageaddr
<<
priv
->
page_offset
;
...
@@ -430,7 +430,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
...
@@ -430,7 +430,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
}
else
}
else
status
=
0
;
status
=
0
;
#endif
/* CONFIG_MTD_DATAFLASH_
VERIFY_WRITE
*/
#endif
/* CONFIG_MTD_DATAFLASH_
WRITE_VERIFY
*/
remaining
=
remaining
-
writelen
;
remaining
=
remaining
-
writelen
;
pageaddr
++
;
pageaddr
++
;
...
...
drivers/mtd/devices/slram.c
View file @
e08e56c8
...
@@ -341,7 +341,7 @@ static int init_slram(void)
...
@@ -341,7 +341,7 @@ static int init_slram(void)
#else
#else
int
count
;
int
count
;
for
(
count
=
0
;
(
map
[
count
])
&&
(
count
<
SLRAM_MAX_DEVICES_PARAMS
)
;
for
(
count
=
0
;
count
<
SLRAM_MAX_DEVICES_PARAMS
&&
map
[
count
]
;
count
++
)
{
count
++
)
{
}
}
...
...
drivers/mtd/maps/physmap_of.c
View file @
e08e56c8
...
@@ -190,6 +190,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
...
@@ -190,6 +190,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
const
u32
*
p
;
const
u32
*
p
;
int
reg_tuple_size
;
int
reg_tuple_size
;
struct
mtd_info
**
mtd_list
=
NULL
;
struct
mtd_info
**
mtd_list
=
NULL
;
resource_size_t
res_size
;
reg_tuple_size
=
(
of_n_addr_cells
(
dp
)
+
of_n_size_cells
(
dp
))
*
sizeof
(
u32
);
reg_tuple_size
=
(
of_n_addr_cells
(
dp
)
+
of_n_size_cells
(
dp
))
*
sizeof
(
u32
);
...
@@ -204,7 +205,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
...
@@ -204,7 +205,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
dev_err
(
&
dev
->
dev
,
"Malformed reg property on %s
\n
"
,
dev_err
(
&
dev
->
dev
,
"Malformed reg property on %s
\n
"
,
dev
->
node
->
full_name
);
dev
->
node
->
full_name
);
err
=
-
EINVAL
;
err
=
-
EINVAL
;
goto
err_
out
;
goto
err_
flash_remove
;
}
}
count
/=
reg_tuple_size
;
count
/=
reg_tuple_size
;
...
@@ -212,14 +213,14 @@ static int __devinit of_flash_probe(struct of_device *dev,
...
@@ -212,14 +213,14 @@ static int __devinit of_flash_probe(struct of_device *dev,
info
=
kzalloc
(
sizeof
(
struct
of_flash
)
+
info
=
kzalloc
(
sizeof
(
struct
of_flash
)
+
sizeof
(
struct
of_flash_list
)
*
count
,
GFP_KERNEL
);
sizeof
(
struct
of_flash_list
)
*
count
,
GFP_KERNEL
);
if
(
!
info
)
if
(
!
info
)
goto
err_out
;
goto
err_flash_remove
;
mtd_list
=
kzalloc
(
sizeof
(
struct
mtd_info
)
*
count
,
GFP_KERNEL
);
if
(
!
info
)
goto
err_out
;
dev_set_drvdata
(
&
dev
->
dev
,
info
);
dev_set_drvdata
(
&
dev
->
dev
,
info
);
mtd_list
=
kzalloc
(
sizeof
(
struct
mtd_info
)
*
count
,
GFP_KERNEL
);
if
(
!
mtd_list
)
goto
err_flash_remove
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
err
=
-
ENXIO
;
err
=
-
ENXIO
;
if
(
of_address_to_resource
(
dp
,
i
,
&
res
))
{
if
(
of_address_to_resource
(
dp
,
i
,
&
res
))
{
...
@@ -233,8 +234,8 @@ static int __devinit of_flash_probe(struct of_device *dev,
...
@@ -233,8 +234,8 @@ static int __devinit of_flash_probe(struct of_device *dev,
(
unsigned
long
long
)
res
.
end
);
(
unsigned
long
long
)
res
.
end
);
err
=
-
EBUSY
;
err
=
-
EBUSY
;
info
->
list
[
i
].
res
=
request_mem_region
(
res
.
start
,
res
.
end
-
res_size
=
resource_size
(
&
res
);
res
.
start
+
1
,
info
->
list
[
i
].
res
=
request_mem_region
(
res
.
start
,
res_size
,
dev_name
(
&
dev
->
dev
));
dev_name
(
&
dev
->
dev
));
if
(
!
info
->
list
[
i
].
res
)
if
(
!
info
->
list
[
i
].
res
)
goto
err_out
;
goto
err_out
;
...
@@ -249,7 +250,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
...
@@ -249,7 +250,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
info
->
list
[
i
].
map
.
name
=
dev_name
(
&
dev
->
dev
);
info
->
list
[
i
].
map
.
name
=
dev_name
(
&
dev
->
dev
);
info
->
list
[
i
].
map
.
phys
=
res
.
start
;
info
->
list
[
i
].
map
.
phys
=
res
.
start
;
info
->
list
[
i
].
map
.
size
=
res
.
end
-
res
.
start
+
1
;
info
->
list
[
i
].
map
.
size
=
res
_size
;
info
->
list
[
i
].
map
.
bankwidth
=
*
width
;
info
->
list
[
i
].
map
.
bankwidth
=
*
width
;
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
...
@@ -338,6 +339,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
...
@@ -338,6 +339,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
err_out:
err_out:
kfree
(
mtd_list
);
kfree
(
mtd_list
);
err_flash_remove:
of_flash_remove
(
dev
);
of_flash_remove
(
dev
);
return
err
;
return
err
;
...
...
drivers/mtd/maps/plat-ram.c
View file @
e08e56c8
...
@@ -175,7 +175,7 @@ static int platram_probe(struct platform_device *pdev)
...
@@ -175,7 +175,7 @@ static int platram_probe(struct platform_device *pdev)
/* setup map parameters */
/* setup map parameters */
info
->
map
.
phys
=
res
->
start
;
info
->
map
.
phys
=
res
->
start
;
info
->
map
.
size
=
(
res
->
end
-
res
->
start
)
+
1
;
info
->
map
.
size
=
resource_size
(
res
)
;
info
->
map
.
name
=
pdata
->
mapname
!=
NULL
?
info
->
map
.
name
=
pdata
->
mapname
!=
NULL
?
(
char
*
)
pdata
->
mapname
:
(
char
*
)
pdev
->
name
;
(
char
*
)
pdata
->
mapname
:
(
char
*
)
pdev
->
name
;
info
->
map
.
bankwidth
=
pdata
->
bankwidth
;
info
->
map
.
bankwidth
=
pdata
->
bankwidth
;
...
...
drivers/mtd/maps/pmcmsp-flash.c
View file @
e08e56c8
...
@@ -50,7 +50,7 @@ static int fcnt;
...
@@ -50,7 +50,7 @@ static int fcnt;
static
int
__init
init_msp_flash
(
void
)
static
int
__init
init_msp_flash
(
void
)
{
{
int
i
,
j
;
int
i
,
j
,
ret
=
-
ENOMEM
;
int
offset
,
coff
;
int
offset
,
coff
;
char
*
env
;
char
*
env
;
int
pcnt
;
int
pcnt
;
...
@@ -75,14 +75,16 @@ static int __init init_msp_flash(void)
...
@@ -75,14 +75,16 @@ static int __init init_msp_flash(void)
printk
(
KERN_NOTICE
"Found %d PMC flash devices
\n
"
,
fcnt
);
printk
(
KERN_NOTICE
"Found %d PMC flash devices
\n
"
,
fcnt
);
msp_flash
=
kmalloc
(
fcnt
*
sizeof
(
struct
map_info
*
),
GFP_KERNEL
);
msp_flash
=
kmalloc
(
fcnt
*
sizeof
(
struct
map_info
*
),
GFP_KERNEL
);
if
(
!
msp_flash
)
return
-
ENOMEM
;
msp_parts
=
kmalloc
(
fcnt
*
sizeof
(
struct
mtd_partition
*
),
GFP_KERNEL
);
msp_parts
=
kmalloc
(
fcnt
*
sizeof
(
struct
mtd_partition
*
),
GFP_KERNEL
);
if
(
!
msp_parts
)
goto
free_msp_flash
;
msp_maps
=
kcalloc
(
fcnt
,
sizeof
(
struct
mtd_info
),
GFP_KERNEL
);
msp_maps
=
kcalloc
(
fcnt
,
sizeof
(
struct
mtd_info
),
GFP_KERNEL
);
if
(
!
msp_flash
||
!
msp_parts
||
!
msp_maps
)
{
if
(
!
msp_maps
)
kfree
(
msp_maps
);
goto
free_msp_parts
;
kfree
(
msp_parts
);
kfree
(
msp_flash
);
return
-
ENOMEM
;
}
/* loop over the flash devices, initializing each */
/* loop over the flash devices, initializing each */
for
(
i
=
0
;
i
<
fcnt
;
i
++
)
{
for
(
i
=
0
;
i
<
fcnt
;
i
++
)
{
...
@@ -100,13 +102,18 @@ static int __init init_msp_flash(void)
...
@@ -100,13 +102,18 @@ static int __init init_msp_flash(void)
msp_parts
[
i
]
=
kcalloc
(
pcnt
,
sizeof
(
struct
mtd_partition
),
msp_parts
[
i
]
=
kcalloc
(
pcnt
,
sizeof
(
struct
mtd_partition
),
GFP_KERNEL
);
GFP_KERNEL
);
if
(
!
msp_parts
[
i
])
goto
cleanup_loop
;
/* now initialize the devices proper */
/* now initialize the devices proper */
flash_name
[
5
]
=
'0'
+
i
;
flash_name
[
5
]
=
'0'
+
i
;
env
=
prom_getenv
(
flash_name
);
env
=
prom_getenv
(
flash_name
);
if
(
sscanf
(
env
,
"%x:%x"
,
&
addr
,
&
size
)
<
2
)
if
(
sscanf
(
env
,
"%x:%x"
,
&
addr
,
&
size
)
<
2
)
{
return
-
ENXIO
;
ret
=
-
ENXIO
;
kfree
(
msp_parts
[
i
]);
goto
cleanup_loop
;
}
addr
=
CPHYSADDR
(
addr
);
addr
=
CPHYSADDR
(
addr
);
printk
(
KERN_NOTICE
printk
(
KERN_NOTICE
...
@@ -122,13 +129,23 @@ static int __init init_msp_flash(void)
...
@@ -122,13 +129,23 @@ static int __init init_msp_flash(void)
*/
*/
if
(
size
>
CONFIG_MSP_FLASH_MAP_LIMIT
)
if
(
size
>
CONFIG_MSP_FLASH_MAP_LIMIT
)
size
=
CONFIG_MSP_FLASH_MAP_LIMIT
;
size
=
CONFIG_MSP_FLASH_MAP_LIMIT
;
msp_maps
[
i
].
virt
=
ioremap
(
addr
,
size
);
msp_maps
[
i
].
virt
=
ioremap
(
addr
,
size
);
if
(
msp_maps
[
i
].
virt
==
NULL
)
{
ret
=
-
ENXIO
;
kfree
(
msp_parts
[
i
]);
goto
cleanup_loop
;
}
msp_maps
[
i
].
bankwidth
=
1
;
msp_maps
[
i
].
bankwidth
=
1
;
msp_maps
[
i
].
name
=
strncpy
(
kmalloc
(
7
,
GFP_KERNEL
),
msp_maps
[
i
].
name
=
kmalloc
(
7
,
GFP_KERNEL
);
flash_name
,
7
);
if
(
!
msp_maps
[
i
].
name
)
{
iounmap
(
msp_maps
[
i
].
virt
);
kfree
(
msp_parts
[
i
]);
goto
cleanup_loop
;
}
if
(
msp_maps
[
i
].
virt
==
NULL
)
msp_maps
[
i
].
name
=
strncpy
(
msp_maps
[
i
].
name
,
flash_name
,
7
);
return
-
ENXIO
;
for
(
j
=
0
;
j
<
pcnt
;
j
++
)
{
for
(
j
=
0
;
j
<
pcnt
;
j
++
)
{
part_name
[
5
]
=
'0'
+
i
;
part_name
[
5
]
=
'0'
+
i
;
...
@@ -136,8 +153,14 @@ static int __init init_msp_flash(void)
...
@@ -136,8 +153,14 @@ static int __init init_msp_flash(void)
env
=
prom_getenv
(
part_name
);
env
=
prom_getenv
(
part_name
);
if
(
sscanf
(
env
,
"%x:%x:%n"
,
&
offset
,
&
size
,
&
coff
)
<
2
)
if
(
sscanf
(
env
,
"%x:%x:%n"
,
&
offset
,
&
size
,
return
-
ENXIO
;
&
coff
)
<
2
)
{
ret
=
-
ENXIO
;
kfree
(
msp_maps
[
i
].
name
);
iounmap
(
msp_maps
[
i
].
virt
);
kfree
(
msp_parts
[
i
]);
goto
cleanup_loop
;
}
msp_parts
[
i
][
j
].
size
=
size
;
msp_parts
[
i
][
j
].
size
=
size
;
msp_parts
[
i
][
j
].
offset
=
offset
;
msp_parts
[
i
][
j
].
offset
=
offset
;
...
@@ -152,18 +175,37 @@ static int __init init_msp_flash(void)
...
@@ -152,18 +175,37 @@ static int __init init_msp_flash(void)
add_mtd_partitions
(
msp_flash
[
i
],
msp_parts
[
i
],
pcnt
);
add_mtd_partitions
(
msp_flash
[
i
],
msp_parts
[
i
],
pcnt
);
}
else
{
}
else
{
printk
(
KERN_ERR
"map probe failed for flash
\n
"
);
printk
(
KERN_ERR
"map probe failed for flash
\n
"
);
return
-
ENXIO
;
ret
=
-
ENXIO
;
kfree
(
msp_maps
[
i
].
name
);
iounmap
(
msp_maps
[
i
].
virt
);
kfree
(
msp_parts
[
i
]);
goto
cleanup_loop
;
}
}
}
}
return
0
;
return
0
;
cleanup_loop:
while
(
i
--
)
{
del_mtd_partitions
(
msp_flash
[
i
]);
map_destroy
(
msp_flash
[
i
]);
kfree
(
msp_maps
[
i
].
name
);
iounmap
(
msp_maps
[
i
].
virt
);
kfree
(
msp_parts
[
i
]);
}
kfree
(
msp_maps
);
free_msp_parts:
kfree
(
msp_parts
);
free_msp_flash:
kfree
(
msp_flash
);
return
ret
;
}
}
static
void
__exit
cleanup_msp_flash
(
void
)
static
void
__exit
cleanup_msp_flash
(
void
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
msp_flash
)
/
sizeof
(
struct
mtd_info
**
)
;
i
++
)
{
for
(
i
=
0
;
i
<
fcnt
;
i
++
)
{
del_mtd_partitions
(
msp_flash
[
i
]);
del_mtd_partitions
(
msp_flash
[
i
]);
map_destroy
(
msp_flash
[
i
]);
map_destroy
(
msp_flash
[
i
]);
iounmap
((
void
*
)
msp_maps
[
i
].
virt
);
iounmap
((
void
*
)
msp_maps
[
i
].
virt
);
...
...
drivers/mtd/mtdblock.c
View file @
e08e56c8
...
@@ -84,7 +84,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
...
@@ -84,7 +84,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
remove_wait_queue
(
&
wait_q
,
&
wait
);
remove_wait_queue
(
&
wait_q
,
&
wait
);
/*
/*
* Next, writhe data to flash.
* Next, writ
e t
he data to flash.
*/
*/
ret
=
mtd
->
write
(
mtd
,
pos
,
len
,
&
retlen
,
buf
);
ret
=
mtd
->
write
(
mtd
,
pos
,
len
,
&
retlen
,
buf
);
...
...
drivers/mtd/mtdcore.c
View file @
e08e56c8
...
@@ -213,11 +213,11 @@ static struct attribute *mtd_attrs[] = {
...
@@ -213,11 +213,11 @@ static struct attribute *mtd_attrs[] = {
NULL
,
NULL
,
};
};
struct
attribute_group
mtd_group
=
{
st
atic
st
ruct
attribute_group
mtd_group
=
{
.
attrs
=
mtd_attrs
,
.
attrs
=
mtd_attrs
,
};
};
const
struct
attribute_group
*
mtd_groups
[]
=
{
static
const
struct
attribute_group
*
mtd_groups
[]
=
{
&
mtd_group
,
&
mtd_group
,
NULL
,
NULL
,
};
};
...
...
drivers/mtd/nand/nand_base.c
View file @
e08e56c8
...
@@ -688,8 +688,7 @@ nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state)
...
@@ -688,8 +688,7 @@ nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state)
retry:
retry:
spin_lock
(
lock
);
spin_lock
(
lock
);
/* Hardware controller shared among independend devices */
/* Hardware controller shared among independent devices */
/* Hardware controller shared among independend devices */
if
(
!
chip
->
controller
->
active
)
if
(
!
chip
->
controller
->
active
)
chip
->
controller
->
active
=
chip
;
chip
->
controller
->
active
=
chip
;
...
@@ -1413,8 +1412,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
...
@@ -1413,8 +1412,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
int
len
;
int
len
;
uint8_t
*
buf
=
ops
->
oobbuf
;
uint8_t
*
buf
=
ops
->
oobbuf
;
DEBUG
(
MTD_DEBUG_LEVEL3
,
"
nand_read_oob
: from = 0x%08Lx, len = %i
\n
"
,
DEBUG
(
MTD_DEBUG_LEVEL3
,
"
%s
: from = 0x%08Lx, len = %i
\n
"
,
(
unsigned
long
long
)
from
,
readlen
);
__func__
,
(
unsigned
long
long
)
from
,
readlen
);
if
(
ops
->
mode
==
MTD_OOB_AUTO
)
if
(
ops
->
mode
==
MTD_OOB_AUTO
)
len
=
chip
->
ecc
.
layout
->
oobavail
;
len
=
chip
->
ecc
.
layout
->
oobavail
;
...
@@ -1422,8 +1421,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
...
@@ -1422,8 +1421,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
len
=
mtd
->
oobsize
;
len
=
mtd
->
oobsize
;
if
(
unlikely
(
ops
->
ooboffs
>=
len
))
{
if
(
unlikely
(
ops
->
ooboffs
>=
len
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_read_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt to start read
"
"Attempt to start read outside oob
\n
"
);
"outside oob
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1431,8 +1430,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
...
@@ -1431,8 +1430,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
if
(
unlikely
(
from
>=
mtd
->
size
||
if
(
unlikely
(
from
>=
mtd
->
size
||
ops
->
ooboffs
+
readlen
>
((
mtd
->
size
>>
chip
->
page_shift
)
-
ops
->
ooboffs
+
readlen
>
((
mtd
->
size
>>
chip
->
page_shift
)
-
(
from
>>
chip
->
page_shift
))
*
len
))
{
(
from
>>
chip
->
page_shift
))
*
len
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_read_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt read beyond end
"
"Attempt read beyond end of device
\n
"
);
"of device
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1506,8 +1505,8 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
...
@@ -1506,8 +1505,8 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
/* Do not allow reads past end of device */
/* Do not allow reads past end of device */
if
(
ops
->
datbuf
&&
(
from
+
ops
->
len
)
>
mtd
->
size
)
{
if
(
ops
->
datbuf
&&
(
from
+
ops
->
len
)
>
mtd
->
size
)
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_read_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt read
"
"Attempt read beyond end of device
\n
"
);
"beyond end of device
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1816,8 +1815,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
...
@@ -1816,8 +1815,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
/* reject writes, which are not page aligned */
/* reject writes, which are not page aligned */
if
(
NOTALIGNED
(
to
)
||
NOTALIGNED
(
ops
->
len
))
{
if
(
NOTALIGNED
(
to
)
||
NOTALIGNED
(
ops
->
len
))
{
printk
(
KERN_NOTICE
"
nand_write:
"
printk
(
KERN_NOTICE
"
%s: Attempt to write not
"
"Attempt to write not page aligned data
\n
"
);
"page aligned data
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1944,8 +1943,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
...
@@ -1944,8 +1943,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
int
chipnr
,
page
,
status
,
len
;
int
chipnr
,
page
,
status
,
len
;
struct
nand_chip
*
chip
=
mtd
->
priv
;
struct
nand_chip
*
chip
=
mtd
->
priv
;
DEBUG
(
MTD_DEBUG_LEVEL3
,
"
nand_write_oob
: to = 0x%08x, len = %i
\n
"
,
DEBUG
(
MTD_DEBUG_LEVEL3
,
"
%s
: to = 0x%08x, len = %i
\n
"
,
(
unsigned
int
)
to
,
(
int
)
ops
->
ooblen
);
__func__
,
(
unsigned
int
)
to
,
(
int
)
ops
->
ooblen
);
if
(
ops
->
mode
==
MTD_OOB_AUTO
)
if
(
ops
->
mode
==
MTD_OOB_AUTO
)
len
=
chip
->
ecc
.
layout
->
oobavail
;
len
=
chip
->
ecc
.
layout
->
oobavail
;
...
@@ -1954,14 +1953,14 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
...
@@ -1954,14 +1953,14 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
/* Do not allow write past end of page */
/* Do not allow write past end of page */
if
((
ops
->
ooboffs
+
ops
->
ooblen
)
>
len
)
{
if
((
ops
->
ooboffs
+
ops
->
ooblen
)
>
len
)
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_write_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt to write
"
"Attempt to write past end of page
\n
"
);
"past end of page
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
(
unlikely
(
ops
->
ooboffs
>=
len
))
{
if
(
unlikely
(
ops
->
ooboffs
>=
len
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_do_write_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt to start
"
"Attempt to start write outside oob
\n
"
);
"write outside oob
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1970,8 +1969,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
...
@@ -1970,8 +1969,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
ops
->
ooboffs
+
ops
->
ooblen
>
ops
->
ooboffs
+
ops
->
ooblen
>
((
mtd
->
size
>>
chip
->
page_shift
)
-
((
mtd
->
size
>>
chip
->
page_shift
)
-
(
to
>>
chip
->
page_shift
))
*
len
))
{
(
to
>>
chip
->
page_shift
))
*
len
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_do_write_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt write beyond
"
"Attempt write beyond end of device
\n
"
);
"end of device
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -2026,8 +2025,8 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
...
@@ -2026,8 +2025,8 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
/* Do not allow writes past end of device */
/* Do not allow writes past end of device */
if
(
ops
->
datbuf
&&
(
to
+
ops
->
len
)
>
mtd
->
size
)
{
if
(
ops
->
datbuf
&&
(
to
+
ops
->
len
)
>
mtd
->
size
)
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_write_oob:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Attempt write beyond
"
"Attempt write beyond end of device
\n
"
);
"end of device
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -2117,26 +2116,27 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
...
@@ -2117,26 +2116,27 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
unsigned
int
bbt_masked_page
=
0xffffffff
;
unsigned
int
bbt_masked_page
=
0xffffffff
;
loff_t
len
;
loff_t
len
;
DEBUG
(
MTD_DEBUG_LEVEL3
,
"nand_erase: start = 0x%012llx, len = %llu
\n
"
,
DEBUG
(
MTD_DEBUG_LEVEL3
,
"%s: start = 0x%012llx, len = %llu
\n
"
,
(
unsigned
long
long
)
instr
->
addr
,
(
unsigned
long
long
)
instr
->
len
);
__func__
,
(
unsigned
long
long
)
instr
->
addr
,
(
unsigned
long
long
)
instr
->
len
);
/* Start address must align on block boundary */
/* Start address must align on block boundary */
if
(
instr
->
addr
&
((
1
<<
chip
->
phys_erase_shift
)
-
1
))
{
if
(
instr
->
addr
&
((
1
<<
chip
->
phys_erase_shift
)
-
1
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_erase: Unaligned address
\n
"
);
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Unaligned address
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/* Length must align on block boundary */
/* Length must align on block boundary */
if
(
instr
->
len
&
((
1
<<
chip
->
phys_erase_shift
)
-
1
))
{
if
(
instr
->
len
&
((
1
<<
chip
->
phys_erase_shift
)
-
1
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_erase: "
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Length not block aligned
\n
"
,
"Length not block aligned
\n
"
);
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/* Do not allow erase past end of device */
/* Do not allow erase past end of device */
if
((
instr
->
len
+
instr
->
addr
)
>
mtd
->
size
)
{
if
((
instr
->
len
+
instr
->
addr
)
>
mtd
->
size
)
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_erase: "
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Erase past end of device
\n
"
,
"Erase past end of device
\n
"
);
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -2157,8 +2157,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
...
@@ -2157,8 +2157,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
/* Check, if it is write protected */
/* Check, if it is write protected */
if
(
nand_check_wp
(
mtd
))
{
if
(
nand_check_wp
(
mtd
))
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_erase: "
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Device is write protected!!!
\n
"
,
"Device is write protected!!!
\n
"
);
__func__
);
instr
->
state
=
MTD_ERASE_FAILED
;
instr
->
state
=
MTD_ERASE_FAILED
;
goto
erase_exit
;
goto
erase_exit
;
}
}
...
@@ -2183,8 +2183,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
...
@@ -2183,8 +2183,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
*/
*/
if
(
nand_block_checkbad
(
mtd
,
((
loff_t
)
page
)
<<
if
(
nand_block_checkbad
(
mtd
,
((
loff_t
)
page
)
<<
chip
->
page_shift
,
0
,
allowbbt
))
{
chip
->
page_shift
,
0
,
allowbbt
))
{
printk
(
KERN_WARNING
"
nand_erase: attempt to erase a
"
printk
(
KERN_WARNING
"
%s: attempt to erase a bad block
"
"bad block at page 0x%08x
\n
"
,
page
);
"at page 0x%08x
\n
"
,
__func__
,
page
);
instr
->
state
=
MTD_ERASE_FAILED
;
instr
->
state
=
MTD_ERASE_FAILED
;
goto
erase_exit
;
goto
erase_exit
;
}
}
...
@@ -2211,8 +2211,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
...
@@ -2211,8 +2211,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
/* See if block erase succeeded */
/* See if block erase succeeded */
if
(
status
&
NAND_STATUS_FAIL
)
{
if
(
status
&
NAND_STATUS_FAIL
)
{
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_erase:
"
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s: Failed erase,
"
"Failed erase, page 0x%08x
\n
"
,
page
);
"page 0x%08x
\n
"
,
__func__
,
page
);
instr
->
state
=
MTD_ERASE_FAILED
;
instr
->
state
=
MTD_ERASE_FAILED
;
instr
->
fail_addr
=
instr
->
fail_addr
=
((
loff_t
)
page
<<
chip
->
page_shift
);
((
loff_t
)
page
<<
chip
->
page_shift
);
...
@@ -2272,9 +2272,9 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
...
@@ -2272,9 +2272,9 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
if
(
!
rewrite_bbt
[
chipnr
])
if
(
!
rewrite_bbt
[
chipnr
])
continue
;
continue
;
/* update the BBT for chip */
/* update the BBT for chip */
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
nand_erase_nand
: nand_update_bbt "
DEBUG
(
MTD_DEBUG_LEVEL0
,
"
%s
: nand_update_bbt "
"(%d:0x%0llx 0x%0x)
\n
"
,
chipnr
,
rewrite_bbt
[
chipnr
]
,
"(%d:0x%0llx 0x%0x)
\n
"
,
__func__
,
chipnr
,
chip
->
bbt_td
->
pages
[
chipnr
]);
rewrite_bbt
[
chipnr
],
chip
->
bbt_td
->
pages
[
chipnr
]);
nand_update_bbt
(
mtd
,
rewrite_bbt
[
chipnr
]);
nand_update_bbt
(
mtd
,
rewrite_bbt
[
chipnr
]);
}
}
...
@@ -2292,7 +2292,7 @@ static void nand_sync(struct mtd_info *mtd)
...
@@ -2292,7 +2292,7 @@ static void nand_sync(struct mtd_info *mtd)
{
{
struct
nand_chip
*
chip
=
mtd
->
priv
;
struct
nand_chip
*
chip
=
mtd
->
priv
;
DEBUG
(
MTD_DEBUG_LEVEL3
,
"
nand_sync: called
\n
"
);
DEBUG
(
MTD_DEBUG_LEVEL3
,
"
%s: called
\n
"
,
__func__
);
/* Grab the lock and see if the device is available */
/* Grab the lock and see if the device is available */
nand_get_device
(
chip
,
mtd
,
FL_SYNCING
);
nand_get_device
(
chip
,
mtd
,
FL_SYNCING
);
...
@@ -2356,8 +2356,8 @@ static void nand_resume(struct mtd_info *mtd)
...
@@ -2356,8 +2356,8 @@ static void nand_resume(struct mtd_info *mtd)
if
(
chip
->
state
==
FL_PM_SUSPENDED
)
if
(
chip
->
state
==
FL_PM_SUSPENDED
)
nand_release_device
(
mtd
);
nand_release_device
(
mtd
);
else
else
printk
(
KERN_ERR
"
nand_resume()
called for a chip which is not "
printk
(
KERN_ERR
"
%s
called for a chip which is not "
"in suspended state
\n
"
);
"in suspended state
\n
"
,
__func__
);
}
}
/*
/*
...
@@ -2728,6 +2728,7 @@ int nand_scan_tail(struct mtd_info *mtd)
...
@@ -2728,6 +2728,7 @@ int nand_scan_tail(struct mtd_info *mtd)
chip
->
ecc
.
write_page_raw
=
nand_write_page_raw
;
chip
->
ecc
.
write_page_raw
=
nand_write_page_raw
;
chip
->
ecc
.
read_oob
=
nand_read_oob_std
;
chip
->
ecc
.
read_oob
=
nand_read_oob_std
;
chip
->
ecc
.
write_oob
=
nand_write_oob_std
;
chip
->
ecc
.
write_oob
=
nand_write_oob_std
;
if
(
!
chip
->
ecc
.
size
)
chip
->
ecc
.
size
=
256
;
chip
->
ecc
.
size
=
256
;
chip
->
ecc
.
bytes
=
3
;
chip
->
ecc
.
bytes
=
3
;
break
;
break
;
...
@@ -2858,7 +2859,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
...
@@ -2858,7 +2859,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
/* Many callers got this wrong, so check for it for a while... */
/* Many callers got this wrong, so check for it for a while... */
if
(
!
mtd
->
owner
&&
caller_is_module
())
{
if
(
!
mtd
->
owner
&&
caller_is_module
())
{
printk
(
KERN_CRIT
"nand_scan() called with NULL mtd->owner!
\n
"
);
printk
(
KERN_CRIT
"%s called with NULL mtd->owner!
\n
"
,
__func__
);
BUG
();
BUG
();
}
}
...
...
drivers/mtd/onenand/Kconfig
View file @
e08e56c8
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
menuconfig MTD_ONENAND
menuconfig MTD_ONENAND
tristate "OneNAND Device Support"
tristate "OneNAND Device Support"
depends on MTD
depends on MTD
select MTD_PARTITIONS
help
help
This enables support for accessing all type of OneNAND flash
This enables support for accessing all type of OneNAND flash
devices. For further information see
devices. For further information see
...
@@ -66,7 +67,6 @@ config MTD_ONENAND_2X_PROGRAM
...
@@ -66,7 +67,6 @@ config MTD_ONENAND_2X_PROGRAM
config MTD_ONENAND_SIM
config MTD_ONENAND_SIM
tristate "OneNAND simulator support"
tristate "OneNAND simulator support"
depends on MTD_PARTITIONS
help
help
The simulator may simulate various OneNAND flash chips for the
The simulator may simulate various OneNAND flash chips for the
OneNAND MTD layer.
OneNAND MTD layer.
...
...
drivers/mtd/onenand/onenand_base.c
View file @
e08e56c8
...
@@ -1191,7 +1191,7 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from,
...
@@ -1191,7 +1191,7 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from,
/*
/*
* Chip boundary handling in DDP
* Chip boundary handling in DDP
* Now we issued chip 1 read and pointed chip 1
* Now we issued chip 1 read and pointed chip 1
* bufferam so we have to point chip 0 buffe
ram.
* bufferram so we have to point chip 0 buffer
ram.
*/
*/
if
(
ONENAND_IS_DDP
(
this
)
&&
if
(
ONENAND_IS_DDP
(
this
)
&&
unlikely
(
from
==
(
this
->
chipsize
>>
1
)))
{
unlikely
(
from
==
(
this
->
chipsize
>>
1
)))
{
...
@@ -1867,8 +1867,8 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
...
@@ -1867,8 +1867,8 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
ONENAND_SET_NEXT_BUFFERRAM
(
this
);
ONENAND_SET_NEXT_BUFFERRAM
(
this
);
/*
/*
* 2 PLANE, MLC, and Flex-OneNAND do
esn'
t support
* 2 PLANE, MLC, and Flex-OneNAND do
no
t support
* write-while-program
e
feature.
* write-while-program feature.
*/
*/
if
(
!
ONENAND_IS_2PLANE
(
this
)
&&
!
first
)
{
if
(
!
ONENAND_IS_2PLANE
(
this
)
&&
!
first
)
{
ONENAND_SET_PREV_BUFFERRAM
(
this
);
ONENAND_SET_PREV_BUFFERRAM
(
this
);
...
@@ -1879,7 +1879,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
...
@@ -1879,7 +1879,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
onenand_update_bufferram
(
mtd
,
prev
,
!
ret
&&
!
prev_subpage
);
onenand_update_bufferram
(
mtd
,
prev
,
!
ret
&&
!
prev_subpage
);
if
(
ret
)
{
if
(
ret
)
{
written
-=
prevlen
;
written
-=
prevlen
;
printk
(
KERN_ERR
"onenand_write_ops_nolock: write f
ila
ed %d
\n
"
,
ret
);
printk
(
KERN_ERR
"onenand_write_ops_nolock: write f
ail
ed %d
\n
"
,
ret
);
break
;
break
;
}
}
...
@@ -1905,7 +1905,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
...
@@ -1905,7 +1905,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
/* In partial page write we don't update bufferram */
/* In partial page write we don't update bufferram */
onenand_update_bufferram
(
mtd
,
to
,
!
ret
&&
!
subpage
);
onenand_update_bufferram
(
mtd
,
to
,
!
ret
&&
!
subpage
);
if
(
ret
)
{
if
(
ret
)
{
printk
(
KERN_ERR
"onenand_write_ops_nolock: write f
ila
ed %d
\n
"
,
ret
);
printk
(
KERN_ERR
"onenand_write_ops_nolock: write f
ail
ed %d
\n
"
,
ret
);
break
;
break
;
}
}
...
@@ -2201,7 +2201,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
...
@@ -2201,7 +2201,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
/* Grab the lock and see if the device is available */
/* Grab the lock and see if the device is available */
onenand_get_device
(
mtd
,
FL_ERASING
);
onenand_get_device
(
mtd
,
FL_ERASING
);
/* Loop through
t the page
s */
/* Loop through
the block
s */
instr
->
state
=
MTD_ERASING
;
instr
->
state
=
MTD_ERASING
;
while
(
len
)
{
while
(
len
)
{
...
@@ -2328,7 +2328,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
...
@@ -2328,7 +2328,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
if
(
bbm
->
bbt
)
if
(
bbm
->
bbt
)
bbm
->
bbt
[
block
>>
2
]
|=
0x01
<<
((
block
&
0x03
)
<<
1
);
bbm
->
bbt
[
block
>>
2
]
|=
0x01
<<
((
block
&
0x03
)
<<
1
);
/* We write two bytes, so we don
t have to mess with 16
bit access */
/* We write two bytes, so we don
't have to mess with 16-
bit access */
ofs
+=
mtd
->
oobsize
+
(
bbm
->
badblockpos
&
~
0x01
);
ofs
+=
mtd
->
oobsize
+
(
bbm
->
badblockpos
&
~
0x01
);
/* FIXME : What to do when marking SLC block in partition
/* FIXME : What to do when marking SLC block in partition
* with MLC erasesize? For now, it is not advisable to
* with MLC erasesize? For now, it is not advisable to
...
@@ -2557,7 +2557,7 @@ static void onenand_unlock_all(struct mtd_info *mtd)
...
@@ -2557,7 +2557,7 @@ static void onenand_unlock_all(struct mtd_info *mtd)
#ifdef CONFIG_MTD_ONENAND_OTP
#ifdef CONFIG_MTD_ONENAND_OTP
/* Interal OTP operation */
/* Inter
n
al OTP operation */
typedef
int
(
*
otp_op_t
)(
struct
mtd_info
*
mtd
,
loff_t
form
,
size_t
len
,
typedef
int
(
*
otp_op_t
)(
struct
mtd_info
*
mtd
,
loff_t
form
,
size_t
len
,
size_t
*
retlen
,
u_char
*
buf
);
size_t
*
retlen
,
u_char
*
buf
);
...
@@ -2921,7 +2921,7 @@ static void onenand_check_features(struct mtd_info *mtd)
...
@@ -2921,7 +2921,7 @@ static void onenand_check_features(struct mtd_info *mtd)
this
->
options
|=
ONENAND_HAS_2PLANE
;
this
->
options
|=
ONENAND_HAS_2PLANE
;
case
ONENAND_DEVICE_DENSITY_2Gb
:
case
ONENAND_DEVICE_DENSITY_2Gb
:
/* 2Gb DDP do
n'
t have 2 plane */
/* 2Gb DDP do
es no
t have 2 plane */
if
(
!
ONENAND_IS_DDP
(
this
))
if
(
!
ONENAND_IS_DDP
(
this
))
this
->
options
|=
ONENAND_HAS_2PLANE
;
this
->
options
|=
ONENAND_HAS_2PLANE
;
this
->
options
|=
ONENAND_HAS_UNLOCK_ALL
;
this
->
options
|=
ONENAND_HAS_UNLOCK_ALL
;
...
@@ -3364,7 +3364,7 @@ static int onenand_probe(struct mtd_info *mtd)
...
@@ -3364,7 +3364,7 @@ static int onenand_probe(struct mtd_info *mtd)
/* It's real page size */
/* It's real page size */
this
->
writesize
=
mtd
->
writesize
;
this
->
writesize
=
mtd
->
writesize
;
/* REVIST: Multichip handling */
/* REVIS
I
T: Multichip handling */
if
(
FLEXONENAND
(
this
))
if
(
FLEXONENAND
(
this
))
flexonenand_get_size
(
mtd
);
flexonenand_get_size
(
mtd
);
...
...
drivers/mtd/tests/mtd_oobtest.c
View file @
e08e56c8
...
@@ -512,7 +512,7 @@ static int __init mtd_oobtest_init(void)
...
@@ -512,7 +512,7 @@ static int __init mtd_oobtest_init(void)
goto
out
;
goto
out
;
addr0
=
0
;
addr0
=
0
;
for
(
i
=
0
;
bbt
[
i
]
&&
i
<
ebcnt
;
++
i
)
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
i
]
;
++
i
)
addr0
+=
mtd
->
erasesize
;
addr0
+=
mtd
->
erasesize
;
/* Attempt to write off end of OOB */
/* Attempt to write off end of OOB */
...
...
drivers/mtd/tests/mtd_pagetest.c
View file @
e08e56c8
...
@@ -116,11 +116,11 @@ static int verify_eraseblock(int ebnum)
...
@@ -116,11 +116,11 @@ static int verify_eraseblock(int ebnum)
loff_t
addr
=
ebnum
*
mtd
->
erasesize
;
loff_t
addr
=
ebnum
*
mtd
->
erasesize
;
addr0
=
0
;
addr0
=
0
;
for
(
i
=
0
;
bbt
[
i
]
&&
i
<
ebcnt
;
++
i
)
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
i
]
;
++
i
)
addr0
+=
mtd
->
erasesize
;
addr0
+=
mtd
->
erasesize
;
addrn
=
mtd
->
size
;
addrn
=
mtd
->
size
;
for
(
i
=
0
;
bbt
[
ebcnt
-
i
-
1
]
&&
i
<
ebcnt
;
++
i
)
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
ebcnt
-
i
-
1
]
;
++
i
)
addrn
-=
mtd
->
erasesize
;
addrn
-=
mtd
->
erasesize
;
set_random_data
(
writebuf
,
mtd
->
erasesize
);
set_random_data
(
writebuf
,
mtd
->
erasesize
);
...
@@ -219,11 +219,11 @@ static int crosstest(void)
...
@@ -219,11 +219,11 @@ static int crosstest(void)
memset
(
pp1
,
0
,
pgsize
*
4
);
memset
(
pp1
,
0
,
pgsize
*
4
);
addr0
=
0
;
addr0
=
0
;
for
(
i
=
0
;
bbt
[
i
]
&&
i
<
ebcnt
;
++
i
)
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
i
]
;
++
i
)
addr0
+=
mtd
->
erasesize
;
addr0
+=
mtd
->
erasesize
;
addrn
=
mtd
->
size
;
addrn
=
mtd
->
size
;
for
(
i
=
0
;
bbt
[
ebcnt
-
i
-
1
]
&&
i
<
ebcnt
;
++
i
)
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
ebcnt
-
i
-
1
]
;
++
i
)
addrn
-=
mtd
->
erasesize
;
addrn
-=
mtd
->
erasesize
;
/* Read 2nd-to-last page to pp1 */
/* Read 2nd-to-last page to pp1 */
...
@@ -317,7 +317,7 @@ static int erasecrosstest(void)
...
@@ -317,7 +317,7 @@ static int erasecrosstest(void)
ebnum
=
0
;
ebnum
=
0
;
addr0
=
0
;
addr0
=
0
;
for
(
i
=
0
;
bbt
[
i
]
&&
i
<
ebcnt
;
++
i
)
{
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
i
]
;
++
i
)
{
addr0
+=
mtd
->
erasesize
;
addr0
+=
mtd
->
erasesize
;
ebnum
+=
1
;
ebnum
+=
1
;
}
}
...
@@ -413,7 +413,7 @@ static int erasetest(void)
...
@@ -413,7 +413,7 @@ static int erasetest(void)
ebnum
=
0
;
ebnum
=
0
;
addr0
=
0
;
addr0
=
0
;
for
(
i
=
0
;
bbt
[
i
]
&&
i
<
ebcnt
;
++
i
)
{
for
(
i
=
0
;
i
<
ebcnt
&&
bbt
[
i
]
;
++
i
)
{
addr0
+=
mtd
->
erasesize
;
addr0
+=
mtd
->
erasesize
;
ebnum
+=
1
;
ebnum
+=
1
;
}
}
...
...
include/linux/mtd/onenand_regs.h
View file @
e08e56c8
...
@@ -207,6 +207,9 @@
...
@@ -207,6 +207,9 @@
#define ONENAND_ECC_2BIT (1 << 1)
#define ONENAND_ECC_2BIT (1 << 1)
#define ONENAND_ECC_2BIT_ALL (0xAAAA)
#define ONENAND_ECC_2BIT_ALL (0xAAAA)
#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
#define ONENAND_ECC_3BIT (1 << 2)
#define ONENAND_ECC_4BIT (1 << 3)
#define ONENAND_ECC_4BIT_UNCORRECTABLE (0x1010)
/*
/*
* One-Time Programmable (OTP)
* One-Time Programmable (OTP)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment