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
06ecb04a
Commit
06ecb04a
authored
Jun 02, 2009
by
Sascha Hauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mxc_nand: merge send_read_page and send_prog_page
Signed-off-by:
Sascha Hauer
<
s.hauer@pengutronix.de
>
parent
13e1add1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
41 deletions
+13
-41
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/mxc_nand.c
+13
-41
No files found.
drivers/mtd/nand/mxc_nand.c
View file @
06ecb04a
...
...
@@ -226,12 +226,10 @@ static void send_addr(struct mxc_nand_host *host, uint16_t addr, int islast)
wait_op_done
(
host
,
TROP_US_DELAY
,
addr
,
islast
);
}
/* This function requests the NANDFC to initate the transfer
* of data currently in the NANDFC RAM buffer to the NAND device. */
static
void
send_prog_page
(
struct
mxc_nand_host
*
host
,
uint8_t
buf_id
,
int
spare_only
)
static
void
send_page
(
struct
mxc_nand_host
*
host
,
uint8_t
buf_id
,
int
spare_only
,
unsigned
int
ops
)
{
DEBUG
(
MTD_DEBUG_LEVEL3
,
"send_p
rog_p
age (%d)
\n
"
,
spare_only
);
DEBUG
(
MTD_DEBUG_LEVEL3
,
"send_page (%d)
\n
"
,
spare_only
);
/* NANDFC buffer 0 is used for page read/write */
writew
(
buf_id
,
host
->
regs
+
NFC_BUF_ADDR
);
...
...
@@ -246,33 +244,7 @@ static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
writew
(
config1
,
host
->
regs
+
NFC_CONFIG1
);
}
writew
(
NFC_INPUT
,
host
->
regs
+
NFC_CONFIG2
);
/* Wait for operation to complete */
wait_op_done
(
host
,
TROP_US_DELAY
,
spare_only
,
true
);
}
/* Requests NANDFC to initated the transfer of data from the
* NAND device into in the NANDFC ram buffer. */
static
void
send_read_page
(
struct
mxc_nand_host
*
host
,
uint8_t
buf_id
,
int
spare_only
)
{
DEBUG
(
MTD_DEBUG_LEVEL3
,
"send_read_page (%d)
\n
"
,
spare_only
);
/* NANDFC buffer 0 is used for page read/write */
writew
(
buf_id
,
host
->
regs
+
NFC_BUF_ADDR
);
/* Configure spare or page+spare access */
if
(
!
host
->
pagesize_2k
)
{
uint32_t
config1
=
readw
(
host
->
regs
+
NFC_CONFIG1
);
if
(
spare_only
)
config1
|=
NFC_SP_EN
;
else
config1
&=
~
NFC_SP_EN
;
writew
(
config1
,
host
->
regs
+
NFC_CONFIG1
);
}
writew
(
NFC_OUTPUT
,
host
->
regs
+
NFC_CONFIG2
);
writew
(
ops
,
host
->
regs
+
NFC_CONFIG2
);
/* Wait for operation to complete */
wait_op_done
(
host
,
TROP_US_DELAY
,
spare_only
,
true
);
...
...
@@ -756,13 +728,13 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
break
;
case
NAND_CMD_PAGEPROG
:
send_p
rog_page
(
host
,
0
,
host
->
spare_only
);
send_p
age
(
host
,
0
,
host
->
spare_only
,
NFC_INPUT
);
if
(
host
->
pagesize_2k
)
{
/* data in 4 areas datas */
send_p
rog_page
(
host
,
1
,
host
->
spare_only
);
send_p
rog_page
(
host
,
2
,
host
->
spare_only
);
send_p
rog_page
(
host
,
3
,
host
->
spare_only
);
send_p
age
(
host
,
1
,
host
->
spare_only
,
NFC_INPUT
);
send_p
age
(
host
,
2
,
host
->
spare_only
,
NFC_INPUT
);
send_p
age
(
host
,
3
,
host
->
spare_only
,
NFC_INPUT
);
}
break
;
...
...
@@ -827,12 +799,12 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
/* send read confirm command */
send_cmd
(
host
,
NAND_CMD_READSTART
,
true
);
/* read for each AREA */
send_
read_page
(
host
,
0
,
host
->
spare_only
);
send_
read_page
(
host
,
1
,
host
->
spare_only
);
send_
read_page
(
host
,
2
,
host
->
spare_only
);
send_
read_page
(
host
,
3
,
host
->
spare_only
);
send_
page
(
host
,
0
,
host
->
spare_only
,
NFC_OUTPUT
);
send_
page
(
host
,
1
,
host
->
spare_only
,
NFC_OUTPUT
);
send_
page
(
host
,
2
,
host
->
spare_only
,
NFC_OUTPUT
);
send_
page
(
host
,
3
,
host
->
spare_only
,
NFC_OUTPUT
);
}
else
send_
read_page
(
host
,
0
,
host
->
spare_only
);
send_
page
(
host
,
0
,
host
->
spare_only
,
NFC_OUTPUT
);
break
;
case
NAND_CMD_READID
:
...
...
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