Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rk3576 Downstream U-Boot
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Frattaroli
Rk3576 Downstream U-Boot
Commits
64ace0d1
Commit
64ace0d1
authored
16 years ago
by
Wolfgang Denk
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
git://git.denx.de/u-boot-nand-flash
parents
0cfa6a9d
8da60128
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/env_nand.c
+4
-2
4 additions, 2 deletions
common/env_nand.c
drivers/mtd/nand/nand.c
+4
-0
4 additions, 0 deletions
drivers/mtd/nand/nand.c
drivers/mtd/nand/nand_base.c
+19
-2
19 additions, 2 deletions
drivers/mtd/nand/nand_base.c
with
27 additions
and
4 deletions
common/env_nand.c
+
4
−
2
View file @
64ace0d1
...
...
@@ -304,9 +304,11 @@ void env_relocate_spec (void)
crc1_ok
=
(
crc32
(
0
,
tmp_env1
->
data
,
ENV_SIZE
)
==
tmp_env1
->
crc
);
crc2_ok
=
(
crc32
(
0
,
tmp_env2
->
data
,
ENV_SIZE
)
==
tmp_env2
->
crc
);
if
(
!
crc1_ok
&&
!
crc2_ok
)
if
(
!
crc1_ok
&&
!
crc2_ok
)
{
free
(
tmp_env1
);
free
(
tmp_env2
);
return
use_default
();
else
if
(
crc1_ok
&&
!
crc2_ok
)
}
else
if
(
crc1_ok
&&
!
crc2_ok
)
gd
->
env_valid
=
1
;
else
if
(
!
crc1_ok
&&
crc2_ok
)
gd
->
env_valid
=
2
;
...
...
This diff is collapsed.
Click to expand it.
drivers/mtd/nand/nand.c
+
4
−
0
View file @
64ace0d1
...
...
@@ -28,6 +28,8 @@
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
#endif
DECLARE_GLOBAL_DATA_PTR
;
int
nand_curr_device
=
-
1
;
nand_info_t
nand_info
[
CONFIG_SYS_MAX_NAND_DEVICE
];
...
...
@@ -46,6 +48,8 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
if
(
nand_scan
(
mtd
,
1
)
==
0
)
{
if
(
!
mtd
->
name
)
mtd
->
name
=
(
char
*
)
default_nand_name
;
else
mtd
->
name
+=
gd
->
reloc_off
;
}
else
mtd
->
name
=
NULL
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
drivers/mtd/nand/nand_base.c
+
19
−
2
View file @
64ace0d1
...
...
@@ -75,6 +75,17 @@
#include
<jffs2/jffs2.h>
#endif
/*
* CONFIG_SYS_NAND_RESET_CNT is used as a timeout mechanism when resetting
* a flash. NAND flash is initialized prior to interrupts so standard timers
* can't be used. CONFIG_SYS_NAND_RESET_CNT should be set to a value
* which is greater than (max NAND reset time / NAND status read time).
* A conservative default of 200000 (500 us / 25 ns) is used as a default.
*/
#ifndef CONFIG_SYS_NAND_RESET_CNT
#define CONFIG_SYS_NAND_RESET_CNT 200000
#endif
/* Define default oob placement schemes for large and small page devices */
static
struct
nand_ecclayout
nand_oob_8
=
{
.
eccbytes
=
3
,
...
...
@@ -524,6 +535,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int command,
{
register
struct
nand_chip
*
chip
=
mtd
->
priv
;
int
ctrl
=
NAND_CTRL_CLE
|
NAND_CTRL_CHANGE
;
uint32_t
rst_sts_cnt
=
CONFIG_SYS_NAND_RESET_CNT
;
/*
* Write out the command to the device.
...
...
@@ -590,7 +602,8 @@ static void nand_command(struct mtd_info *mtd, unsigned int command,
NAND_CTRL_CLE
|
NAND_CTRL_CHANGE
);
chip
->
cmd_ctrl
(
mtd
,
NAND_CMD_NONE
,
NAND_NCE
|
NAND_CTRL_CHANGE
);
while
(
!
(
chip
->
read_byte
(
mtd
)
&
NAND_STATUS_READY
))
;
while
(
!
(
chip
->
read_byte
(
mtd
)
&
NAND_STATUS_READY
)
&&
(
rst_sts_cnt
--
));
return
;
/* This applies to read commands */
...
...
@@ -626,6 +639,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
int
column
,
int
page_addr
)
{
register
struct
nand_chip
*
chip
=
mtd
->
priv
;
uint32_t
rst_sts_cnt
=
CONFIG_SYS_NAND_RESET_CNT
;
/* Emulate NAND_CMD_READOOB */
if
(
command
==
NAND_CMD_READOOB
)
{
...
...
@@ -696,7 +710,8 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
NAND_NCE
|
NAND_CLE
|
NAND_CTRL_CHANGE
);
chip
->
cmd_ctrl
(
mtd
,
NAND_CMD_NONE
,
NAND_NCE
|
NAND_CTRL_CHANGE
);
while
(
!
(
chip
->
read_byte
(
mtd
)
&
NAND_STATUS_READY
))
;
while
(
!
(
chip
->
read_byte
(
mtd
)
&
NAND_STATUS_READY
)
&&
(
rst_sts_cnt
--
));
return
;
case
NAND_CMD_RNDOUT
:
...
...
@@ -2618,7 +2633,9 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
type
=
nand_get_flash_type
(
mtd
,
chip
,
busw
,
&
nand_maf_id
);
if
(
IS_ERR
(
type
))
{
#ifndef CONFIG_SYS_NAND_QUIET_TEST
printk
(
KERN_WARNING
"No NAND device found!!!
\n
"
);
#endif
chip
->
select_chip
(
mtd
,
-
1
);
return
PTR_ERR
(
type
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment