Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c1f16258
Commit
c1f16258
authored
Feb 09, 2007
by
David Woodhouse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://git.infradead.org/~kmpark/onenand-mtd-2.6
parents
552a8278
cde36b37
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
446 additions
and
182 deletions
+446
-182
drivers/mtd/onenand/onenand_base.c
drivers/mtd/onenand/onenand_base.c
+413
-159
drivers/mtd/onenand/onenand_bbt.c
drivers/mtd/onenand/onenand_bbt.c
+15
-12
include/linux/mtd/bbm.h
include/linux/mtd/bbm.h
+7
-0
include/linux/mtd/onenand.h
include/linux/mtd/onenand.h
+6
-9
include/linux/mtd/onenand_regs.h
include/linux/mtd/onenand_regs.h
+5
-2
No files found.
drivers/mtd/onenand/onenand_base.c
View file @
c1f16258
This diff is collapsed.
Click to expand it.
drivers/mtd/onenand/onenand_bbt.c
View file @
c1f16258
...
...
@@ -17,8 +17,8 @@
#include <linux/mtd/onenand.h>
#include <linux/mtd/compatmac.h>
extern
int
onenand_
do_read_oob
(
struct
mtd_info
*
mtd
,
loff_t
from
,
size_t
len
,
size_t
*
retlen
,
u_char
*
buf
);
extern
int
onenand_
bbt_read_oob
(
struct
mtd_info
*
mtd
,
loff_t
from
,
struct
mtd_oob_ops
*
ops
);
/**
* check_short_pattern - [GENERIC] check if a pattern is in the buffer
...
...
@@ -65,10 +65,11 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
int
startblock
;
loff_t
from
;
size_t
readlen
,
ooblen
;
struct
mtd_oob_ops
ops
;
printk
(
KERN_INFO
"Scanning device for bad blocks
\n
"
);
len
=
1
;
len
=
2
;
/* We need only read few bytes from the OOB area */
scanlen
=
ooblen
=
0
;
...
...
@@ -82,22 +83,24 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
startblock
=
0
;
from
=
0
;
ops
.
mode
=
MTD_OOB_PLACE
;
ops
.
ooblen
=
readlen
;
ops
.
oobbuf
=
buf
;
ops
.
len
=
ops
.
ooboffs
=
ops
.
retlen
=
ops
.
oobretlen
=
0
;
for
(
i
=
startblock
;
i
<
numblocks
;
)
{
int
ret
;
for
(
j
=
0
;
j
<
len
;
j
++
)
{
size_t
retlen
;
/* No need to read pages fully,
* just read required OOB bytes */
ret
=
onenand_do_read_oob
(
mtd
,
from
+
j
*
mtd
->
writesize
+
bd
->
offs
,
readlen
,
&
retlen
,
&
buf
[
0
]);
ret
=
onenand_bbt_read_oob
(
mtd
,
from
+
j
*
mtd
->
writesize
+
bd
->
offs
,
&
ops
);
/* If it is a initial bad block, just ignore it */
if
(
ret
&&
!
(
ret
&
ONENAND_CTRL_LOAD
)
)
return
ret
;
if
(
ret
==
ONENAND_BBT_READ_FATAL_ERROR
)
return
-
EIO
;
if
(
check_short_pattern
(
&
buf
[
j
*
scanlen
],
scanlen
,
mtd
->
writesize
,
bd
))
{
if
(
ret
||
check_short_pattern
(
&
buf
[
j
*
scanlen
],
scanlen
,
mtd
->
writesize
,
bd
))
{
bbm
->
bbt
[
i
>>
3
]
|=
0x03
<<
(
i
&
0x6
);
printk
(
KERN_WARNING
"Bad eraseblock %d at 0x%08x
\n
"
,
i
>>
1
,
(
unsigned
int
)
from
);
...
...
@@ -168,8 +171,8 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
* marked good / bad blocks and writes the bad block table(s) to
* the selected place.
*
* The bad block table memory is allocated here. It
must be
freed
* by
calling the onenand_free_bbt
function.
* The bad block table memory is allocated here. It
is
freed
* by
the onenand_release
function.
*
*/
int
onenand_scan_bbt
(
struct
mtd_info
*
mtd
,
struct
nand_bbt_descr
*
bd
)
...
...
include/linux/mtd/bbm.h
View file @
c1f16258
...
...
@@ -92,6 +92,13 @@ struct nand_bbt_descr {
*/
#define ONENAND_BADBLOCK_POS 0
/*
* Bad block scanning errors
*/
#define ONENAND_BBT_READ_ERROR 1
#define ONENAND_BBT_READ_ECC_ERROR 2
#define ONENAND_BBT_READ_FATAL_ERROR 4
/**
* struct bbm_info - [GENERIC] Bad Block Table data structure
* @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
...
...
include/linux/mtd/onenand.h
View file @
c1f16258
/*
* linux/include/linux/mtd/onenand.h
*
* Copyright (C) 2005-200
6
Samsung Electronics
* Copyright (C) 2005-200
7
Samsung Electronics
* Kyungmin Park <kyungmin.park@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -42,14 +42,10 @@ typedef enum {
/**
* struct onenand_bufferram - OneNAND BufferRAM Data
* @block: block address in BufferRAM
* @page: page address in BufferRAM
* @valid: valid flag
* @blockpage: block & page address in BufferRAM
*/
struct
onenand_bufferram
{
int
block
;
int
page
;
int
valid
;
int
blockpage
;
};
/**
...
...
@@ -63,7 +59,6 @@ struct onenand_bufferram {
* partly be set to inform onenand_scan about
* @erase_shift: [INTERN] number of address bits in a block
* @page_shift: [INTERN] number of address bits in a page
* @ppb_shift: [INTERN] number of address bits in a pages per block
* @page_mask: [INTERN] a page per block mask
* @bufferram_index: [INTERN] BufferRAM index
* @bufferram: [INTERN] BufferRAM info
...
...
@@ -103,7 +98,6 @@ struct onenand_chip {
unsigned
int
erase_shift
;
unsigned
int
page_shift
;
unsigned
int
ppb_shift
;
/* Pages per block shift */
unsigned
int
page_mask
;
unsigned
int
bufferram_index
;
...
...
@@ -150,6 +144,9 @@ struct onenand_chip {
#define ONENAND_SET_SYS_CFG1(v, this) \
(this->write_word(v, this->base + ONENAND_REG_SYS_CFG1))
#define ONENAND_IS_DDP(this) \
(this->device_id & ONENAND_DEVICE_IS_DDP)
/* Check byte access in OneNAND */
#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
...
...
include/linux/mtd/onenand_regs.h
View file @
c1f16258
...
...
@@ -3,7 +3,8 @@
*
* OneNAND Register header file
*
* Copyright (C) 2005-2006 Samsung Electronics
* Copyright (C) 2005-2007 Samsung Electronics
* Kyungmin Park <kyungmin.park@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
...
...
@@ -80,9 +81,11 @@
#define ONENAND_VERSION_PROCESS_SHIFT (8)
/*
* Start Address 1 F100h (R/W)
* Start Address 1 F100h (R/W)
& Start Address 2 F101h (R/W)
*/
#define ONENAND_DDP_SHIFT (15)
#define ONENAND_DDP_CHIP0 (0)
#define ONENAND_DDP_CHIP1 (1 << ONENAND_DDP_SHIFT)
/*
* Start Address 8 F107h (R/W)
...
...
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