summaryrefslogtreecommitdiff
path: root/util/flash_and_burn/jedec.c
diff options
context:
space:
mode:
authorLi-Ta Lo <ollie@lanl.gov>2004-12-07 03:15:51 +0000
committerLi-Ta Lo <ollie@lanl.gov>2004-12-07 03:15:51 +0000
commitbb7c3935c953c7631af8ad8422361099c70b42d8 (patch)
tree459394b2936981beb3b1b3b491baa11ce76652a4 /util/flash_and_burn/jedec.c
parent3a81285409cf09091b1704d126a38a5126030d2b (diff)
downloadcoreboot-bb7c3935c953c7631af8ad8422361099c70b42d8.tar.xz
SST49LF00[2,3,4] should use
the same driver as 49LF008 git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1812 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flash_and_burn/jedec.c')
-rw-r--r--util/flash_and_burn/jedec.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/util/flash_and_burn/jedec.c b/util/flash_and_burn/jedec.c
index 19a233b81c..0344b6985c 100644
--- a/util/flash_and_burn/jedec.c
+++ b/util/flash_and_burn/jedec.c
@@ -89,6 +89,7 @@ int erase_sector_jedec(volatile unsigned char *bios, unsigned int page)
return (0);
}
+
int erase_block_jedec(volatile unsigned char *bios, unsigned int block)
{
volatile unsigned char *Temp;
@@ -149,43 +150,45 @@ int erase_chip_jedec(struct flashchip *flash)
return (0);
}
-void write_page_write_jedec(volatile unsigned char *bios, unsigned char *src,
- volatile unsigned char *dst, int page_size)
+int write_page_write_jedec(volatile unsigned char *bios, unsigned char *src,
+ volatile unsigned char *dst, int page_size)
{
int i;
/* Issue JEDEC Data Unprotect comand */
- *(volatile char *) (bios + 0x5555) = 0xAA;
- *(volatile char *) (bios + 0x2AAA) = 0x55;
- *(volatile char *) (bios + 0x5555) = 0xA0;
+ *(volatile unsigned char *) (bios + 0x5555) = 0xAA;
+ *(volatile unsigned char *) (bios + 0x2AAA) = 0x55;
+ *(volatile unsigned char *) (bios + 0x5555) = 0xA0;
+ /* transfer data from source to destination */
for (i = 0; i < page_size; i++) {
- /* transfer data from source to destination */
+ /* If the data is 0xFF, don't program it */
+ if (*src == 0xFF)
+ continue;
*dst++ = *src++;
}
- usleep(100);
toggle_ready_jedec(dst - 1);
+
+ return 0;
}
int write_byte_program_jedec(volatile unsigned char *bios, unsigned char *src,
volatile unsigned char *dst)
{
- volatile unsigned char *Temp;
-
- /* transfer data from source to destination */
+ /* If the data is 0xFF, don't program it */
if (*src == 0xFF) {
- /* If the data is 0xFF, don't program it */
return 0;
}
+
/* Issue JEDEC Byte Program command */
- Temp = bios + 0x5555;
- *Temp = 0xAA;
- Temp = bios + 0x2AAA;
- *Temp = 0x55;
- Temp = bios + 0x5555;
- *Temp = 0xA0;
+ *(volatile unsigned char *) (bios + 0x5555) = 0xAA;
+ *(volatile unsigned char *) (bios + 0x2AAA) = 0x55;
+ *(volatile unsigned char *) (bios + 0x5555) = 0xA0;
+
+ /* transfer data from source to destination */
*dst = *src;
+
toggle_ready_jedec(bios);
return 0;