Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Evan Lojewski
ast2050-flashrom
Commits
213ee71f
Commit
213ee71f
authored
23 years ago
by
Ronald G. Minnich
Browse files
Options
Download
Email Patches
Plain Diff
Support for the 39sf020
Corresponding to coreboot v1 svn r544.
parent
3193a907
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
13 deletions
+36
-13
flash_rom.c
flash_rom.c
+1
-1
sst39sf020.c
sst39sf020.c
+35
-12
No files found.
flash_rom.c
View file @
213ee71f
...
...
@@ -48,7 +48,7 @@ struct flashchip flashchips[] = {
{
"SST28SF040A"
,
SST_ID
,
SST_28SF040
,
NULL
,
512
,
256
,
probe_28sf040
,
erase_28sf040
,
write_28sf040
},
{
"SST39SF020A"
,
SST_ID
,
SST_39SF020
,
NULL
,
256
,
4096
,
probe_
jedec
,
erase_
jedec
,
write_39sf020
},
probe_
39sf020
,
erase_
39sf020
,
write_39sf020
},
{
"W29C020C"
,
WINBOND_ID
,
W_29C020C
,
NULL
,
256
,
128
,
probe_jedec
,
erase_jedec
,
write_jedec
},
{
NULL
,}
...
...
This diff is collapsed.
Click to expand it.
sst39sf020.c
View file @
213ee71f
...
...
@@ -72,13 +72,19 @@ static __inline__ erase_sector_39sf020 (volatile char * bios, unsigned long addr
toggle_ready_jedec
(
bios
);
}
static
__inline__
write_sector_39sf020
(
volatile
char
*
bios
,
unsigned
char
*
src
,
volatile
unsigned
char
*
dst
,
unsigned
int
page_size
)
static
__inline__
write_sector_39sf020
(
volatile
char
*
bios
,
unsigned
char
*
src
,
volatile
unsigned
char
*
dst
,
unsigned
int
page_size
)
{
int
i
;
volatile
char
*
Temp
;
for
(
i
=
0
;
i
<
page_size
;
i
++
)
{
if
(
*
dst
!=
0xff
)
{
printf
(
"FATAL: dst %p not erased (val 0x%x
\n
"
,
dst
,
*
dst
);
return
;
}
/* transfer data from source to destination */
if
(
*
src
==
0xFF
)
{
dst
++
,
src
++
;
...
...
@@ -91,8 +97,11 @@ static __inline__ write_sector_39sf020(volatile char * bios, unsigned char * src
*
Temp
=
0x55
;
Temp
=
bios
+
0x5555
;
*
Temp
=
0xA0
;
*
dst
++
=
*
src
++
;
*
dst
=
*
src
;
toggle_ready_jedec
(
bios
);
if
(
*
dst
!=
*
src
)
printf
(
"BAD! dst 0x%x val 0x%x src 0x%x
\n
"
,
dst
,
*
dst
,
*
src
);
dst
++
,
src
++
;
}
}
...
...
@@ -127,15 +136,29 @@ int probe_39sf020 (struct flashchip * flash)
int
erase_39sf020
(
struct
flashchip
*
flash
)
{
volatile
char
*
bios
=
flash
->
virt_addr
;
unprotect_39sf020
(
bios
);
*
bios
=
CHIP_ERASE
;
*
bios
=
CHIP_ERASE
;
protect_39sf020
(
bios
);
volatile
unsigned
char
*
bios
=
flash
->
virt_addr
;
volatile
unsigned
char
*
Temp
;
/* Issue the Sector Erase command to 39SF020 */
printf
(
__FUNCTION__
" bios is %p
\n
"
,
bios
);
Temp
=
bios
+
0x5555
;
/* set up address to be C000:5555h */
*
Temp
=
0xAA
;
/* write data 0xAA to the address */
myusec_delay
(
10
);
toggle_ready_jedec
(
bios
);
Temp
=
bios
+
0x2AAA
;
/* set up address to be C000:2AAAh */
*
Temp
=
0x55
;
/* write data 0x55 to the address */
myusec_delay
(
10
);
Temp
=
bios
+
0x5555
;
/* set up address to be C000:5555h */
*
Temp
=
0x80
;
/* write data 0x80 to the address */
myusec_delay
(
10
);
Temp
=
bios
+
0x5555
;
/* set up address to be C000:5555h */
*
Temp
=
0xAA
;
/* write data 0xAA to the address */
myusec_delay
(
10
);
Temp
=
bios
+
0x2AAA
;
/* set up address to be C000:2AAAh */
*
Temp
=
0x55
;
/* write data 0x55 to the address */
myusec_delay
(
10
);
Temp
=
bios
+
0x5555
;
/* set up address to be C000:5555h */
*
Temp
=
0x10
;
/* write data 0x55 to the address */
myusec_delay
(
20000
);
}
int
write_39sf020
(
struct
flashchip
*
flash
,
char
*
buf
)
...
...
@@ -145,7 +168,7 @@ int write_39sf020 (struct flashchip * flash, char * buf)
volatile
char
*
bios
=
flash
->
virt_addr
;
// unprotect_39sf020 (bios);
erase_39sf020
(
flash
);
printf
(
"Programming Page: "
);
for
(
i
=
0
;
i
<
total_size
/
page_size
;
i
++
)
{
/* erase the page before programming */
...
...
This diff is collapsed.
Click to expand it.
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